Changeset 1529
- Timestamp:
- Apr 5, 2016, 10:51:51 AM (9 years ago)
- Location:
- trunk/LMDZ.GENERIC
- Files:
-
- 7 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/README
r1525 r1529 1152 1152 - Got rid of references to "control_mod" from the physics. Added a couple 1153 1153 of relevent variables for outputs in time_phylmdz_mod. 1154 1155 == 05/04/2016 == EM 1156 - Got rid of references to "dimensions.h" from physics packages: 1157 use nbp_lon (=iim), nbp_lat (=jjp1) and nbp_lev 1158 from module mod_grid_phy_lmdz (in phy_common) instead. 1159 - Removed module "comhdiff_mod.F90", as it is only used by module 1160 surf_heat_transp_mod.F90, moved module variables there. 1161 - Addedin "surf_heat_transp_mod" local versions of some arrays 1162 and routines (from dyn3d) required to compute gradient, divergence, etc. 1163 on the global dynamics grid. 1164 As before, the slab ocean only works in serial. -
trunk/LMDZ.GENERIC/libf/dynlonlat_phylonlat/phystd/iniphysiq_mod.F90
r1525 r1529 4 4 5 5 subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, & 6 rlatu,rlatv,rlonu,rlonv,aire,cu,cv,&6 rlatudyn,rlatvdyn,rlonudyn,rlonvdyn,airedyn,cudyn,cvdyn, & 7 7 prad,pg,pr,pcpp,iflag_phys) 8 8 … … 21 21 rlond, & ! longitudes 22 22 rlatd ! latitudes 23 use surf_heat_transp_mod, only: ini_surf_heat_transp 23 24 use infotrac, only : nqtot ! number of advected tracers 24 25 use planete_mod, only: ini_planete_mod … … 29 30 north_east, north_west, & 30 31 south_west, south_east 32 use ioipsl_getin_p_mod, only: getin_p 31 33 32 34 implicit none 33 35 include "dimensions.h" 36 include "paramet.h" 37 include "comgeom.h" 34 38 include "iniprint.h" 35 39 … … 43 47 integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes 44 48 integer,intent(in) :: jj ! number of atompsheric columns along latitudes 45 real,intent(in) :: rlatu (jj+1) ! latitudes of the physics grid46 real,intent(in) :: rlatv (jj) ! latitude boundaries of the physics grid47 real,intent(in) :: rlonv (ii+1) ! longitudes of the physics grid48 real,intent(in) :: rlonu (ii+1) ! longitude boundaries of the physics grid49 real,intent(in) :: aire (ii+1,jj+1) ! area of the dynamics grid (m2)50 real,intent(in) :: cu ((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u)51 real,intent(in) :: cv ((ii+1)*jj) ! cv coeff. (v_covariant = cv * v)49 real,intent(in) :: rlatudyn(jj+1) ! latitudes of the physics grid 50 real,intent(in) :: rlatvdyn(jj) ! latitude boundaries of the physics grid 51 real,intent(in) :: rlonvdyn(ii+1) ! longitudes of the physics grid 52 real,intent(in) :: rlonudyn(ii+1) ! longitude boundaries of the physics grid 53 real,intent(in) :: airedyn(ii+1,jj+1) ! area of the dynamics grid (m2) 54 real,intent(in) :: cudyn((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) 55 real,intent(in) :: cvdyn((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) 52 56 integer,intent(in) :: pdayref ! reference day of for the simulation 53 57 real,intent(in) :: ptimestep !physics time step (s) … … 60 64 real :: total_area_phy, total_area_dyn 61 65 real :: pi 66 logical :: ok_slab_ocean 62 67 63 68 ! boundaries, on global grid … … 99 104 100 105 DO i=1,ii 101 boundslon_reg(i,east)=rlonu (i)102 boundslon_reg(i,west)=rlonu (i+1)106 boundslon_reg(i,east)=rlonudyn(i) 107 boundslon_reg(i,west)=rlonudyn(i+1) 103 108 ENDDO 104 109 105 110 boundslat_reg(1,north)= PI/2 106 boundslat_reg(1,south)= rlatv (1)111 boundslat_reg(1,south)= rlatvdyn(1) 107 112 DO j=2,jj 108 boundslat_reg(j,north)=rlatv (j-1)109 boundslat_reg(j,south)=rlatv (j)113 boundslat_reg(j,north)=rlatvdyn(j-1) 114 boundslat_reg(j,south)=rlatvdyn(j) 110 115 ENDDO 111 boundslat_reg(jj+1,north)= rlatv (jj)116 boundslat_reg(jj+1,north)= rlatvdyn(jj) 112 117 boundslat_reg(jj+1,south)= -PI/2 113 118 114 119 ! Write values in module regular_lonlat_mod 115 CALL init_regular_lonlat(ii,jj+1, rlonv (1:ii), rlatu, &120 CALL init_regular_lonlat(ii,jj+1, rlonvdyn(1:ii), rlatudyn, & 116 121 boundslon_reg, boundslat_reg) 117 122 118 123 ! Generate global arrays on full physics grid 119 124 allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo)) 120 latfi(1)=rlatu (1)125 latfi(1)=rlatudyn(1) 121 126 lonfi(1)=0. 122 cufi(1) = cu (1)123 cvfi(1) = cv (1)127 cufi(1) = cudyn(1) 128 cvfi(1) = cvdyn(1) 124 129 DO j=2,jj 125 130 DO i=1,ii 126 latfi((j-2)*ii+1+i)= rlatu (j)127 lonfi((j-2)*ii+1+i)= rlonv (i)128 cufi((j-2)*ii+1+i) = cu ((j-1)*(ii+1)+i)129 cvfi((j-2)*ii+1+i) = cv ((j-1)*(ii+1)+i)131 latfi((j-2)*ii+1+i)= rlatudyn(j) 132 lonfi((j-2)*ii+1+i)= rlonvdyn(i) 133 cufi((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i) 134 cvfi((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i) 130 135 ENDDO 131 136 ENDDO 132 latfi(klon_glo)= rlatu (jj+1)137 latfi(klon_glo)= rlatudyn(jj+1) 133 138 lonfi(klon_glo)= 0. 134 cufi(klon_glo) = cu ((ii+1)*jj+1)135 cvfi(klon_glo) = cv ((ii+1)*jj-ii)139 cufi(klon_glo) = cudyn((ii+1)*jj+1) 140 cvfi(klon_glo) = cvdyn((ii+1)*jj-ii) 136 141 137 142 ! build airefi(), mesh area on physics grid 138 143 allocate(airefi(klon_glo)) 139 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire ,airefi)144 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi) 140 145 ! Poles are single points on physics grid 141 airefi(1)=sum(aire (1:ii,1))142 airefi(klon_glo)=sum(aire (1:ii,jj+1))146 airefi(1)=sum(airedyn(1:ii,1)) 147 airefi(klon_glo)=sum(airedyn(1:ii,jj+1)) 143 148 144 149 ! Sanity check: do total planet area match between physics and dynamics? 145 total_area_dyn=sum(aire (1:ii,1:jj+1))150 total_area_dyn=sum(airedyn(1:ii,1:jj+1)) 146 151 total_area_phy=sum(airefi(1:klon_glo)) 147 152 IF (total_area_dyn/=total_area_phy) THEN … … 174 179 call ini_planete_mod(nlayer,preff,ap,bp) 175 180 181 ! for slab ocean, copy over some arrays 182 ok_slab_ocean=.false. ! default value 183 call getin_p("ok_slab_ocean",ok_slab_ocean) 184 if (ok_slab_ocean) then 185 call ini_surf_heat_transp(ip1jm,ip1jmp1,unsairez,fext,unsaire, & 186 cu,cuvsurcv,cv,cvusurcu,aire,apoln,apols, & 187 aireu,airev) 188 endif 189 176 190 ! copy some fundamental parameters to physics 177 191 ! and do some initializations -
trunk/LMDZ.GENERIC/libf/phystd/aeroptproperties.F90
r1397 r1529 31 31 ! Varying nueff section removed by R. Wordsworth for simplicity 32 32 ! ============================================================== 33 34 !#include "dimensions.h"35 !#include "dimphys.h"36 33 37 34 ! Local variables -
trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
r1526 r1529 19 19 USE tracer_h 20 20 use comcstfi_mod, only: pi, mugaz, cpp 21 use callkeys_mod, only: varactive,diurnal,tracer,water,nosurf,varfixed,satval, 22 21 use callkeys_mod, only: varactive,diurnal,tracer,water,nosurf,varfixed,satval, & 22 kastprof,strictboundcorrk,specOLR,CLFvarying 23 23 24 24 implicit none … … 144 144 145 145 ! Local aerosol optical properties for each column on RADIATIVE grid. 146 real*8,save :: QXVAER(L_LEVELS+1,L_NSPECTV,naerkind) 147 real*8,save :: QSVAER(L_LEVELS+1,L_NSPECTV,naerkind) 148 real*8,save :: GVAER(L_LEVELS+1,L_NSPECTV,naerkind) 149 real*8,save :: QXIAER(L_LEVELS+1,L_NSPECTI,naerkind) 150 real*8,save :: QSIAER(L_LEVELS+1,L_NSPECTI,naerkind) 151 real*8,save :: GIAER(L_LEVELS+1,L_NSPECTI,naerkind) 152 153 !REAL :: QREFvis3d(ngrid,nlayer,naerkind) 154 !REAL :: QREFir3d(ngrid,nlayer,naerkind) 155 !save QREFvis3d, QREFir3d 146 real*8,save,allocatable :: QXVAER(:,:,:) 147 real*8,save,allocatable :: QSVAER(:,:,:) 148 real*8,save,allocatable :: GVAER(:,:,:) 149 real*8,save,allocatable :: QXIAER(:,:,:) 150 real*8,save,allocatable :: QSIAER(:,:,:) 151 real*8,save,allocatable :: GIAER(:,:,:) 152 156 153 real, dimension(:,:,:), save, allocatable :: QREFvis3d 157 154 real, dimension(:,:,:), save, allocatable :: QREFir3d … … 188 185 189 186 190 qxvaer(:,:,:)=0.0191 qsvaer(:,:,:)=0.0192 gvaer(:,:,:) =0.0193 194 qxiaer(:,:,:)=0.0195 qsiaer(:,:,:)=0.0196 giaer(:,:,:) =0.0197 198 187 if(firstcall) then 188 189 ! test on allocated necessary because of CLFvarying (two calls to callcorrk in physiq) 190 if(.not.allocated(QXVAER)) allocate(QXVAER(L_LEVELS+1,L_NSPECTV,naerkind)) 191 if(.not.allocated(QSVAER)) allocate(QSVAER(L_LEVELS+1,L_NSPECTV,naerkind)) 192 if(.not.allocated(GVAER)) allocate(GVAER(L_LEVELS+1,L_NSPECTV,naerkind)) 193 if(.not.allocated(QXIAER)) allocate(QXIAER(L_LEVELS+1,L_NSPECTI,naerkind)) 194 if(.not.allocated(QSIAER)) allocate(QSIAER(L_LEVELS+1,L_NSPECTI,naerkind)) 195 if(.not.allocated(GIAER)) allocate(GIAER(L_LEVELS+1,L_NSPECTI,naerkind)) 199 196 200 197 !!! ALLOCATED instances are necessary because of CLFvarying (strategy to call callcorrk twice in physiq...) … … 212 209 endif 213 210 call su_aer_radii(ngrid,nlayer,reffrad,nueffrad) 214 211 215 212 216 213 !-------------------------------------------------- … … 264 261 end if ! of if (firstcall) 265 262 266 267 263 !======================================================================= 268 264 ! I.b Initialization on every call 269 265 !======================================================================= 270 266 271 267 qxvaer(:,:,:)=0.0 268 qsvaer(:,:,:)=0.0 269 gvaer(:,:,:) =0.0 270 271 qxiaer(:,:,:)=0.0 272 qsiaer(:,:,:)=0.0 273 giaer(:,:,:) =0.0 274 272 275 !-------------------------------------------------- 273 276 ! Effective radius and variance of the aerosols … … 277 280 278 281 if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! Treat condensed co2 particles. 279 282 call co2_reffrad(ngrid,nlayer,nq,pq,reffrad(1,1,iaero_co2)) 280 283 print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 281 284 print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 282 285 end if 283 286 284 287 if ((iaer.eq.iaero_h2o).and.water) then ! Treat condensed water particles. To be generalized for other aerosols ... 285 288 call h2o_reffrad(ngrid,nlayer,pq(1,1,igcm_h2o_ice),pt, & 286 289 reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) 287 290 print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' … … 290 293 291 294 if(iaer.eq.iaero_dust)then 292 295 call dust_reffrad(ngrid,nlayer,reffrad(1,1,iaero_dust)) 293 296 print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um' 294 297 endif 295 298 296 299 if(iaer.eq.iaero_h2so4)then 297 300 call h2so4_reffrad(ngrid,nlayer,reffrad(1,1,iaero_h2so4)) 298 301 print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um' 299 302 endif 300 303 301 304 if(iaer.eq.iaero_back2lay)then 302 305 call back2lay_reffrad(ngrid,reffrad(1,1,iaero_back2lay),nlayer,pplev) 303 306 endif 304 307 … … 321 324 reffrad,QREFvis3d,QREFir3d, & 322 325 tau_col,cloudfrac,totcloudfrac,clearsky) 323 326 324 327 325 328 … … 475 478 DO nw=1,L_NSPECTV ! Short Wave loop. 476 479 albv(nw)=albedo(ig,nw) 477 480 ENDDO 478 481 479 482 if (nosurf) then ! Case with no surface. 480 483 DO nw=1,L_NSPECTV 481 484 if(albv(nw).gt.0.0) then 482 485 print*,'For open lower boundary in callcorrk must' 483 486 print*,'have spectral surface band albedos all set to zero!' 484 487 call abort 485 486 488 endif 489 ENDDO 487 490 endif 488 491 … … 770 773 771 774 Cmk= 0.01 * 1.0 / (glat(ig) * mugaz * 1.672621e-27) ! q_main=1.0 assumed. 772 775 glat_ig=glat(ig) 773 776 774 777 !----------------------------------------------------------------------- … … 798 801 else ! During the night, fluxes = 0. 799 802 nfluxtopv = 0.0d0 800 803 fluxtopvdn = 0.0d0 801 804 nfluxoutv_nu(:) = 0.0d0 802 805 nfluxgndv_nu(:) = 0.0d0 … … 813 816 surface_stellar_flux=sum(nfluxgndv_nu(1:L_NSPECTV)) 814 817 if(surface_stellar_flux .gt. 1.0e-3) then ! equivalent albedo makes sense only if the stellar flux received by the surface is positive. 815 DO nw=1,L_NSPECTV816 818 DO nw=1,L_NSPECTV 819 albedo_temp(nw)=albedo(ig,nw)*nfluxgndv_nu(nw) 817 820 ENDDO 818 821 albedo_temp(1:L_NSPECTV)=albedo_temp(1:L_NSPECTV)/surface_stellar_flux 819 822 albedo_equivalent(ig)=sum(albedo_temp(1:L_NSPECTV)) 820 823 else 821 824 albedo_equivalent(ig)=0.0 ! Spectrally Integrated Albedo not defined for non-irradiated grid points. So we arbitrary set the equivalent albedo to 0. 822 825 endif 823 824 825 826 else 827 albedo_equivalent(ig)=0.0 ! Spectrally Integrated Albedo not defined for non-irradiated grid points. So we arbitrary set the equivalent albedo to 0. 828 endif 826 829 827 830 … … 956 959 IF( ALLOCATED( pfgasref ) ) DEALLOCATE( pfgasref ) 957 960 !$OMP END MASTER 958 !$OMP BARRIER 961 !$OMP BARRIER 959 962 IF ( ALLOCATED(reffrad)) DEALLOCATE(reffrad) 960 963 IF ( ALLOCATED(nueffrad)) DEALLOCATE(nueffrad) -
trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F
r1525 r1529 907 907 end !rcm1d 908 908 909 c*********************************************************************** 910 c*********************************************************************** 911 c Subroutines Bidons utilise seulement en 3D, mais 912 c necessaire a la compilation de rcm1d en 1D 913 914 ! subroutine gr_fi_dyn 915 ! RETURN 916 ! END 917 918 c*********************************************************************** 919 c*********************************************************************** 920 921 !#include "../dyn3d/disvert.F" 922 !#include "../dyn3d/abort_gcm.F" 923 !#include "../dyn3d/diverg.F" 924 !#include "../dyn3d/grad.F" 925 !#include "../dyn3d/gr_u_scal.F" 926 !#include "../dyn3d/gr_v_scal.F" 927 !#include "../dyn3d/gr_dyn_fi.F" 928 909 -
trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90
r1525 r1529 9 9 prad,pg,pr,pcpp) 10 10 11 use radinc_h, only : naerkind 11 use radinc_h, only: ini_radinc_h, naerkind 12 use radcommon_h, only: ini_radcommon_h 12 13 use datafile_mod, only: datadir 13 14 use comdiurn_h, only: sinlat, coslat, sinlon, coslon … … 21 22 use planetwide_mod, only: planetwide_sumval 22 23 use callkeys_mod 24 use mod_phys_lmdz_para, only : is_parallel 23 25 24 26 !======================================================================= … … 74 76 REAL SSUM 75 77 76 CHARACTER ch1*1277 CHARACTER ch80*8078 79 logical chem, h2o80 81 real psurf,pN2 ! added by RW for Gliese 581d N2+CO282 83 78 ! initialize constants in comcstfi_mod 84 79 rad=prad … … 333 328 call getin_p("ok_slab_ocean",ok_slab_ocean) 334 329 write(*,*) "ok_slab_ocean = ",ok_slab_ocean 330 ! Sanity check: for now slab oncean only works in serial mode 331 if (ok_slab_ocean.and.is_parallel) then 332 write(*,*) " Error: slab ocean should only be used in serial mode!" 333 call abort 334 endif 335 335 336 336 write(*,*) "Use slab-sea-ice ?" … … 718 718 ENDDO 719 719 720 ! initialize variables in radinc_h 721 call ini_radinc_h(nlayer) 722 723 ! allocate "radcommon_h" arrays 724 call ini_radcommon_h() 725 720 726 ! allocate "comsoil_h" arrays 721 727 call ini_comsoil_h(ngrid) -
trunk/LMDZ.GENERIC/libf/phystd/inistats.F
r1422 r1529 1 1 subroutine inistats(ierr) 2 2 3 use statto_mod, only: istats,istime 3 4 use mod_phys_lmdz_para, only : is_master 4 use statto_mod, only: istats,istime5 5 USE comvert_mod, ONLY: ap,bp,aps,bps,preff,pseudoalt,presnivs 6 USE comconst_mod, ONLY: daysec,dtphys,pi 6 USE comconst_mod, ONLY: pi 7 USE time_phylmdz_mod, ONLY: daysec,dtphys 8 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 9 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev 7 10 implicit none 8 11 9 #include "dimensions.h" 10 #include "paramet.h" 11 #include "comgeom.h" 12 #include "netcdf.inc" 12 include "netcdf.inc" 13 13 14 14 integer,intent(out) :: ierr 15 15 integer :: nid 16 16 integer :: l,nsteppd 17 real, dimension(llm) :: sig_s 17 real, dimension(nbp_lev) :: sig_s 18 real :: lon_reg_ext(nbp_lon+1) ! extended longitudes 18 19 integer :: idim_lat,idim_lon,idim_llm,idim_llmp1,idim_time 19 20 real, dimension(istime) :: lt … … 39 40 write (*,*) 40 41 41 do l= 1, llm42 do l= 1, nbp_lev 42 43 sig_s(l)=((ap(l)+ap(l+1))/preff+bp(l)+bp(l+1))/2. 43 44 pseudoalt(l)=-10.*log(presnivs(l)/preff) 44 45 enddo 46 47 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 48 !add extra redundant point (180 degrees, since lon_reg starts at -180 49 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 45 50 46 51 if (is_master) then … … 53 58 endif 54 59 55 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_lat)56 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_lon)57 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)58 ierr = NF_DEF_DIM (nid, "llmp1", llm+1, idim_llmp1)60 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_lat) 61 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_lon) 62 ierr = NF_DEF_DIM (nid, "altitude", nbp_lev, idim_llm) 63 ierr = NF_DEF_DIM (nid, "llmp1", nbp_lev+1, idim_llmp1) 59 64 ierr = NF_DEF_DIM (nid, "Time", NF_UNLIMITED, idim_time) 60 65 … … 68 73 & "degrees_north",1,idim_lat,nvarid,ierr) 69 74 #ifdef NC_DOUBLE 70 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlatu/pi*180)75 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 71 76 #else 72 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlatu/pi*180)77 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 73 78 #endif 74 79 call def_var_stats(nid,"longitude","East longitude", 75 80 & "degrees_east",1,idim_lon,nvarid,ierr) 76 81 #ifdef NC_DOUBLE 77 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)82 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 78 83 #else 79 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)84 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 80 85 #endif 81 86 -
trunk/LMDZ.GENERIC/libf/phystd/initracer.F
r1397 r1529 22 22 c Ehouarn Millour (oct. 2008) identify tracers by their names 23 23 c======================================================================= 24 25 26 #include "dimensions.h"27 24 28 25 integer :: ngrid,nq -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F
r1524 r1529 1 SUBROUTINE iniwrite(nid,idayref,phis )1 SUBROUTINE iniwrite(nid,idayref,phis,area) 2 2 3 3 use comsoil_h, only: mlayer, nsoilmx 4 use comcstfi_mod, only: rad, omeg, g, mugaz, rcp, pi 5 use time_phylmdz_mod, only: daysec, dtphys 4 USE comcstfi_mod, only: g, mugaz, omeg, rad, rcp, pi 6 5 USE comvert_mod, ONLY: ap,bp,aps,bps,pseudoalt 7 6 USE logic_mod, ONLY: fxyhypb,ysinus 8 7 USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy 8 USE time_phylmdz_mod, ONLY: daysec, dtphys 9 9 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 10 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 11 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev 10 12 IMPLICIT NONE 11 13 … … 26 28 c ------------- 27 29 28 #include "dimensions.h" 29 #include "paramet.h" 30 #include "comgeom.h" 31 #include "netcdf.inc" 30 include "netcdf.inc" 32 31 33 32 c Arguments: … … 36 35 integer,intent(in) :: nid ! NetCDF file ID 37 36 INTEGER*4,intent(in) :: idayref ! date (initial date for this run) 38 real,intent(in) :: phis(ip1jmp1) ! surface geopotential 37 real,intent(in) :: phis(nbp_lon+1,nbp_lat) ! surface geopotential 38 real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2) 39 39 40 40 c Local: … … 44 44 REAL tab_cntrl(length) ! run parameters are stored in this array 45 45 INTEGER ierr 46 47 integer :: nvarid,idim_index,idim_rlonu,idim_rlonv 48 integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm 46 REAl :: lon_reg_ext(nbp_lon+1) ! extended longitudes 47 48 integer :: nvarid,idim_index,idim_rlonv 49 integer :: idim_rlatu,idim_llmp1,idim_llm 49 50 integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # 50 51 integer, dimension(2) :: id … … 54 55 tab_cntrl(l)=0. 55 56 ENDDO 56 tab_cntrl(1) = real( iim)57 tab_cntrl(2) = real( jjm)58 tab_cntrl(3) = real( llm)57 tab_cntrl(1) = real(nbp_lon) 58 tab_cntrl(2) = real(nbp_lat-1) 59 tab_cntrl(3) = real(nbp_lev) 59 60 tab_cntrl(4) = real(idayref) 60 61 tab_cntrl(5) = rad … … 99 100 100 101 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 101 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)102 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)103 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)104 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv)105 ierr = NF_DEF_DIM (nid, "interlayer", ( llm+1), idim_llmp1)106 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)102 ! ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 103 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu) 104 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv) 105 ! ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 106 ierr = NF_DEF_DIM (nid, "interlayer", (nbp_lev+1), idim_llmp1) 107 ierr = NF_DEF_DIM (nid, "altitude", nbp_lev, idim_llm) 107 108 ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx) 108 109 c … … 129 130 c -------------------------- 130 131 c longitudes and latitudes 131 ierr = NF_REDEF (nid) 132 #ifdef NC_DOUBLE 133 ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) 134 #else 135 ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) 136 #endif 137 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, 138 . "Longitudes at u nodes") 139 ierr = NF_ENDDEF(nid) 140 #ifdef NC_DOUBLE 141 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) 142 #else 143 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) 144 #endif 132 ! 133 ! ierr = NF_REDEF (nid) 134 !#ifdef NC_DOUBLE 135 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid) 136 !#else 137 ! ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid) 138 !#endif 139 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21, 140 ! . "Longitudes at u nodes") 141 ! ierr = NF_ENDDEF(nid) 142 !#ifdef NC_DOUBLE 143 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180) 144 !#else 145 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180) 146 !#endif 145 147 c 146 148 c -------------------------- … … 156 158 ierr = NF_ENDDEF(nid) 157 159 #ifdef NC_DOUBLE 158 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) 159 #else 160 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) 161 #endif 162 c 163 c -------------------------- 160 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 161 #else 162 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 163 #endif 164 c 165 c -------------------------- 166 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 167 !add extra redundant point (180 degrees, since lon_reg starts at -180 168 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 169 164 170 ierr = NF_REDEF (nid) 165 171 #ifdef NC_DOUBLE … … 173 179 ierr = NF_ENDDEF(nid) 174 180 #ifdef NC_DOUBLE 175 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)176 #else 177 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)181 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 182 #else 183 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 178 184 #endif 179 185 c … … 199 205 c 200 206 c -------------------------- 201 ierr = NF_REDEF (nid)202 #ifdef NC_DOUBLE203 ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)204 #else205 ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)206 #endif207 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,208 . "Latitudes at v nodes")209 ierr = NF_ENDDEF(nid)210 #ifdef NC_DOUBLE211 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180)212 #else213 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180)214 #endif207 ! ierr = NF_REDEF (nid) 208 !#ifdef NC_DOUBLE 209 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid) 210 !#else 211 ! ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid) 212 !#endif 213 ! ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20, 214 ! . "Latitudes at v nodes") 215 ! ierr = NF_ENDDEF(nid) 216 !#ifdef NC_DOUBLE 217 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180) 218 !#else 219 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180) 220 !#endif 215 221 c 216 222 c -------------------------- … … 274 280 c Mesh area and conversion coefficients cov. <-> contra. <--> natural 275 281 276 id(1)=idim_rlonu277 id(2)=idim_rlatu278 c 279 ierr = NF_REDEF (nid)280 #ifdef NC_DOUBLE281 ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid)282 #else283 ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid)284 #endif285 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,286 . "Conversion coefficients cov <--> natural")287 ierr = NF_ENDDEF(nid)288 #ifdef NC_DOUBLE289 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)290 #else291 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)292 #endif293 c 294 id(1)=idim_rlonv295 id(2)=idim_rlatv296 c 297 c -------------------------- 298 ierr = NF_REDEF (nid)299 #ifdef NC_DOUBLE300 ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid)301 #else302 ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid)303 #endif304 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,305 . "Conversion coefficients cov <--> natural")306 ierr = NF_ENDDEF(nid)307 #ifdef NC_DOUBLE308 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)309 #else310 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)311 #endif282 ! id(1)=idim_rlonu 283 ! id(2)=idim_rlatu 284 c 285 ! ierr = NF_REDEF (nid) 286 !#ifdef NC_DOUBLE 287 ! ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid) 288 !#else 289 ! ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid) 290 !#endif 291 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 292 ! . "Conversion coefficients cov <--> natural") 293 ! ierr = NF_ENDDEF(nid) 294 !#ifdef NC_DOUBLE 295 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 296 !#else 297 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 298 !#endif 299 c 300 ! id(1)=idim_rlonv 301 ! id(2)=idim_rlatv 302 c 303 c -------------------------- 304 ! ierr = NF_REDEF (nid) 305 !#ifdef NC_DOUBLE 306 ! ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid) 307 !#else 308 ! ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid) 309 !#endif 310 ! ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40, 311 ! . "Conversion coefficients cov <--> natural") 312 ! ierr = NF_ENDDEF(nid) 313 !#ifdef NC_DOUBLE 314 ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 315 !#else 316 ! ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 317 !#endif 312 318 c 313 319 id(1)=idim_rlonv … … 325 331 ierr = NF_ENDDEF(nid) 326 332 #ifdef NC_DOUBLE 327 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,a ire)328 #else 329 ierr = NF_PUT_VAR_REAL (nid,nvarid,a ire)333 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area) 334 #else 335 ierr = NF_PUT_VAR_REAL (nid,nvarid,area) 330 336 #endif 331 337 c … … 350 356 c 351 357 352 write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref 358 write(*,*)'iniwrite: nbp_lon,nbp_lat,nbp_lev,idayref', 359 & nbp_lon,nbp_lat,nbp_lev,idayref 353 360 write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp', 354 srad,omeg,g,mugaz,rcp361 & rad,omeg,g,mugaz,rcp 355 362 write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys 356 363 -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specIR.F
r1524 r1529 1 SUBROUTINE iniwrite_specIR(nid,idayref )1 SUBROUTINE iniwrite_specIR(nid,idayref,area) 2 2 3 3 use radinc_h, only: L_NSPECTI … … 8 8 USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy 9 9 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 10 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 11 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev 10 12 11 13 implicit none … … 27 29 c ------------- 28 30 29 #include "dimensions.h" 30 #include "paramet.h" 31 #include "comgeom.h" 32 #include "netcdf.inc" 33 !#include"dimphys.h" 31 include "netcdf.inc" 34 32 35 33 c Arguments: … … 38 36 integer,intent(in) :: nid ! NetCDF file ID 39 37 INTEGER*4,intent(in) :: idayref ! date (initial date for this run) 38 real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2) 40 39 41 40 c Local: … … 45 44 REAL tab_cntrl(length) ! run parameters are stored in this array 46 45 INTEGER ierr 46 REAl :: lon_reg_ext(nbp_lon+1) ! extended longitudes 47 47 48 48 integer :: nvarid,idim_index,idim_rlonu,idim_rlonv … … 57 57 tab_cntrl(l)=0. 58 58 ENDDO 59 tab_cntrl(1) = FLOAT( iim)60 tab_cntrl(2) = FLOAT( jjm)61 tab_cntrl(3) = FLOAT( llm)59 tab_cntrl(1) = FLOAT(nbp_lon) 60 tab_cntrl(2) = FLOAT(nbp_lat-1) 61 tab_cntrl(3) = FLOAT(nbp_lev) 62 62 tab_cntrl(4) = FLOAT(idayref) 63 63 tab_cntrl(5) = rad … … 102 102 103 103 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 104 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)105 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)104 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu) 105 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv) 106 106 ierr = NF_DEF_DIM (nid, "IR Wavenumber",L_NSPECTI,idim_bandsIR) 107 107 … … 141 141 ierr = NF_ENDDEF(nid) 142 142 #ifdef NC_DOUBLE 143 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) 144 #else 145 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) 146 #endif 147 c 148 c -------------------------- 143 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 144 #else 145 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 146 #endif 147 c 148 c -------------------------- 149 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 150 !add extra redundant point (180 degrees, since lon_reg starts at -180 151 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 152 149 153 ierr = NF_REDEF (nid) 150 154 #ifdef NC_DOUBLE … … 158 162 ierr = NF_ENDDEF(nid) 159 163 #ifdef NC_DOUBLE 160 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)161 #else 162 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)164 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 165 #else 166 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 163 167 #endif 164 168 c … … 172 176 #ifdef NC_DOUBLE 173 177 ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_DOUBLE,1, 174 . 178 . idim_bandsIR,nvarid) 175 179 #else 176 180 ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_FLOAT,1, 177 . 181 . idim_bandsIR,nvarid) 178 182 #endif 179 183 ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 34, … … 196 200 #ifdef NC_DOUBLE 197 201 ierr=NF_DEF_VAR(nid,"IR Bandwidth",NF_DOUBLE,1, 198 . 202 . idim_bandsIR,nvarid) 199 203 #else 200 204 ierr=NF_DEF_VAR(nid,"IR Bandwidth",NF_FLOAT,1, 201 . 205 . idim_bandsIR,nvarid) 202 206 #endif 203 207 ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 25, … … 230 234 ierr = NF_ENDDEF(nid) 231 235 #ifdef NC_DOUBLE 232 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,a ire)233 #else 234 ierr = NF_PUT_VAR_REAL (nid,nvarid,a ire)236 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area) 237 #else 238 ierr = NF_PUT_VAR_REAL (nid,nvarid,area) 235 239 #endif 236 240 -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specVI.F
r1524 r1529 1 SUBROUTINE iniwrite_specVI(nid,idayref )1 SUBROUTINE iniwrite_specVI(nid,idayref,area) 2 2 3 3 use radinc_h, only: L_NSPECTV 4 4 use radcommon_h, only: WNOV,DWNV 5 use comsoil_h6 5 use comcstfi_mod, only: rad, omeg, g, mugaz, rcp, pi 7 6 use time_phylmdz_mod, only: daysec, dtphys … … 9 8 USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy 10 9 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 10 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 11 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev 11 12 12 13 implicit none … … 28 29 c ------------- 29 30 30 #include "dimensions.h" 31 #include "paramet.h" 32 #include "comgeom.h" 33 #include "netcdf.inc" 34 !#include"dimphys.h" 31 include "netcdf.inc" 35 32 36 33 c Arguments: 37 34 c ---------- 38 35 39 integer nid ! NetCDF file ID 40 INTEGER*4 idayref ! date (initial date for this run) 36 integer,intent(in) :: nid ! NetCDF file ID 37 INTEGER*4,INTENT(IN) :: idayref ! date (initial date for this run) 38 real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2) 41 39 42 40 c Local: … … 46 44 REAL tab_cntrl(length) ! run parameters are stored in this array 47 45 INTEGER ierr 46 REAl :: lon_reg_ext(nbp_lon+1) ! extended longitudes 48 47 49 48 integer :: nvarid,idim_index,idim_rlonu,idim_rlonv … … 58 57 tab_cntrl(l)=0. 59 58 ENDDO 60 tab_cntrl(1) = FLOAT( iim)61 tab_cntrl(2) = FLOAT( jjm)62 tab_cntrl(3) = FLOAT( llm)59 tab_cntrl(1) = FLOAT(nbp_lon) 60 tab_cntrl(2) = FLOAT(nbp_lat-1) 61 tab_cntrl(3) = FLOAT(nbp_lev) 63 62 tab_cntrl(4) = FLOAT(idayref) 64 63 tab_cntrl(5) = rad … … 103 102 104 103 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 105 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)106 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)104 ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu) 105 ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv) 107 106 ierr = NF_DEF_DIM (nid, "VI Wavenumber",L_NSPECTV,idim_bandsVI) 108 107 … … 141 140 ierr = NF_ENDDEF(nid) 142 141 #ifdef NC_DOUBLE 143 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) 144 #else 145 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) 146 #endif 147 c 148 c -------------------------- 142 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180) 143 #else 144 ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180) 145 #endif 146 c 147 c -------------------------- 148 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 149 !add extra redundant point (180 degrees, since lon_reg starts at -180 150 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 151 149 152 ierr = NF_REDEF (nid) 150 153 #ifdef NC_DOUBLE … … 158 161 ierr = NF_ENDDEF(nid) 159 162 #ifdef NC_DOUBLE 160 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid, rlonv/pi*180)161 #else 162 ierr = NF_PUT_VAR_REAL (nid,nvarid, rlonv/pi*180)163 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180) 164 #else 165 ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180) 163 166 #endif 164 167 c … … 172 175 #ifdef NC_DOUBLE 173 176 ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_DOUBLE,1, 174 . 177 . idim_bandsVI,nvarid) 175 178 #else 176 179 ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_FLOAT,1, 177 . 180 . idim_bandsVI,nvarid) 178 181 #endif 179 182 ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 33, … … 197 200 #ifdef NC_DOUBLE 198 201 ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_DOUBLE,1, 199 . 202 . idim_bandsVI,nvarid) 200 203 #else 201 204 ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_FLOAT,1, 202 . 205 . idim_bandsVI,nvarid) 203 206 #endif 204 207 ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 24, … … 231 234 ierr = NF_ENDDEF(nid) 232 235 #ifdef NC_DOUBLE 233 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,a ire)234 #else 235 ierr = NF_PUT_VAR_REAL (nid,nvarid,a ire)236 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area) 237 #else 238 ierr = NF_PUT_VAR_REAL (nid,nvarid,area) 236 239 #endif 237 240 -
trunk/LMDZ.GENERIC/libf/phystd/iniwritesoil.F90
r1384 r1529 1 subroutine iniwritesoil(nid,ngrid )1 subroutine iniwritesoil(nid,ngrid,inertia,area) 2 2 3 3 ! initialization routine for 'writediagoil'. Here we create/define … … 5 5 ! (time-independent) parameters. 6 6 7 use comsoil_h, only: mlayer, inertiedat, nsoilmx 8 use comcstfi_mod, only: pi 7 use comsoil_h, only: mlayer, nsoilmx 8 USE comcstfi_mod, only: pi 9 USE regular_lonlat_mod, ONLY: lon_reg, lat_reg 10 use mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 9 11 10 12 implicit none 11 13 12 #include"dimensions.h" 13 #include"paramet.h" 14 #include"comgeom.h" 15 #include"netcdf.inc" 14 include"netcdf.inc" 16 15 17 16 ! Arguments: 18 17 integer,intent(in) :: ngrid 19 18 integer,intent(in) :: nid ! NetCDF output file ID 19 real,intent(in) :: inertia(nbp_lon+1,nbp_lat,nsoilmx) 20 real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2) 20 21 21 22 ! Local variables: … … 30 31 integer,dimension(3) :: dimids ! to store IDs of dimensions of a variable 31 32 character(len=60) :: text ! to store some text 32 real,dimension( iip1,jjp1,nsoilmx) :: data3 ! to store 3D data33 real,dimension(nbp_lon+1,nbp_lat,nsoilmx) :: data3 ! to store 3D data 33 34 integer :: i,j,l,ig0 35 real :: lon_reg_ext(nbp_lon+1) ! extended longitudes 34 36 35 37 ! 1. Define the dimensions … … 38 40 39 41 ! Define the dimensions 40 ierr=NF_DEF_DIM(nid,"longitude",iip1,idim_rlonv) 41 ! iip1 known from paramet.h 42 ierr=NF_DEF_DIM(nid,"longitude",nbp_lon+1,idim_rlonv) 42 43 if (ierr.ne.NF_NOERR) then 43 44 write(*,*)"iniwritesoil: Error, could not define longitude dimension" 44 45 endif 45 ierr=NF_DEF_DIM(nid,"latitude",jjp1,idim_rlatu) 46 ! jjp1 known from paramet.h 46 ierr=NF_DEF_DIM(nid,"latitude",nbp_lat,idim_rlatu) 47 47 if (ierr.ne.NF_NOERR) then 48 48 write(*,*)"iniwritesoil: Error, could not define latitude dimension" 49 49 endif 50 50 ierr=NF_DEF_DIM(nid,"depth",nsoilmx,idim_depth) 51 ! nsoilmx known from dimphys.h51 ! nsoilmx known from comsoil_h 52 52 if (ierr.ne.NF_NOERR) then 53 53 write(*,*)"iniwritesoil: Error, could not define depth dimension" … … 81 81 ierr=NF_PUT_ATT_TEXT(nid,varid,"units",len_trim(text),text) 82 82 83 lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon) 84 !add extra redundant point (180 degrees, since lon_reg starts at -180 85 lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1) 86 83 87 ! Write longitude to file 84 88 ierr=NF_ENDDEF(nid) ! switch out of NetCDF define mode 85 89 ! Write 86 90 #ifdef NC_DOUBLE 87 ierr=NF_PUT_VAR_DOUBLE(nid,varid, rlonv*(180./pi))88 #else 89 ierr=NF_PUT_VAR_REAL(nid,varid, rlonv*(180./pi))90 #endif 91 ! Note: rlonv is known from comgeom.h 91 ierr=NF_PUT_VAR_DOUBLE(nid,varid,lon_reg_ext*(180./pi)) 92 #else 93 ierr=NF_PUT_VAR_REAL(nid,varid,lon_reg_ext*(180./pi)) 94 #endif 95 ! Note: rlonv is known from comgeom.h and pi from comcstfi.h 92 96 if (ierr.ne.NF_NOERR) then 93 97 write(*,*)"iniwritesoil: Error, could not write longitude variable" … … 117 121 ! Write 118 122 #ifdef NC_DOUBLE 119 ierr=NF_PUT_VAR_DOUBLE(nid,varid,rlatu*(180./pi)) 120 #else 121 ierr=NF_PUT_VAR_REAL(nid,varid,rlatu*(180./pi)) 122 #endif 123 ! Note: rlatu is known from comgeom.h 123 ierr=NF_PUT_VAR_DOUBLE(nid,varid,lat_reg*(180./pi)) 124 #else 125 ierr=NF_PUT_VAR_REAL(nid,varid,lat_reg*(180./pi)) 126 #endif 124 127 if (ierr.ne.NF_NOERR) then 125 128 write(*,*)"iniwritesoil: Error, could not write longitude variable" … … 209 212 ! Write 210 213 #ifdef NC_DOUBLE 211 ierr=NF_PUT_VAR_DOUBLE(nid,varid,aire) 212 #else 213 ierr=NF_PUT_VAR_REAL(nid,varid,aire) 214 #endif 215 ! Note: aire is known from comgeom.h 214 ierr=NF_PUT_VAR_DOUBLE(nid,varid,area) 215 #else 216 ierr=NF_PUT_VAR_REAL(nid,varid,area) 217 #endif 216 218 if (ierr.ne.NF_NOERR) then 217 219 write(*,*)"iniwritesoil: Error, could not write area variable" … … 240 242 ierr=NF_PUT_ATT_TEXT(nid,varid,"units",len_trim(text),text) 241 243 242 ! Recast data along 'dynamics' grid243 ! Note: inertiedat is known from comsoil_h244 245 do l=1,nsoilmx246 ! handle the poles247 do i=1,iip1248 data3(i,1,l)=inertiedat(1,l)249 data3(i,jjp1,l)=inertiedat(ngrid,l)250 enddo251 ! rest of the grid252 do j=2,jjm253 ig0=1+(j-2)*iim254 do i=1,iim255 data3(i,j,l)=inertiedat(ig0+i,l)256 enddo257 data3(iip1,j,l)=data3(1,j,l) ! extra (modulo) longitude258 enddo259 enddo ! of do l=1,nsoilmx260 261 244 ! Write data2 to file 262 245 ierr=NF_ENDDEF(nid) ! switch out of NetCDF define mode 263 246 ! Write 264 247 #ifdef NC_DOUBLE 265 ierr=NF_PUT_VAR_DOUBLE(nid,varid, data3)266 #else 267 ierr=NF_PUT_VAR_REAL(nid,varid, data3)248 ierr=NF_PUT_VAR_DOUBLE(nid,varid,inertia) 249 #else 250 ierr=NF_PUT_VAR_REAL(nid,varid,inertia) 268 251 #endif 269 252 if (ierr.ne.NF_NOERR) then -
trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90
r1526 r1529 1 1 SUBROUTINE mass_redistribution(ngrid,nlayer,nq,ptimestep, & 2 2 rnat,pcapcal,pplay,pplev,pt,ptsrf,pq,pqs, & 3 3 pu,pv,pdt,pdtsrf,pdq,pdu,pdv,pdmassmr, & … … 224 224 ! Van Leer scheme: 225 225 w(1:nlayer+1)=-zmflux(1:nlayer+1)*ptimestep 226 call vl1d( zzt,2.,zzmass,w,ztm)227 call vl1d( zzu,2.,zzmass,w,zum)228 call vl1d( zzv,2.,zzmass,w,zvm)226 call vl1d(nlayer,zzt,2.,zzmass,w,ztm) 227 call vl1d(nlayer,zzu,2.,zzmass,w,zum) 228 call vl1d(nlayer,zzv,2.,zzmass,w,zvm) 229 229 do iq=1,nq 230 230 zq1(1:nlayer)=zzq(1:nlayer,iq) … … 232 232 ! print*,iq 233 233 ! print*,zq1 234 call vl1d( zq1,2.,zzmass,w,zqm1)234 call vl1d(nlayer,zq1,2.,zzmass,w,zqm1) 235 235 do l=2,nlayer 236 236 zzq(l,iq)=zq1(l) … … 281 281 END DO ! loop on ig 282 282 283 return 284 end 285 286 283 CONTAINS 287 284 288 285 ! ***************************************************************** 289 SUBROUTINE vl1d( q,pente_max,zzmass,w,qm)286 SUBROUTINE vl1d(llm,q,pente_max,zzmass,w,qm) 290 287 ! 291 288 ! … … 299 296 ! 300 297 ! -------------------------------------------------------------------- 298 301 299 IMPLICIT NONE 302 303 #include "dimensions.h"304 300 305 301 ! Arguments: 306 302 ! ---------- 303 integer,intent(in) :: llm 307 304 real zzmass(llm),pente_max 308 305 REAL q(llm),qm(llm+1) … … 406 403 ! end if 407 404 408 return 409 end 405 END SUBROUTINE vl1d 406 407 END SUBROUTINE mass_redistribution -
trunk/LMDZ.GENERIC/libf/phystd/mkstat.F90
r1397 r1529 10 10 ! Yann W. july 2003 11 11 12 use statto_mod, only: istime,count 12 13 use mod_phys_lmdz_para, only : is_master 13 use statto_mod, only: istime,count14 use mod_grid_phy_lmdz, only : nbp_lon, nbp_lat, nbp_lev 14 15 15 16 implicit none 16 17 17 #include "dimensions.h" 18 #include "netcdf.inc" 18 include "netcdf.inc" 19 19 20 integer,parameter :: iip1=iim+121 integer,parameter :: jjp1=jjm+122 20 integer :: ierr,nid,nbvar,i,ndims,lt,nvarid 23 21 integer, dimension(4) :: id,varid,start,size 24 22 integer, dimension(5) :: dimids 25 23 character (len=50) :: name,nameout,units,title 26 real, dimension( iip1,jjp1,llm) :: sum3d,square3d,mean3d,sd3d27 real, dimension( iip1,jjp1) :: sum2d,square2d,mean2d,sd2d24 real, dimension(nbp_lon+1,nbp_lat,nbp_lev) :: sum3d,square3d,mean3d,sd3d 25 real, dimension(nbp_lon+1,nbp_lat) :: sum2d,square2d,mean2d,sd2d 28 26 real, dimension(istime) :: time 29 real, dimension( jjp1) :: lat30 real, dimension( iip1) :: lon31 real, dimension( llm) :: alt27 real, dimension(nbp_lat) :: lat 28 real, dimension(nbp_lon+1) :: lon 29 real, dimension(nbp_lev) :: alt 32 30 logical :: lcopy=.true. 33 31 !integer :: latid,lonid,altid,timeid … … 35 33 !integer, dimension(4) :: dimout 36 34 35 ! Incrementation of count for the last step, which is not done in wstats 36 count(istime)=count(istime)+1 37 37 38 if (is_master) then 38 39 ! only the master needs do this 39 40 ! Incrementation of count for the last step, which is not done in wstats41 count(istime)=count(istime)+142 40 43 41 ierr = NF_OPEN("stats.nc",NF_WRITE,nid) … … 107 105 ! dimout(4)=timeid 108 106 109 size=(/ iip1,jjp1,llm,1/)107 size=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 110 108 do lt=1,istime 111 109 start=(/1,1,1,lt/) … … 137 135 ! dimout(3)=timeid 138 136 139 size=(/ iip1,jjp1,1,0/)137 size=(/nbp_lon+1,nbp_lat,1,0/) 140 138 do lt=1,istime 141 139 start=(/1,1,lt,0/) -
trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
r1525 r1529 26 26 use time_phylmdz_mod, only: ecritphy, iphysiq, nday 27 27 use phyredem, only: physdem0, physdem1 28 use slab_ice_h 28 use slab_ice_h, only: capcalocean, capcalseaice,capcalsno, & 29 noceanmx 29 30 use ocean_slab_mod, only :ocean_slab_init, ocean_slab_ice, & 31 ini_surf_heat_transp_mod, & 30 32 ocean_slab_get_vars,ocean_slab_final 31 33 use surf_heat_transp_mod,only :init_masquv … … 558 560 sea_ice, pctsrf_sic) 559 561 562 call ini_surf_heat_transp_mod() 563 560 564 knindex(:) = 0 561 565 -
trunk/LMDZ.GENERIC/libf/phystd/radcommon_h.F90
r1315 r1529 1 2 3 use radinc_h1 module radcommon_h 2 use radinc_h, only: L_NSPECTI, L_NSPECTV, L_NGAUSS, NTstar, NTstop, & 3 naerkind, nsizemax 4 4 implicit none 5 5 … … 121 121 REAL :: omegaREFir(naerkind,nsizemax) 122 122 123 REAL tstellar ! Stellar brightness temperature (SW)123 REAL,SAVE :: tstellar ! Stellar brightness temperature (SW) 124 124 125 real*8 planckir(L_NSPECTI,NTstop-NTstar+1)125 real*8,save :: planckir(L_NSPECTI,NTstop-NTstar+1) 126 126 127 real*8 PTOP, TAUREF(L_LEVELS+1) 127 real*8,save :: PTOP 128 real*8,save,allocatable :: TAUREF(:) 128 129 129 real*8, 130 real*8,parameter :: UBARI = 0.5D0 130 131 131 real*8 gweight(L_NGAUSS)132 real*8,save :: gweight(L_NGAUSS) 132 133 !$OMP THREADPRIVATE(QREFvis,QREFir,omegaREFvis,omegaREFir,& ! gweight read by master in sugas_corrk 133 134 !$OMP tstellar,planckir,PTOP,TAUREF) … … 144 145 real*8, parameter :: grav = 6.672E-11 145 146 146 real*8 Cmk 147 save Cmk 148 real*8 glat_ig 149 save glat_ig 147 real*8,save :: Cmk 148 real*8,save :: glat_ig 150 149 !$OMP THREADPRIVATE(Cmk,glat_ig) 151 150 152 151 ! extinction of incoming sunlight (Saturn's rings, eclipses, etc...) 153 REAL, DIMENSION(:), ALLOCATABLE :: eclipse152 REAL, DIMENSION(:), ALLOCATABLE ,SAVE :: eclipse 154 153 155 154 !Latitude-dependent gravity 156 REAL, DIMENSION(:), ALLOCATABLE :: glat155 REAL, DIMENSION(:), ALLOCATABLE , SAVE :: glat 157 156 !$OMP THREADPRIVATE(glat,eclipse) 158 157 159 end module radcommon_h 158 contains 159 160 subroutine ini_radcommon_h 161 use radinc_h, only: L_LEVELS 162 implicit none 163 164 allocate(TAUREF(L_LEVELS+1)) 165 166 end subroutine ini_radcommon_h 167 168 end module radcommon_h -
trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90
r1521 r1529 8 8 ! water cloud optical properties 9 9 10 use callkeys_mod, only: radfixed,Nmix_co2, 11 pres_bottom_tropo,pres_top_tropo,size_tropo,&12 10 use callkeys_mod, only: radfixed,Nmix_co2, & 11 pres_bottom_tropo,pres_top_tropo,size_tropo, & 12 pres_bottom_strato,size_strato 13 13 14 14 real, save :: rad_h2o … … 21 21 22 22 23 23 contains 24 24 25 25 … … 38 38 use ioipsl_getin_p_mod, only: getin_p 39 39 use radinc_h, only: naerkind 40 use aerosol_mod 41 ! USE tracer_h 42 Implicit none 43 44 ! include "dimensions.h" 45 ! include "dimphys.h" 40 use aerosol_mod, only: iaero_back2lay, iaero_co2, iaero_dust, & 41 iaero_h2o, iaero_h2so4 42 Implicit none 46 43 47 44 integer,intent(in) :: ngrid … … 81 78 nueffrad(1:ngrid,1:nlayer,iaer) = 0.1 82 79 endif 83 84 80 81 if(iaer.eq.iaero_back2lay)then ! Two-layer aerosols 85 82 reffrad(1:ngrid,1:nlayer,iaer) = 2.e-6 86 83 nueffrad(1:ngrid,1:nlayer,iaer) = 0.1 … … 101 98 if (radfixed) then 102 99 103 100 write(*,*)"radius of H2O water particles:" 104 101 rad_h2o=13. ! default value 105 102 call getin_p("rad_h2o",rad_h2o) 106 103 write(*,*)" rad_h2o = ",rad_h2o 107 104 108 105 write(*,*)"radius of H2O ice particles:" 109 106 rad_h2o_ice=35. ! default value 110 107 call getin_p("rad_h2o_ice",rad_h2o_ice) 111 108 write(*,*)" rad_h2o_ice = ",rad_h2o_ice 112 109 113 110 else 114 111 115 112 write(*,*)"Number mixing ratio of H2O water particles:" … … 122 119 call getin_p("Nmix_h2o_ice",Nmix_h2o_ice) 123 120 write(*,*)" Nmix_h2o_ice = ",Nmix_h2o_ice 124 121 endif 125 122 126 123 print*,'exit su_aer_radii' … … 173 170 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 174 171 zfice = MIN(MAX(zfice,0.0),1.0) 175 176 172 zrad_liq = CBRT( 3*pq(ig,l)/(4*Nmix_h2o*pi*rhowater) ) 173 zrad_ice = CBRT( 3*pq(ig,l)/(4*Nmix_h2o_ice*pi*rhowaterice) ) 177 174 nueffrad(ig,l) = coef_chaud * (1.-zfice) + coef_froid * zfice 178 175 zrad = zrad_liq * (1.-zfice) + zrad_ice * zfice 179 176 180 177 reffrad(ig,l) = min(max(zrad,1.e-6),1000.e-6) 181 178 enddo 182 179 enddo … … 213 210 214 211 if (radfixed) then 215 216 212 reffliq(1:ngrid,1:nlayer)= rad_h2o 213 reffice(1:ngrid,1:nlayer)= rad_h2o_ice 217 214 else 218 219 220 221 222 223 224 225 226 215 do k=1,nlayer 216 do i=1,ngrid 217 reffliq(i,k) = CBRT(3*pql(i,k)/(4*Nmix_h2o*pi*rhowater)) 218 reffliq(i,k) = min(max(reffliq(i,k),1.e-6),1000.e-6) 219 220 reffice(i,k) = CBRT(3*pql(i,k)/(4*Nmix_h2o_ice*pi*rhowaterice)) 221 reffice(i,k) = min(max(reffice(i,k),1.e-6),1000.e-6) 222 enddo 223 enddo 227 224 endif 228 225 -
trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90
r1520 r1529 1 1 module radinc_h 2 2 3 3 implicit none 4 4 5 #include "dimensions.h" 6 #include "bands.h" 7 #include "scatterers.h" 5 include "bands.h" 6 include "scatterers.h" 8 7 9 8 !====================================================================== … … 57 56 !---------------------------------------------------------------------- 58 57 59 integer, parameter :: L_NLAYRAD = llm 60 integer, parameter :: L_LEVELS = 2*(llm-1)+3 61 integer, parameter :: L_NLEVRAD = llm+1 58 integer,save :: L_NLAYRAD ! = nbp_lev ! set by ini_radinc_h 59 integer,save :: L_LEVELS ! = 2*(nbp_lev-1)+3 ! set by ini_radinc_h 60 integer,save :: L_NLEVRAD ! = nbp_lev+1 ! set by ini_radinc_h 61 !$OMP THREADPRIVATE(L_NLAYRAD,L_LEVELS,L_NLEVRAD) 62 62 63 63 ! These are set in sugas_corrk … … 96 96 !$OMP THREADPRIVATE(banddir) 97 97 98 end module radinc_h 98 contains 99 100 subroutine ini_radinc_h(nbp_lev) 101 ! Initialize module variables 102 implicit none 103 integer,intent(in) :: nbp_lev 104 105 L_NLAYRAD = nbp_lev 106 L_LEVELS = 2*(nbp_lev-1)+3 107 L_NLEVRAD = nbp_lev+1 108 109 end subroutine 110 111 end module radinc_h -
trunk/LMDZ.GENERIC/libf/phystd/soil.F
r1524 r1529 20 20 ! heat capacity are commons in comsoil.h 21 21 !----------------------------------------------------------------------- 22 23 ! include "dimensions.h"24 ! include "dimphys.h"25 26 22 27 23 c----------------------------------------------------------------------- -
trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90
r1470 r1529 2 2 3 3 ! inputs 4 use radinc_h, only: L_NSPECTI,L_NSPECTV,nsizemax, iim,jjm,naerkind4 use radinc_h, only: L_NSPECTI,L_NSPECTV,nsizemax,naerkind 5 5 use radcommon_h, only: blamv,blami,lamrefir,lamrefvis 6 6 use datafile_mod, only: datadir, aerdir -
trunk/LMDZ.GENERIC/libf/phystd/surf_heat_transp_mod.F90
r1397 r1529 4 4 MODULE surf_heat_transp_mod 5 5 6 6 IMPLICIT NONE 7 8 ! Variables copied over from dyn3d dynamics: 9 REAL,SAVE,ALLOCATABLE :: fext(:) 10 REAL,SAVE,ALLOCATABLE :: unsairez(:) 11 REAL,SAVE,ALLOCATABLE :: unsaire(:) 12 REAL,SAVE,ALLOCATABLE :: cu(:) 13 REAL,SAVE,ALLOCATABLE :: cv(:) 14 REAL,SAVE,ALLOCATABLE :: cuvsurcv(:) 15 REAL,SAVE,ALLOCATABLE :: cvusurcu(:) 16 REAL,SAVE,ALLOCATABLE :: aire(:) 17 REAL,SAVE :: apoln 18 REAL,SAVE :: apols 19 REAL,SAVE,ALLOCATABLE :: aireu(:) 20 REAL,SAVE,ALLOCATABLE :: airev(:) 21 22 LOGICAL,SAVE :: alpha_var 23 LOGICAL,SAVE :: slab_upstream 24 REAL,SAVE,ALLOCATABLE :: zmasqu(:) 25 REAL,SAVE,ALLOCATABLE :: zmasqv(:) 26 REAL,SAVE,ALLOCATABLE :: unsfv(:) 27 REAL,SAVE,ALLOCATABLE :: unsev(:) 28 REAL,SAVE,ALLOCATABLE :: unsfu(:) 29 REAL,SAVE,ALLOCATABLE :: unseu(:) 30 31 ! Routines usable only by routines within this module: 32 PRIVATE :: gr_fi_dyn, gr_dyn_fi 33 ! Routines from dyn3d, valid on global dynamics grid only: 34 PRIVATE :: grad,diverg,gr_u_scal,gr_v_scal 35 7 36 CONTAINS 8 9 SUBROUTINE divgrad_phy(ngrid,nlevs,temp,delta) 10 11 USE comhdiff_mod, ONLY: zmasqu,zmasqv 12 37 38 SUBROUTINE ini_surf_heat_transp(ip1jm,ip1jmp1,unsairez_,fext_,unsaire_,& 39 cu_,cuvsurcv_,cv_,cvusurcu_, & 40 aire_,apoln_,apols_, & 41 aireu_,airev_) 42 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat 43 IMPLICIT NONE 44 ! Transfer some variables from dyn3d dynamics 45 INTEGER,INTENT(IN) :: ip1jm 46 INTEGER,INTENT(IN) :: ip1jmp1 47 REAL,INTENT(IN) :: unsairez_(ip1jm) 48 REAL,INTENT(IN) :: fext_(ip1jm) 49 REAL,INTENT(IN) :: unsaire_(ip1jmp1) 50 REAL,INTENT(IN) :: cu_(ip1jmp1) 51 REAL,INTENT(IN) :: cuvsurcv_(ip1jm) 52 REAL,INTENT(IN) :: cv_(ip1jm) 53 REAL,INTENT(IN) :: cvusurcu_(ip1jmp1) 54 REAL,INTENT(IN) :: aire_(ip1jmp1) 55 REAL,INTENT(IN) :: apoln_ 56 REAL,INTENT(IN) :: apols_ 57 REAL,INTENT(IN) :: aireu_(ip1jmp1) 58 REAL,INTENT(IN) :: airev_(ip1jm) 59 60 ! Sanity check 61 if ((ip1jm.ne.((nbp_lon+1)*(nbp_lat-1))).or. & 62 (ip1jmp1.ne.((nbp_lon+1)*nbp_lat))) then 63 write(*,*) "ini_surf_heat_transp Error: wrong array sizes" 64 stop 65 endif 66 67 allocate(unsairez(ip1jm)) 68 unsairez(:)=unsairez_(:) 69 allocate(fext(ip1jm)) 70 fext(:)=fext_(:) 71 allocate(unsaire(ip1jmp1)) 72 unsaire(:)=unsaire_(:) 73 allocate(cu(ip1jmp1)) 74 cu(:)=cu_(:) 75 allocate(cuvsurcv(ip1jm)) 76 cuvsurcv(:)=cuvsurcv_(:) 77 allocate(cv(ip1jm)) 78 cv(:)=cv_(:) 79 allocate(cvusurcu(ip1jmp1)) 80 cvusurcu(:)=cvusurcu_(:) 81 allocate(aire(ip1jmp1)) 82 aire(:)=aire_(:) 83 apoln=apoln_ 84 apols=apols_ 85 allocate(aireu(ip1jmp1)) 86 aireu(:)=aireu_(:) 87 allocate(airev(ip1jm)) 88 airev(:)=airev_(:) 89 90 END SUBROUTINE ini_surf_heat_transp 91 92 SUBROUTINE ini_surf_heat_transp_mod 93 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat 94 IMPLICIT NONE 95 INTEGER :: ip1jm, ip1jmp1 96 97 ip1jm=(nbp_lon+1)*(nbp_lat-1) 98 ip1jmp1=(nbp_lon+1)*nbp_lat 99 100 allocate(zmasqu(ip1jmp1)) 101 allocate(zmasqv(ip1jm)) 102 allocate(unsfv(ip1jm)) 103 allocate(unsev(ip1jm)) 104 allocate(unsfu(ip1jmp1)) 105 allocate(unseu(ip1jmp1)) 106 107 END SUBROUTINE ini_surf_heat_transp_mod 108 109 SUBROUTINE divgrad_phy(ngrid,nlevs,temp,delta) 110 111 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 13 112 IMPLICIT NONE 14 113 15 #include "dimensions.h"16 !#include "dimphys.h"17 #include "paramet.h"18 #include "comgeom.h"19 20 114 INTEGER,INTENT(IN) :: ngrid, nlevs 21 115 REAL,INTENT(IN) :: temp(ngrid,nlevs) 22 116 REAL,INTENT(OUT) :: delta(ngrid,nlevs) 23 REAL delta_2d( ip1jmp1,nlevs)117 REAL delta_2d((nbp_lon+1)*nbp_lat,nlevs) 24 118 INTEGER :: ll 25 REAL ghx(ip1jmp1,nlevs), ghy(ip1jm,nlevs) 26 119 REAL ghx((nbp_lon+1)*nbp_lat,nlevs) 120 REAL ghy((nbp_lon+1)*(nbp_lat-1),nlevs) 121 INTEGER :: iip1,jjp1 122 123 iip1=nbp_lon+1 124 jjp1=nbp_lat 27 125 28 126 CALL gr_fi_dyn(nlevs,ngrid,iip1,jjp1,temp,delta_2d) … … 42 140 43 141 44 SUBROUTINE init_masquv(ngrid,zmasq) 45 46 USE comhdiff_mod, ONLY: zmasqu,zmasqv,unsfu,unsfv,unseu,unsev 47 142 SUBROUTINE init_masquv(ngrid,zmasq) 143 144 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat 48 145 IMPLICIT NONE 49 50 #include "dimensions.h"51 !#include "dimphys.h"52 #include "paramet.h"53 #include "comgeom.h"54 146 55 147 56 148 INTEGER,INTENT(IN) :: ngrid 57 149 REAL zmasq(ngrid) 58 REAL zmasq_2d( ip1jmp1)59 REAL ff( ip1jm)150 REAL zmasq_2d((nbp_lon+1)*nbp_lat) 151 REAL ff((nbp_lon+1)*(nbp_lat-1)) 60 152 REAL eps 61 153 INTEGER i 62 154 INTEGER :: iim,iip1,jjp1,ip1jm,ip1jmp1 155 156 iim=nbp_lon 157 iip1=nbp_lon+1 158 jjp1=nbp_lat 159 ip1jm=(nbp_lon+1)*(nbp_lat-1) 160 ip1jmp1=(nbp_lon+1)*nbp_lat 63 161 64 162 ! Masques u,v … … 104 202 105 203 106 107 108 use slab_ice_h109 USE comhdiff_mod, ONLY: zmasqu,zmasqv,unsfu,unsfv,unseu,unsev204 SUBROUTINE slab_ekman2(ngrid,tx_phy,ty_phy,ts_phy,dt_phy) 205 206 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 207 USE slab_ice_h, ONLY: noceanmx 110 208 111 209 IMPLICIT NONE 112 210 113 #include "dimensions.h"114 !#include "dimphys.h"115 #include "paramet.h"116 #include "comgeom.h"117 118 211 INTEGER,INTENT(IN) :: ngrid 119 212 INTEGER ij 120 REAL txv(ip1jm),fluxm(ip1jm),tyv(ip1jm) 121 REAL fluxtm(ip1jm,noceanmx),fluxtz(ip1jmp1,noceanmx) 122 REAL tyu(ip1jmp1),txu(ip1jmp1),fluxz(ip1jmp1),fluxv(ip1jmp1) 123 REAL dt(ip1jmp1,noceanmx),ts(ip1jmp1,noceanmx) 213 REAL txv((nbp_lon+1)*(nbp_lat-1)),fluxm((nbp_lon+1)*(nbp_lat-1)) 214 REAL tyv((nbp_lon+1)*(nbp_lat-1)) 215 REAL fluxtm((nbp_lon+1)*(nbp_lat-1),noceanmx) 216 REAL fluxtz((nbp_lon+1)*nbp_lat,noceanmx) 217 REAL tyu((nbp_lon+1)*nbp_lat),txu((nbp_lon+1)*nbp_lat) 218 REAL fluxz((nbp_lon+1)*nbp_lat),fluxv((nbp_lon+1)*nbp_lat) 219 REAL dt((nbp_lon+1)*nbp_lat,noceanmx),ts((nbp_lon+1)*nbp_lat,noceanmx) 124 220 REAL tx_phy(ngrid),ty_phy(ngrid) 125 221 REAL dt_phy(ngrid,noceanmx),ts_phy(ngrid,noceanmx) 126 222 127 128 223 INTEGER iim,iip1,iip2,jjp1,ip1jm,ip1jmi1,ip1jmp1 224 225 iim=nbp_lon 226 iip1=nbp_lon+1 227 iip2=nbp_lon+2 228 jjp1=nbp_lon 229 ip1jm=(nbp_lon+1)*(nbp_lat-1) ! = iip1*jjm 230 ip1jmi1=(nbp_lon+1)*(nbp_lat-1)-(nbp_lon+1) ! = ip1jm - iip1 231 ip1jmp1=(nbp_lon+1)*nbp_lat ! = iip1*jjp1 129 232 130 233 ! Passage taux,y sur grilles 2d … … 226 329 END SUBROUTINE slab_ekman2 227 330 228 331 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 332 333 SUBROUTINE gr_fi_dyn(nfield,ngrid,im,jm,pfi,pdyn) 334 ! Transfer a variable on global "physics" grid to global "dynamics" grid 335 IMPLICIT NONE 336 337 INTEGER,INTENT(IN) :: im,jm,ngrid,nfield 338 REAL,INTENT(IN) :: pfi(ngrid,nfield) 339 REAL,INTENT(OUT) :: pdyn(im,jm,nfield) 340 341 INTEGER :: i,j,ifield,ig 342 343 DO ifield=1,nfield 344 ! Handle poles 345 DO i=1,im 346 pdyn(i,1,ifield)=pfi(1,ifield) 347 pdyn(i,jm,ifield)=pfi(ngrid,ifield) 348 ENDDO 349 ! Other points 350 DO j=2,jm-1 351 ig=2+(j-2)*(im-1) 352 CALL SCOPY(im-1,pfi(ig,ifield),1,pdyn(1,j,ifield),1) 353 pdyn(im,j,ifield)=pdyn(1,j,ifield) 354 ENDDO 355 ENDDO ! of DO ifield=1,nfield 356 357 END SUBROUTINE gr_fi_dyn 358 359 360 361 SUBROUTINE gr_dyn_fi(nfield,im,jm,ngrid,pdyn,pfi) 362 ! Transfer a variable on global "dynamics" grid to global "physics" grid 363 IMPLICIT NONE 364 365 INTEGER,INTENT(IN) :: im,jm,ngrid,nfield 366 REAL,INTENT(IN) :: pdyn(im,jm,nfield) 367 REAL,INTENT(OUT) :: pfi(ngrid,nfield) 368 369 INTEGER j,ifield,ig 370 371 ! Sanity check: 372 IF(ngrid.NE.2+(jm-2)*(im-1)) THEN 373 WRITE(*,*) "gr_dyn_fi error, wrong sizes" 374 STOP 375 ENDIF 376 377 ! Handle poles 378 CALL SCOPY(nfield,pdyn,im*jm,pfi,ngrid) 379 CALL SCOPY(nfield,pdyn(1,jm,1),im*jm,pfi(ngrid,1),ngrid) 380 ! Other points 381 DO ifield=1,nfield 382 DO j=2,jm-1 383 ig=2+(j-2)*(im-1) 384 CALL SCOPY(im-1,pdyn(1,j,ifield),1,pfi(ig,ifield),1) 385 ENDDO 386 ENDDO 387 388 END SUBROUTINE gr_dyn_fi 389 390 391 392 SUBROUTINE grad(klevel,pg,pgx,pgy) 393 ! compute the covariant components x,y of the gradient of pg 394 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 395 IMPLICIT NONE 396 397 INTEGER,INTENT(IN) :: klevel 398 REAL,INTENT(IN) :: pg((nbp_lon+1)*nbp_lat,klevel) 399 REAL,INTENT(OUT) :: pgx((nbp_lon+1)*nbp_lat,klevel) 400 REAL,INTENT(OUT) :: pgy((nbp_lon+1)*(nbp_lat-1),klevel) 401 402 INTEGER :: l,ij 403 INTEGER :: iim,iip1,ip1jm,ip1jmp1 404 405 iim=nbp_lon 406 iip1=nbp_lon+1 407 ip1jm=(nbp_lon+1)*(nbp_lat-1) ! = iip1*jjm 408 ip1jmp1=(nbp_lon+1)*nbp_lat ! = iip1*jjp1 409 410 DO l=1,klevel 411 DO ij=1,ip1jmp1-1 412 pgx(ij,l)=pg(ij+1,l)-pg(ij,l) 413 ENDDO 414 ! correction for pgx(ip1,j,l) ... 415 ! ... pgx(iip1,j,l)=pgx(1,j,l) ... 416 DO ij=iip1,ip1jmp1,iip1 417 pgx(ij,l)=pgx(ij-iim,l) 418 ENDDO 419 DO ij=1,ip1jm 420 pgy(ij,l)=pg(ij,l)-pg(ij+iip1,l) 421 ENDDO 422 ENDDO 423 424 END SUBROUTINE grad 425 426 427 428 SUBROUTINE diverg(klevel,x,y,div) 429 ! compute the divergence of a vector field of components 430 ! x,y. y and y being covriant components 431 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 432 IMPLICIT NONE 433 434 INTEGER,INTENT(IN) :: klevel 435 REAL,INTENT(IN) :: x((nbp_lon+1)*nbp_lat,klevel) 436 REAL,INTENT(IN) :: y((nbp_lon+1)*(nbp_lat-1),klevel) 437 REAL,INTENT(OUT) :: div((nbp_lon+1)*nbp_lat,klevel) 438 439 INTEGER :: l,ij 440 INTEGER :: iim,iip1,iip2,ip1jm,ip1jmp1,ip1jmi1 441 442 REAL :: aiy1(nbp_lon+1),aiy2(nbp_lon+1) 443 REAL :: sumypn,sumyps 444 REAL,EXTERNAL :: SSUM 445 446 iim=nbp_lon 447 iip1=nbp_lon+1 448 iip2=nbp_lon+2 449 ip1jm=(nbp_lon+1)*(nbp_lat-1) ! = iip1*jjm 450 ip1jmp1=(nbp_lon+1)*nbp_lat ! = iip1*jjp1 451 ip1jmi1=(nbp_lon+1)*(nbp_lat-1)-(nbp_lon+1) ! = ip1jm - iip1 452 453 DO l=1,klevel 454 DO ij=iip2,ip1jm-1 455 div(ij+1,l)= & 456 cvusurcu(ij+1)*x(ij+1,l)-cvusurcu(ij)*x(ij,l)+ & 457 cuvsurcv(ij-iim)*y(ij-iim,l)-cuvsurcv(ij+1)*y(ij+1,l) 458 ENDDO 459 ! correction for div(1,j,l) ... 460 ! ... div(1,j,l)= div(iip1,j,l) ... 461 DO ij=iip2,ip1jm,iip1 462 div(ij,l)=div(ij+iim,l) 463 ENDDO 464 ! at the poles 465 DO ij=1,iim 466 aiy1(ij)=cuvsurcv(ij)*y(ij,l) 467 aiy2(ij)=cuvsurcv(ij+ip1jmi1)*y(ij+ip1jmi1,l) 468 ENDDO 469 sumypn=SSUM(iim,aiy1,1)/apoln 470 sumyps=SSUM(iim,aiy2,1)/apols 471 DO ij=1,iip1 472 div(ij,l)=-sumypn 473 div(ij+ip1jm,l)=sumyps 474 ENDDO 475 ENDDO ! of DO l=1,klevel 476 477 !!! CALL filtreg( div, jjp1, klevel, 2, 2, .TRUE., 1 ) 478 479 DO l=1,klevel 480 DO ij=iip2,ip1jm 481 div(ij,l)=div(ij,l)*unsaire(ij) 482 ENDDO 483 ENDDO 484 485 END SUBROUTINE diverg 486 487 488 489 SUBROUTINE gr_u_scal(nx,x_u,x_scal) 490 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 491 IMPLICIT NONE 492 493 INTEGER,INTENT(IN) :: nx 494 REAL,INTENT(IN) :: x_u((nbp_lon+1)*nbp_lat,nx) 495 REAL,INTENT(OUT) :: x_scal((nbp_lon+1)*nbp_lat,nx) 496 497 INTEGER :: l,ij 498 INTEGER :: iip1,jjp1,ip1jmp1 499 500 iip1=nbp_lon+1 501 jjp1=nbp_lat 502 ip1jmp1=(nbp_lon+1)*nbp_lat ! = iip1*jjp1 503 504 DO l=1,nx 505 DO ij=ip1jmp1,2,-1 506 x_scal(ij,l)= & 507 (aireu(ij)*x_u(ij,l)+aireu(ij-1)*x_u(ij-1,l)) & 508 /(aireu(ij)+aireu(ij-1)) 509 ENDDO 510 ENDDO 511 512 CALL SCOPY(nx*jjp1,x_scal(iip1,1),iip1,x_scal(1,1),iip1) 513 514 END SUBROUTINE gr_u_scal 515 516 517 518 SUBROUTINE gr_v_scal(nx,x_v,x_scal) 519 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat 520 IMPLICIT NONE 521 522 INTEGER,INTENT(IN) :: nx 523 REAL,INTENT(IN) :: x_v((nbp_lon+1)*(nbp_lat-1),nx) 524 REAL,INTENT(OUT) :: x_scal((nbp_lon+1)*nbp_lat,nx) 525 526 INTEGER :: l,ij 527 INTEGER :: iip1,iip2,ip1jm,ip1jmp1 528 529 iip1=nbp_lon+1 530 iip2=nbp_lon+2 531 ip1jm=(nbp_lon+1)*(nbp_lat-1) ! = iip1*jjm 532 ip1jmp1=(nbp_lon+1)*nbp_lat ! = iip1*jjp1 533 534 DO l=1,nx 535 DO ij=iip2,ip1jm 536 x_scal(ij,l)= & 537 (airev(ij-iip1)*x_v(ij-iip1,l)+airev(ij)*x_v(ij,l)) & 538 /(airev(ij-iip1)+airev(ij)) 539 ENDDO 540 DO ij=1,iip1 541 x_scal(ij,l)=0. 542 ENDDO 543 DO ij=ip1jm+1,ip1jmp1 544 x_scal(ij,l)=0. 545 ENDDO 546 ENDDO 547 548 END SUBROUTINE gr_v_scal 549 229 550 END MODULE surf_heat_transp_mod 230 551 -
trunk/LMDZ.GENERIC/libf/phystd/vdif_kc.F
r1308 r1529 1 1 SUBROUTINE vdif_kc(ngrid,nlay,dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn) 2 2 IMPLICIT NONE 3 c.......................................................................4 !#include "dimensions.h"5 !#include "dimphys.h"6 3 c....................................................................... 7 4 c -
trunk/LMDZ.GENERIC/libf/phystd/vlz_fi.F
r1308 r1529 15 15 c -------------------------------------------------------------------- 16 16 IMPLICIT NONE 17 c18 !#include "dimensions.h"19 !#include "dimphys.h"20 21 17 c 22 18 c -
trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
r1525 r1529 40 40 !================================================================= 41 41 use surfdat_h, only: phisfi 42 use comgeomphy, only: airephy 42 43 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini 43 44 USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root, 44 45 & is_master, gather 45 USE mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 46 USE mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, 47 & nbp_lon, nbp_lat, nbp_lev 46 48 implicit none 47 49 48 50 ! Commons 49 include "dimensions.h"50 include "paramet.h"51 include "comgeom.h"52 51 include "netcdf.inc" 53 52 … … 56 55 character (len=*),intent(in) :: nom,titre,unite 57 56 integer,intent(in) :: dim 58 real,intent(in) :: px(ngrid, llm)57 real,intent(in) :: px(ngrid,nbp_lev) 59 58 60 59 ! Local variables: 61 60 62 real*4 dx3( iip1,jjp1,llm) ! to store a 3D data set63 real*4 dx2( iip1,jjp1) ! to store a 2D (surface) data set64 real*4 dx1( llm) ! to store a 1D (column) data set61 real*4 dx3(nbp_lon+1,nbp_lat,nbp_lev) ! to store a 3D data set 62 real*4 dx2(nbp_lon+1,nbp_lat) ! to store a 2D (surface) data set 63 real*4 dx1(nbp_lev) ! to store a 1D (column) data set 65 64 real*4 dx0 66 65 … … 68 67 !$OMP THREADPRIVATE(date) 69 68 70 REAL phis(ip1jmp1) 69 REAL phis((nbp_lon+1),nbp_lat) 70 REAL area((nbp_lon+1),nbp_lat) 71 71 72 72 integer irythme 73 73 integer ierr,ierr2 74 integer iq 75 integer i,j,l,zmax , ig0 74 integer i,j,l, ig0 76 75 77 76 integer,save :: zitau=0 … … 102 101 #ifdef CPP_PARA 103 102 ! Added to work in parallel mode 104 real dx3_glop(klon_glo, llm)105 real dx3_glo( iim,jjp1,llm) ! to store a global 3D data set103 real dx3_glop(klon_glo,nbp_lev) 104 real dx3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set 106 105 real dx2_glop(klon_glo) 107 real dx2_glo( iim,jjp1) ! to store a global 2D (surface) data set106 real dx2_glo(nbp_lon,nbp_lat) ! to store a global 2D (surface) data set 108 107 real px2(ngrid) 109 ! real dx1_glo( llm) ! to store a 1D (column) data set108 ! real dx1_glo(nbp_lev) ! to store a 1D (column) data set 110 109 ! real dx0_glo 111 110 real phisfi_glo(klon_glo) ! surface geopotential on global physics grid 111 real areafi_glo(klon_glo) ! mesh area on global physics grid 112 112 #else 113 113 real phisfi_glo(ngrid) ! surface geopotential on global physics grid 114 real areafi_glo(ngrid) ! mesh area on global physics grid 114 115 #endif 115 116 … … 117 118 !Sortie des variables au rythme voulu 118 119 119 irythme = ecritphy! sortie au rythme de ecritphy120 irythme = int(ecritphy) ! sortie au rythme de ecritphy 120 121 ! irythme = iconser ! sortie au rythme des variables de controle 121 122 ! irythme = iphysiq ! sortie a tous les pas physique … … 188 189 ! Gather phisfi() geopotential on physics grid 189 190 call Gather(phisfi,phisfi_glo) 191 ! Gather airephy() mesh area on physics grid 192 call Gather(airephy,areafi_glo) 190 193 #else 191 194 phisfi_glo(:)=phisfi(:) 195 areafi_glo(:)=airephy(:) 192 196 #endif 193 197 … … 216 220 ierr = NF_ENDDEF(nid) 217 221 222 ! Build phis() and area() 223 do i=1,nbp_lon+1 ! poles 224 phis(i,1)=phisfi_glo(1) 225 phis(i,nbp_lat)=phisfi_glo(klon_glo) 226 ! for area, divide at the poles by nbp_lon 227 area(i,1)=areafi_glo(1)/nbp_lon 228 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 229 enddo 230 do j=2,nbp_lat-1 231 ig0= 1+(j-2)*nbp_lon 232 do i=1,nbp_lon 233 phis(i,j)=phisfi_glo(ig0+i) 234 area(i,j)=areafi_glo(ig0+i) 235 enddo 236 ! handle redundant point in longitude 237 phis(nbp_lon+1,j)=phis(1,j) 238 area(nbp_lon+1,j)=area(1,j) 239 enddo 240 218 241 ! write "header" of file (longitudes, latitudes, geopotential, ...) 219 call gr_fi_dyn(1,size(phisfi_glo),iip1,jjp1,phisfi_glo,phis) 220 call iniwrite(nid,day_ini,phis) 242 call iniwrite(nid,day_ini,phis,area) 221 243 222 244 endif ! of if (is_master) … … 234 256 235 257 if (ngrid.eq.1) then 236 ! in testphys1d, for the 1d version of the GCM, iphysiq 237 ! should be most likely 1 (because no dyn!)258 ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme 259 ! are undefined; so set them to 1 238 260 iphysiq=1 261 irythme=1 239 262 ! NB: 240 263 endif … … 296 319 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 297 320 ! copy dx3_glo() to dx3(:) and add redundant longitude 298 dx3(1: iim,:,:)=dx3_glo(1:iim,:,:)299 dx3( iip1,:,:)=dx3(1,:,:)321 dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 322 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 300 323 endif 301 324 !$OMP END MASTER … … 304 327 ! Passage variable physique --> variable dynamique 305 328 ! recast (copy) variable from physics grid to dynamics grid 306 DO l=1, llm307 DO i=1, iip1329 DO l=1,nbp_lev 330 DO i=1,nbp_lon+1 308 331 dx3(i,1,l)=px(1,l) 309 dx3(i, jjp1,l)=px(ngrid,l)332 dx3(i,nbp_lat,l)=px(ngrid,l) 310 333 ENDDO 311 DO j=2, jjm312 ig0= 1+(j-2)* iim313 DO i=1, iim334 DO j=2,nbp_lat-1 335 ig0= 1+(j-2)*nbp_lon 336 DO i=1,nbp_lon 314 337 dx3(i,j,l)=px(ig0+i,l) 315 338 ENDDO 316 dx3( iip1,j,l)=dx3(1,j,l)339 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 317 340 ENDDO 318 341 ENDDO … … 344 367 corner(4)=ntime 345 368 346 edges(1)= iip1347 edges(2)= jjp1348 edges(3)= llm369 edges(1)=nbp_lon+1 370 edges(2)=nbp_lat 371 edges(3)=nbp_lev 349 372 edges(4)=1 350 373 !#ifdef NC_DOUBLE … … 380 403 call Grid1Dto2D_glo(dx2_glop,dx2_glo) 381 404 ! copy dx2_glo() to dx2(:) and add redundant longitude 382 dx2(1: iim,:)=dx2_glo(1:iim,:)383 dx2( iip1,:)=dx2(1,:)405 dx2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:) 406 dx2(nbp_lon+1,:)=dx2(1,:) 384 407 endif 385 408 !$OMP END MASTER … … 390 413 ! recast (copy) variable from physics grid to dynamics grid 391 414 392 DO i=1, iip1415 DO i=1,nbp_lon+1 393 416 dx2(i,1)=px(1,1) 394 dx2(i, jjp1)=px(ngrid,1)417 dx2(i,nbp_lat)=px(ngrid,1) 395 418 ENDDO 396 DO j=2, jjm397 ig0= 1+(j-2)* iim398 DO i=1, iim419 DO j=2,nbp_lat-1 420 ig0= 1+(j-2)*nbp_lon 421 DO i=1,nbp_lon 399 422 dx2(i,j)=px(ig0+i,1) 400 423 ENDDO 401 dx2( iip1,j)=dx2(1,j)424 dx2(nbp_lon+1,j)=dx2(1,j) 402 425 ENDDO 403 426 #endif … … 426 449 corner(2)=1 427 450 corner(3)=ntime 428 edges(1)= iip1429 edges(2)= jjp1451 edges(1)=nbp_lon+1 452 edges(2)=nbp_lat 430 453 edges(3)=1 431 454 … … 457 480 ! Passage variable physique --> physique dynamique 458 481 ! recast (copy) variable from physics grid to dynamics grid 459 do l=1, llm482 do l=1,nbp_lev 460 483 dx1(l)=px(1,l) 461 484 enddo … … 479 502 corner(2)=ntime 480 503 481 edges(1)= llm504 edges(1)=nbp_lev 482 505 edges(2)=1 483 506 !#ifdef NC_DOUBLE … … 543 566 544 567 #endif 568 ! of #ifndef MESOSCALE 545 569 end -
trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
r1525 r1529 12 12 ! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4 13 13 14 use comsoil_h, only: nsoilmx 14 use comsoil_h, only: nsoilmx, inertiedat 15 use comgeomphy, only: airephy 15 16 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq 16 17 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather 17 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 18 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, & 19 nbp_lon, nbp_lat 18 20 19 21 implicit none 20 22 21 #include"dimensions.h" 22 #include"paramet.h" 23 #include"netcdf.inc" 23 include"netcdf.inc" 24 24 25 25 ! Arguments: … … 31 31 integer,intent(in) :: dimpx ! dimension of the variable (3,2 or 0) 32 32 real,dimension(ngrid,nsoilmx),intent(in) :: px ! variable 33 ! Note: nsoilmx is a parameter set in 'comsoil_h'34 33 35 34 ! Local variables: 36 real*4,dimension(iip1,jjp1,nsoilmx) :: data3 ! to store 3D data 37 ! Note iip1,jjp1 known from paramet.h; nsoilmx known from comsoil_h 38 real*4,dimension(iip1,jjp1) :: data2 ! to store 2D data 35 real*4,dimension(nbp_lon+1,nbp_lat,nsoilmx) :: data3 ! to store 3D data 36 real*4,dimension(nbp_lon+1,nbp_lat) :: data2 ! to store 2D data 39 37 real*4 :: data0 ! to store 0D data 40 38 integer :: i,j,l ! for loops … … 42 40 43 41 real*4,save :: date ! time counter (in elapsed days) 42 43 real :: inertia((nbp_lon+1),nbp_lat,nsoilmx) 44 real :: area((nbp_lon+1),nbp_lat) 45 46 real :: inertiafi_glo(klon_glo,nsoilmx) 47 real :: areafi_glo(klon_glo) 48 44 49 integer,save :: isample ! sample rate at which data is to be written to output 45 50 integer,save :: ntime=0 ! counter to internally store time steps … … 60 65 ! Added to work in parallel mode 61 66 real dx3_glop(klon_glo,nsoilmx) 62 real dx3_glo( iim,jjp1,nsoilmx) ! to store a global 3D data set67 real dx3_glo(nbp_lon,nbp_lat,nsoilmx) ! to store a global 3D data set 63 68 real dx2_glop(klon_glo) 64 real dx2_glo( iim,jjp1) ! to store a global 2D (surface) data set69 real dx2_glo(nbp_lon,nbp_lat) ! to store a global 2D (surface) data set 65 70 real px2(ngrid) 66 71 #endif … … 81 86 82 87 ! Set output sample rate 83 isample= ecritphy! same as for diagfi outputs88 isample=int(ecritphy) ! same as for diagfi outputs 84 89 ! Note ecritphy is known from control.h 85 90 … … 91 96 stop 92 97 endif 98 99 #ifdef CPP_PARA 100 ! Gather inertiedat() soil thermal inertia on physics grid 101 call Gather(inertiedat,inertiafi_glo) 102 ! Gather airephy() mesh area on physics grid 103 call Gather(airephy,areafi_glo) 104 #else 105 inertiafi_glo(:,:)=inertiedat(:,:) 106 areafi_glo(:)=airephy(:) 107 #endif 108 109 ! build inertia() and area() 110 do i=1,nbp_lon+1 ! poles 111 inertia(i,1,1:nsoilmx)=inertiafi_glo(1,1:nsoilmx) 112 inertia(i,nbp_lat,1:nsoilmx)=inertiafi_glo(klon_glo,1:nsoilmx) 113 ! for area, divide at the poles by nbp_lon 114 area(i,1)=areafi_glo(1)/nbp_lon 115 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 116 enddo 117 do j=2,nbp_lat-1 118 ig0= 1+(j-2)*nbp_lon 119 do i=1,nbp_lon 120 inertia(i,j,1:nsoilmx)=inertiafi_glo(ig0+i,1:nsoilmx) 121 area(i,j)=areafi_glo(ig0+i) 122 enddo 123 ! handle redundant point in longitude 124 inertia(nbp_lon+1,j,1:nsoilmx)=inertia(1,j,1:nsoilmx) 125 area(nbp_lon+1,j)=area(1,j) 126 enddo 127 128 ! write "header" of file (longitudes, latitudes, geopotential, ...) 129 call iniwritesoil(nid,ngrid,inertia,area) 130 93 131 endif ! of if (is_master) 94 95 ! Define dimensions and axis attributes96 call iniwritesoil(nid,ngrid)97 132 98 133 ! set zitau to -1 to be compatible with zitau incrementation step below … … 148 183 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 149 184 ! copy dx3_glo() to dx3(:) and add redundant longitude 150 data3(1: iim,:,:)=dx3_glo(1:iim,:,:)151 data3( iip1,:,:)=data3(1,:,:)185 data3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 186 data3(nbp_lon+1,:,:)=data3(1,:,:) 152 187 endif 153 188 !$OMP END MASTER … … 156 191 do l=1,nsoilmx 157 192 ! handle the poles 158 do i=1, iip1193 do i=1,nbp_lon+1 159 194 data3(i,1,l)=px(1,l) 160 data3(i, jjp1,l)=px(ngrid,l)195 data3(i,nbp_lat,l)=px(ngrid,l) 161 196 enddo 162 197 ! rest of the grid 163 do j=2, jjm164 ig0=1+(j-2)* iim165 do i=1, iim198 do j=2,nbp_lat-1 199 ig0=1+(j-2)*nbp_lon 200 do i=1,nbp_lon 166 201 data3(i,j,l)=px(ig0+i,l) 167 202 enddo 168 data3( iip1,j,l)=data3(1,j,l) ! extra (modulo) longitude203 data3(nbp_lon+1,j,l)=data3(1,j,l) ! extra (modulo) longitude 169 204 enddo 170 205 enddo … … 195 230 corners(4)=ntime 196 231 197 edges(1)= iip1198 edges(2)= jjp1232 edges(1)=nbp_lon+1 233 edges(2)=nbp_lat 199 234 edges(3)=nsoilmx 200 235 edges(4)=1 … … 223 258 call Grid1Dto2D_glo(dx2_glop,dx2_glo) 224 259 ! copy dx3_glo() to dx3(:) and add redundant longitude 225 data2(1: iim,:)=dx2_glo(1:iim,:)226 data2( iip1,:)=data2(1,:)260 data2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:) 261 data2(nbp_lon+1,:)=data2(1,:) 227 262 endif 228 263 !$OMP END MASTER … … 230 265 #else 231 266 ! handle the poles 232 do i=1, iip1267 do i=1,nbp_lon+1 233 268 data2(i,1)=px(1,1) 234 data2(i, jjp1)=px(ngrid,1)269 data2(i,nbp_lat)=px(ngrid,1) 235 270 enddo 236 271 ! rest of the grid 237 do j=2, jjm238 ig0=1+(j-2)* iim239 do i=1, iim272 do j=2,nbp_lat-1 273 ig0=1+(j-2)*nbp_lon 274 do i=1,nbp_lon 240 275 data2(i,j)=px(ig0+i,1) 241 276 enddo 242 data2( iip1,j)=data2(1,j) ! extra (modulo) longitude277 data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude 243 278 enddo 244 279 #endif … … 266 301 corners(3)=ntime 267 302 268 edges(1)= iip1269 edges(2)= jjp1303 edges(1)=nbp_lon+1 304 edges(2)=nbp_lat 270 305 edges(3)=1 271 306 -
trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
r1525 r1529 43 43 ! Addition by RW (2010) to allow OLR to be saved in .nc format 44 44 use radinc_h, only : L_NSPECTI 45 ! USE surfdat_h, only : phisfi 46 #ifdef CPP_PARA 45 use comgeomphy, only: airephy 47 46 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather 48 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 49 #endif 47 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, 48 & nbp_lon, nbp_lat 50 49 use time_phylmdz_mod, only: ecritphy, iphysiq, day_step, day_ini 51 50 use callkeys_mod, only: iradia … … 53 52 implicit none 54 53 55 ! Commons 56 #include "dimensions.h" 57 !#include "dimphys.h" 58 #include "paramet.h" 59 !#include "control.h" 60 #include "comgeom.h" 61 #include "netcdf.inc" 54 include "netcdf.inc" 62 55 63 56 ! Arguments on input: … … 73 66 ! real dx0 74 67 75 real date76 77 ! REAL phis(ip1jmp1)78 79 68 integer irythme 80 69 integer ierr … … 82 71 integer i,j,l,zmax , ig0 83 72 84 integer zitau 85 character firstnom*20 86 SAVE firstnom 87 SAVE zitau 88 SAVE date 89 data firstnom /'1234567890'/ 90 data zitau /0/ 73 integer,save :: zitau=0 74 character(len=20),save :: firstnom='1234567890' 75 real,save :: date 91 76 !$OMP THREADPRIVATE(firstnom,zitau,date) 92 77 … … 100 85 integer, dimension(4) :: edges,corner 101 86 87 real area((nbp_lon+1),nbp_lat) 102 88 ! added by RDW for OLR output 103 real dx3( iip1,jjp1,L_NSPECTI) ! to store the data set89 real dx3(nbp_lon+1,nbp_lat,L_NSPECTI) ! to store the data set 104 90 105 91 #ifdef CPP_PARA 106 92 ! Added to work in parallel mode 107 93 real dx3_glop(klon_glo,L_NSPECTI) 108 real dx3_glo( iim,jjp1,L_NSPECTI) ! to store a global 3D data set109 #else 110 logical,parameter :: is_master=.true. 111 logical,parameter :: is_mpi_root=.true.94 real dx3_glo(nbp_lon,nbp_lat,L_NSPECTI) ! to store a global 3D data set 95 real areafi_glo(klon_glo) ! mesh area on global physics grid 96 #else 97 real areafi_glo(ngrid) ! mesh area on global physics grid 112 98 #endif 113 99 … … 139 125 endif 140 126 127 #ifdef CPP_PARA 128 ! Gather airephy() mesh area on physics grid 129 call Gather(airephy,areafi_glo) 130 #else 131 areafi_glo(:)=airephy(:) 132 #endif 141 133 ! Create the NetCDF file 142 134 if (is_master) then … … 159 151 ierr = NF_ENDDEF(nid) 160 152 161 ! call gr_fi_dyn(1,size(phisfi_glo),iip1,jjp1,phisfi_glo,phis) 153 ! Build area() 154 do i=1,nbp_lon+1 ! poles 155 ! divide at the poles by nbp_lon 156 area(i,1)=areafi_glo(1)/nbp_lon 157 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 158 enddo 159 do j=2,nbp_lat-1 160 ig0= 1+(j-2)*nbp_lon 161 do i=1,nbp_lon 162 area(i,j)=areafi_glo(ig0+i) 163 enddo 164 ! handle redundant point in longitude 165 area(nbp_lon+1,j)=area(1,j) 166 enddo 167 162 168 ! write "header" of file (longitudes, latitudes, area, ...) 163 call iniwrite_specIR(nid,day_ini )169 call iniwrite_specIR(nid,day_ini,area) 164 170 endif ! of if (is_master) 165 171 … … 215 221 endif 216 222 217 write(6,*)'WRITEDIAGSPEC : date= ', date223 write(6,*)'WRITEDIAGSPECIR: date= ', date 218 224 endif ! of if (is_master) 219 225 end if ! of if (nom.eq.firstnom) … … 233 239 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 234 240 ! copy dx3_glo() to dx3(:) and add redundant longitude 235 dx3(1: iim,:,:)=dx3_glo(1:iim,:,:)236 dx3( iip1,:,:)=dx3(1,:,:)241 dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 242 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 237 243 endif 238 244 !$OMP END MASTER … … 240 246 #else 241 247 DO l=1,L_NSPECTI 242 DO i=1, iip1248 DO i=1,nbp_lon+1 243 249 dx3(i,1,l)=px(1,l) 244 dx3(i, jjp1,l)=px(ngrid,l)250 dx3(i,nbp_lat,l)=px(ngrid,l) 245 251 ENDDO 246 DO j=2, jjm247 ig0= 1+(j-2)* iim248 DO i=1, iim252 DO j=2,nbp_lat-1 253 ig0= 1+(j-2)*nbp_lon 254 DO i=1,nbp_lon 249 255 dx3(i,j,l)=px(ig0+i,l) 250 256 ENDDO 251 dx3( iip1,j,l)=dx3(1,j,l)257 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 252 258 ENDDO 253 259 ENDDO … … 279 285 corner(4)=ntime 280 286 281 edges(1)= iip1282 edges(2)= jjp1287 edges(1)=nbp_lon+1 288 edges(2)=nbp_lat 283 289 edges(3)=L_NSPECTI 284 290 edges(4)=1 -
trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
r1525 r1529 43 43 ! Addition by RW (2010) to allow OSR to be saved in .nc format 44 44 use radinc_h, only : L_NSPECTV 45 ! USE surfdat_h 46 #ifdef CPP_PARA 45 use comgeomphy, only: airephy 47 46 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather 48 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 49 #endif 47 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, 48 & nbp_lon, nbp_lat 50 49 use time_phylmdz_mod, only: ecritphy, iphysiq, day_step, day_ini 51 50 use callkeys_mod, only: iradia … … 53 52 implicit none 54 53 55 ! Commons 56 #include "dimensions.h" 57 !#include "dimphys.h" 58 #include "paramet.h" 59 !#include "control.h" 60 #include "comgeom.h" 61 #include "netcdf.inc" 54 include "netcdf.inc" 62 55 63 56 ! Arguments on input: … … 73 66 ! real dx0 74 67 75 real date76 77 ! REAL phis(ip1jmp1)78 79 68 integer irythme 80 69 integer ierr … … 82 71 integer i,j,l,zmax , ig0 83 72 84 integer zitau 85 character firstnom*20 86 SAVE firstnom 87 SAVE zitau 88 SAVE date 89 data firstnom /'1234567890'/ 90 data zitau /0/ 73 integer,save :: zitau=0 74 character(len=20),save :: firstnom='1234567890' 75 real,save :: date 91 76 !$OMP THREADPRIVATE(firstnom,zitau,date) 92 77 … … 100 85 integer, dimension(4) :: edges,corner 101 86 87 real area((nbp_lon+1),nbp_lat) 102 88 ! added by RDW for OSR output 103 real dx3( iip1,jjp1,L_NSPECTV) ! to store the data set89 real dx3(nbp_lon+1,nbp_lat,L_NSPECTV) ! to store the data set 104 90 105 91 #ifdef CPP_PARA 106 92 ! Added to work in parallel mode 107 93 real dx3_glop(klon_glo,L_NSPECTV) 108 real dx3_glo( iim,jjp1,L_NSPECTV) ! to store a global 3D data set109 #else 110 logical,parameter :: is_master=.true. 111 logical,parameter :: is_mpi_root=.true.94 real dx3_glo(nbp_lon,nbp_lat,L_NSPECTV) ! to store a global 3D data set 95 real areafi_glo(klon_glo) ! mesh area on global physics grid 96 #else 97 real areafi_glo(ngrid) ! mesh area on global physics grid 112 98 #endif 113 99 … … 138 124 endif 139 125 126 #ifdef CPP_PARA 127 ! Gather airephy() mesh area on physics grid 128 call Gather(airephy,areafi_glo) 129 #else 130 areafi_glo(:)=airephy(:) 131 #endif 140 132 ! Create the NetCDF file 141 133 if (is_master) then … … 158 150 ierr = NF_ENDDEF(nid) 159 151 152 ! Build area() 153 do i=1,nbp_lon+1 ! poles 154 ! divide at the poles by nbp_lon 155 area(i,1)=areafi_glo(1)/nbp_lon 156 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 157 enddo 158 do j=2,nbp_lat-1 159 ig0= 1+(j-2)*nbp_lon 160 do i=1,nbp_lon 161 area(i,j)=areafi_glo(ig0+i) 162 enddo 163 ! handle redundant point in longitude 164 area(nbp_lon+1,j)=area(1,j) 165 enddo 166 160 167 ! write "header" of file (longitudes, latitudes, geopotential, ...) 161 ! call gr_fi_dyn(1,ngrid,iip1,jjp1,phisfi,phis) 162 ! call iniwrite(nid,day_ini,phis) 163 call iniwrite_specVI(nid,day_ini) 168 call iniwrite_specVI(nid,day_ini,area) 164 169 endif ! of if (is_master) 165 170 … … 215 220 endif 216 221 217 write(6,*)'WRITEDIAGSPEC : date= ', date222 write(6,*)'WRITEDIAGSPECVI: date= ', date 218 223 endif ! of if (is_master) 219 224 end if ! of if (nom.eq.firstnom) … … 233 238 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 234 239 ! copy dx3_glo() to dx3(:) and add redundant longitude 235 dx3(1: iim,:,:)=dx3_glo(1:iim,:,:)236 dx3( iip1,:,:)=dx3(1,:,:)240 dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 241 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 237 242 endif 238 243 !$OMP END MASTER … … 240 245 #else 241 246 DO l=1,L_NSPECTV 242 DO i=1, iip1247 DO i=1,nbp_lon+1 243 248 dx3(i,1,l)=px(1,l) 244 dx3(i, jjp1,l)=px(ngrid,l)249 dx3(i,nbp_lat,l)=px(ngrid,l) 245 250 ENDDO 246 DO j=2, jjm247 ig0= 1+(j-2)* iim248 DO i=1, iim251 DO j=2,nbp_lat-1 252 ig0= 1+(j-2)*nbp_lon 253 DO i=1,nbp_lon 249 254 dx3(i,j,l)=px(ig0+i,l) 250 255 ENDDO 251 dx3( iip1,j,l)=dx3(1,j,l)256 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 252 257 ENDDO 253 258 ENDDO … … 279 284 corner(4)=ntime 280 285 281 edges(1)= iip1282 edges(2)= jjp1286 edges(1)=nbp_lon+1 287 edges(2)=nbp_lat 283 288 edges(3)=L_NSPECTV 284 289 edges(4)=1 -
trunk/LMDZ.GENERIC/libf/phystd/wstats.F90
r1422 r1529 1 1 subroutine wstats(ngrid,nom,titre,unite,dim,px) 2 2 3 use statto_mod, only: istats,istime,count 3 4 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather, klon_mpi_begin 4 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 5 use statto_mod, only: istats,istime,count 6 5 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, & 6 nbp_lon, nbp_lat, nbp_lev 7 7 implicit none 8 8 9 #include "dimensions.h" 10 !#include "dimphys.h" 11 #include "netcdf.inc" 9 include "netcdf.inc" 12 10 13 11 integer,intent(in) :: ngrid 14 12 character (len=*),intent(in) :: nom,titre,unite 15 13 integer,intent(in) :: dim 16 integer,parameter :: iip1=iim+1 17 integer,parameter :: jjp1=jjm+1 18 real,intent(in) :: px(ngrid,llm) 19 real, dimension(iip1,jjp1,llm) :: mean3d,sd3d,dx3 20 real, dimension(iip1,jjp1) :: mean2d,sd2d,dx2 14 real,intent(in) :: px(ngrid,nbp_lev) 15 real, dimension(nbp_lon+1,nbp_lat,nbp_lev) :: mean3d,sd3d,dx3 16 real, dimension(nbp_lon+1,nbp_lat) :: mean2d,sd2d,dx2 21 17 character (len=50) :: namebis 22 18 character (len=50), save :: firstvar … … 34 30 ! Added to work in parallel mode 35 31 #ifdef CPP_PARA 36 real px3_glop(klon_glo, llm) ! to store a 3D data set on global physics grid37 real px3_glo( iim,jjp1,llm) ! to store a global 3D data set on global lonxlat grid32 real px3_glop(klon_glo,nbp_lev) ! to store a 3D data set on global physics grid 33 real px3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set on global lonxlat grid 38 34 real px2_glop(klon_glo) ! to store a 2D data set on global physics grid 39 real px2_glo( iim,jjp1) ! to store a 2D data set on global lonxlat grid35 real px2_glo(nbp_lon,nbp_lat) ! to store a 2D data set on global lonxlat grid 40 36 real px2(ngrid) 41 real px3(ngrid, llm)37 real px3(ngrid,nbp_lev) 42 38 #else 43 39 ! When not running in parallel mode: 44 real px3_glop(ngrid, llm) ! to store a 3D data set on global physics grid45 real px3_glo( iim,jjp1,llm) ! to store a global 3D data set on global lonxlat grid40 real px3_glop(ngrid,nbp_lev) ! to store a 3D data set on global physics grid 41 real px3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set on global lonxlat grid 46 42 real px2_glop(ngrid) ! to store a 2D data set on global physics grid 47 real px2_glo( iim,jjp1) ! to store a 2D data set on global lonxlat grid43 real px2_glo(nbp_lon,nbp_lat) ! to store a 2D data set on global lonxlat grid 48 44 #endif 49 45 … … 67 63 #ifdef CPP_PARA 68 64 if (dim.eq.3) then 69 px3(1:ngrid,1: llm)=px(1:ngrid,1:llm)65 px3(1:ngrid,1:nbp_lev)=px(1:ngrid,1:nbp_lev) 70 66 ! Gather fieds on a "global" (without redundant longitude) array 71 67 call Gather(px3,px3_glop) … … 74 70 call Grid1Dto2D_glo(px3_glop,px3_glo) 75 71 ! copy dx3_glo() to dx3(:) and add redundant longitude 76 dx3(1: iim,:,:)=px3_glo(1:iim,:,:)77 dx3( iip1,:,:)=dx3(1,:,:)72 dx3(1:nbp_lon,:,:)=px3_glo(1:nbp_lon,:,:) 73 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 78 74 endif 79 75 !$OMP END MASTER … … 87 83 call Grid1Dto2D_glo(px2_glop,px2_glo) 88 84 ! copy px2_glo() to dx2(:) and add redundant longitude 89 dx2(1: iim,:)=px2_glo(1:iim,:)90 dx2( iip1,:)=dx2(1,:)85 dx2(1:nbp_lon,:)=px2_glo(1:nbp_lon,:) 86 dx2(nbp_lon+1,:)=dx2(1,:) 91 87 endif 92 88 !$OMP END MASTER … … 95 91 #else 96 92 if (dim.eq.3) then 97 px3_glop(:,1: llm)=px(:,1:llm)93 px3_glop(:,1:nbp_lev)=px(:,1:nbp_lev) 98 94 ! Passage variable physique --> variable dynamique 99 DO l=1, llm100 DO i=1, iim95 DO l=1,nbp_lev 96 DO i=1,nbp_lon 101 97 px3_glo(i,1,l)=px(1,l) 102 px3_glo(i, jjp1,l)=px(ngrid,l)98 px3_glo(i,nbp_lat,l)=px(ngrid,l) 103 99 ENDDO 104 DO j=2, jjm105 ig0= 1+(j-2)* iim106 DO i=1, iim100 DO j=2,nbp_lat-1 101 ig0= 1+(j-2)*nbp_lon 102 DO i=1,nbp_lon 107 103 px3_glo(i,j,l)=px(ig0+i,l) 108 104 ENDDO … … 112 108 px2_glop(:)=px(:,1) 113 109 ! Passage variable physique --> physique dynamique 114 DO i=1, iim110 DO i=1,nbp_lon 115 111 px2_glo(i,1)=px(1,1) 116 px2_glo(i, jjp1)=px(ngrid,1)112 px2_glo(i,nbp_lat)=px(ngrid,1) 117 113 ENDDO 118 DO j=2, jjm119 ig0= 1+(j-2)* iim120 DO i=1, iim114 DO j=2,nbp_lat-1 115 ig0= 1+(j-2)*nbp_lon 116 DO i=1,nbp_lon 121 117 px2_glo(i,j)=px(ig0+i,1) 122 118 ENDDO … … 198 194 if (dim.eq.3) then 199 195 start=(/1,1,1,indx/) 200 sizes=(/ iip1,jjp1,llm,1/)196 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 201 197 mean3d(:,:,:)=0 202 198 sd3d(:,:,:)=0 203 199 else if (dim.eq.2) then 204 200 start=(/1,1,indx,0/) 205 sizes=(/ iip1,jjp1,1,0/)201 sizes=(/nbp_lon+1,nbp_lev,1,0/) 206 202 mean2d(:,:)=0 207 203 sd2d(:,:)=0 … … 211 207 if (dim.eq.3) then 212 208 start=(/1,1,1,indx/) 213 sizes=(/ iip1,jjp1,llm,1/)209 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 214 210 #ifdef NC_DOUBLE 215 211 ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,sizes,mean3d) … … 226 222 else if (dim.eq.2) then 227 223 start=(/1,1,indx,0/) 228 sizes=(/ iip1,jjp1,1,0/)224 sizes=(/nbp_lon+1,nbp_lat,1,0/) 229 225 #ifdef NC_DOUBLE 230 226 ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,sizes,mean2d) … … 245 241 246 242 if (dim.eq.3) then 247 dx3(1: iim,:,:)=px3_glo(:,:,:)248 dx3( iip1,:,:)=dx3(1,:,:)243 dx3(1:nbp_lon,:,:)=px3_glo(:,:,:) 244 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 249 245 else ! dim.eq.2 250 dx2(1: iim,:)=px2_glo(:,:)251 dx2( iip1,:)=dx2(1,:)246 dx2(1:nbp_lon,:)=px2_glo(:,:) 247 dx2(nbp_lon+1,:)=dx2(1,:) 252 248 endif 253 249 … … 290 286 !====================================================== 291 287 subroutine inivar(nid,varid,ngrid,dim,indx,px,ierr) 288 use mod_grid_phy_lmdz, only : nbp_lon, nbp_lat, nbp_lev 292 289 293 290 implicit none 294 291 295 include "dimensions.h"296 !include "dimphys.h"297 292 include "netcdf.inc" 298 293 299 294 integer, intent(in) :: nid,varid,dim,indx,ngrid 300 real, dimension(ngrid, llm), intent(in) :: px295 real, dimension(ngrid,nbp_lev), intent(in) :: px 301 296 integer, intent(out) :: ierr 302 303 integer,parameter :: iip1=iim+1304 integer,parameter :: jjp1=jjm+1305 297 306 298 integer :: l,i,j,ig0 307 299 integer, dimension(4) :: start,sizes 308 real, dimension( iip1,jjp1,llm) :: dx3309 real, dimension( iip1,jjp1) :: dx2300 real, dimension(nbp_lon+1,nbp_lat,nbp_lev) :: dx3 301 real, dimension(nbp_lon+1,nbp_lat) :: dx2 310 302 311 303 if (dim.eq.3) then 312 304 313 305 start=(/1,1,1,indx/) 314 sizes=(/ iip1,jjp1,llm,1/)306 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 315 307 316 308 ! Passage variable physique --> variable dynamique 317 309 318 DO l=1, llm319 DO i=1, iip1310 DO l=1,nbp_lev 311 DO i=1,nbp_lon+1 320 312 dx3(i,1,l)=px(1,l) 321 dx3(i, jjp1,l)=px(ngrid,l)313 dx3(i,nbp_lat,l)=px(ngrid,l) 322 314 ENDDO 323 DO j=2, jjm324 ig0= 1+(j-2)* iim325 DO i=1, iim315 DO j=2,nbp_lat-1 316 ig0= 1+(j-2)*nbp_lon 317 DO i=1,nbp_lon 326 318 dx3(i,j,l)=px(ig0+i,l) 327 319 ENDDO 328 dx3( iip1,j,l)=dx3(1,j,l)320 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 329 321 ENDDO 330 322 ENDDO … … 339 331 340 332 start=(/1,1,indx,0/) 341 sizes=(/ iip1,jjp1,1,0/)333 sizes=(/nbp_lon+1,nbp_lat,1,0/) 342 334 343 335 ! Passage variable physique --> physique dynamique 344 336 345 DO i=1, iip1337 DO i=1,nbp_lon+1 346 338 dx2(i,1)=px(1,1) 347 dx2(i, jjp1)=px(ngrid,1)339 dx2(i,nbp_lat)=px(ngrid,1) 348 340 ENDDO 349 DO j=2, jjm350 ig0= 1+(j-2)* iim351 DO i=1, iim341 DO j=2,nbp_lat-1 342 ig0= 1+(j-2)*nbp_lon 343 DO i=1,nbp_lon 352 344 dx2(i,j)=px(ig0+i,1) 353 345 ENDDO 354 dx2( iip1,j)=dx2(1,j)346 dx2(nbp_lon+1,j)=dx2(1,j) 355 347 ENDDO 356 348 … … 380 372 implicit none 381 373 382 #include "netcdf.inc"374 include "netcdf.inc" 383 375 384 376 integer,intent(in) :: nid ! NetCDF file ID
Note: See TracChangeset
for help on using the changeset viewer.