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