[1072] | 1 | ! |
---|
| 2 | ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/geo2atm.F90,v 1.1 2008-12-05 17:56:40 lsce Exp $ |
---|
| 3 | ! |
---|
| 4 | SUBROUTINE geo2atm(im, jm, px, py, pz, plon, plat, pu, pv, pr) |
---|
| 5 | USE dimphy |
---|
| 6 | USE mod_phys_lmdz_para |
---|
[3465] | 7 | USE mod_grid_phy_lmdz, only: grid_type, unstructured, regular_lonlat |
---|
[5285] | 8 | USE yomcst_mod_h |
---|
[5274] | 9 | IMPLICIT NONE |
---|
| 10 | |
---|
[3465] | 11 | CHARACTER (len = 6) :: clmodnam |
---|
| 12 | CHARACTER (len = 20) :: modname = 'geo2atm' |
---|
| 13 | CHARACTER (len = 80) :: abort_message |
---|
[1072] | 14 | |
---|
[1146] | 15 | ! Change wind coordinates from cartesian geocentric to local spherical |
---|
[1072] | 16 | ! NB! Fonctionne probablement uniquement en MPI seul (sans OpenMP) |
---|
| 17 | ! |
---|
[3465] | 18 | ! Geocentric : |
---|
| 19 | ! axe x is eastward : crosses (0N,90E) point. |
---|
| 20 | ! axe y crosses (0N,180E) point. |
---|
| 21 | ! axe z is 'up' : crosses north pole. |
---|
| 22 | ! |
---|
| 23 | ! NB! Aux poles, fonctionne probablement uniquement en MPI seul (sans OpenMP) |
---|
| 24 | |
---|
[1072] | 25 | INTEGER, INTENT (IN) :: im, jm |
---|
| 26 | REAL, DIMENSION (im,jm), INTENT(IN) :: px, py, pz |
---|
| 27 | REAL, DIMENSION (im,jm), INTENT(IN) :: plon, plat |
---|
| 28 | REAL, DIMENSION (im,jm), INTENT(OUT) :: pu, pv, pr |
---|
| 29 | |
---|
[3465] | 30 | REAL :: rad,reps |
---|
[1146] | 31 | |
---|
| 32 | |
---|
| 33 | rad = rpi / 180.0E0 |
---|
[3465] | 34 | reps = 1.0e-5 |
---|
| 35 | |
---|
[1146] | 36 | pu(:,:) = & |
---|
| 37 | - px(:,:) * SIN(rad * plon(:,:)) & |
---|
| 38 | + py(:,:) * COS(rad * plon(:,:)) |
---|
[1072] | 39 | |
---|
[1146] | 40 | pv(:,:) = & |
---|
| 41 | - px(:,:) * SIN(rad * plat(:,:)) * COS(rad * plon(:,:)) & |
---|
| 42 | - py(:,:) * SIN(rad * plat(:,:)) * SIN(rad * plon(:,:)) & |
---|
| 43 | + pz(:,:) * COS(rad * plat(:,:)) |
---|
[1072] | 44 | |
---|
[1146] | 45 | pr(:,:) = & |
---|
| 46 | + px(:,:) * COS(rad * plat(:,:)) * COS(rad * plon(:,:)) & |
---|
| 47 | + py(:,:) * COS(rad * plat(:,:)) * SIN(rad * plon(:,:)) & |
---|
| 48 | + pz(:,:) * SIN(rad * plat(:,:)) |
---|
[1072] | 49 | |
---|
[3465] | 50 | IF (grid_type==regular_lonlat) THEN |
---|
| 51 | ! Value at North Pole |
---|
| 52 | IF (is_north_pole_dyn) THEN |
---|
| 53 | pu(:, 1) = -px (1,1) |
---|
| 54 | pv(:, 1) = -py (1,1) |
---|
| 55 | pr(:, 1) = 0.0 |
---|
| 56 | ENDIF |
---|
[1146] | 57 | |
---|
[3465] | 58 | ! Value at South Pole |
---|
| 59 | IF (is_south_pole_dyn) THEN |
---|
| 60 | pu(:,jm) = -px (1,jm) |
---|
| 61 | pv(:,jm) = -py (1,jm) |
---|
| 62 | pr(:,jm) = 0.0 |
---|
| 63 | ENDIF |
---|
| 64 | |
---|
| 65 | ELSE IF (grid_type==unstructured) THEN |
---|
| 66 | ! Pole nord pour Dynamico |
---|
| 67 | WHERE ( plat(:,:) >= 90.0-reps ) |
---|
| 68 | pu(:,:) = py(:,:) |
---|
| 69 | pv(:,:) = -px(:,:) |
---|
| 70 | pr(:,:) = 0.0e0 |
---|
| 71 | END WHERE |
---|
| 72 | |
---|
| 73 | ELSE |
---|
| 74 | abort_message='Problem: unknown grid type' |
---|
| 75 | CALL abort_physic(modname,abort_message,1) |
---|
| 76 | END IF |
---|
| 77 | |
---|
[1146] | 78 | |
---|
[3465] | 79 | |
---|
| 80 | |
---|
[1072] | 81 | END SUBROUTINE geo2atm |
---|