Changeset 1543 for trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars
- Timestamp:
- Apr 22, 2016, 9:02:11 AM (9 years ago)
- Location:
- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90
r1541 r1543 3 3 CONTAINS 4 4 5 subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, & 6 rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & 5 subroutine iniphysiq(ii,jj,nlayer, & 6 nbp, communicator, & 7 punjours, pdayref,ptimestep, & 8 rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & 7 9 prad,pg,pr,pcpp,iflag_phys) 8 10 9 use dimphy, only : klev ! number of atmospheric levels10 use mod_grid_phy_lmdz, only : klon_glo ! number of atmospheric columns11 ! (on full grid)11 use dimphy, only : init_dimphy 12 use mod_grid_phy_lmdz, only : klon_glo, & ! number of atmospheric columns (on full grid) 13 regular_lonlat ! regular longitude-latitude grid type 12 14 use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid) 13 15 klon_omp_begin, & ! start index of local omp subgrid 14 16 klon_omp_end, & ! end index of local omp subgrid 15 17 klon_mpi_begin ! start indes of columns (on local mpi grid) 16 17 use comgeomphy, only : initcomgeomphy, &18 cell_area, & ! physics grid area (m2)19 dx, & ! cu coeff. (u_covariant = cu * u)20 dy, & ! cv coeff. (v_covariant = cv * v)21 longitude, & ! longitudes (rad)22 latitude ! latitudes (rad)18 use geometry_mod, only: init_geometry 19 !use comgeomphy, only : initcomgeomphy, & 20 ! cell_area, & ! physics grid area (m2) 21 ! dx, & ! cu coeff. (u_covariant = cu * u) 22 ! dy, & ! cv coeff. (v_covariant = cv * v) 23 ! longitude, & ! longitudes (rad) 24 ! latitude ! latitudes (rad) 23 25 use infotrac, only : nqtot ! number of advected tracers 24 26 use comgeomfi_h, only: ini_fillgeom 25 27 use temps_mod, only: day_ini, hour_ini 26 28 use phys_state_var_init_mod, only: phys_state_var_init 29 use physics_distribution_mod, only: init_physics_distribution 27 30 use regular_lonlat_mod, only: init_regular_lonlat, & 28 31 east, west, north, south, & 29 32 north_east, north_west, & 30 33 south_west, south_east 34 use mod_interface_dyn_phys, only: init_interface_dyn_phys 31 35 32 36 implicit none … … 43 47 integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes 44 48 integer,intent(in) :: jj ! number of atompsheric columns along latitudes 49 integer,intent(in) :: nbp ! number of physics columns for this MPI process 50 integer,intent(in) :: communicator ! MPI communicator 45 51 real,intent(in) :: rlatu(jj+1) ! latitudes of the physics grid 46 52 real,intent(in) :: rlatv(jj) ! latitude boundaries of the physics grid … … 55 61 56 62 integer :: ibegin,iend,offset 57 integer :: i,j 63 integer :: i,j,k 58 64 character(len=20) :: modname='iniphysiq' 59 65 character(len=80) :: abort_message … … 66 72 67 73 ! global array, on full physics grid: 68 real,allocatable :: latfi(:) 69 real,allocatable :: lonfi(:) 70 real,allocatable :: cufi(:) 71 real,allocatable :: cvfi(:) 72 real,allocatable :: airefi(:) 74 real,allocatable :: latfi_glo(:) 75 real,allocatable :: lonfi_glo(:) 76 real,allocatable :: cufi_glo(:) 77 real,allocatable :: cvfi_glo(:) 78 real,allocatable :: airefi_glo(:) 79 real,allocatable :: boundslonfi_glo(:,:) 80 real,allocatable :: boundslatfi_glo(:,:) 81 82 ! local arrays, on given MPI/OpenMP domain: 83 real,allocatable,save :: latfi(:) 84 real,allocatable,save :: lonfi(:) 85 real,allocatable,save :: cufi(:) 86 real,allocatable,save :: cvfi(:) 87 real,allocatable,save :: airefi(:) 88 real,allocatable,save :: boundslonfi(:,:) 89 real,allocatable,save :: boundslatfi(:,:) 90 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi) 91 73 92 74 93 pi=2.*asin(1.0) 75 94 76 IF (nlayer.NE.klev) THEN 77 write(*,*) 'STOP in ',trim(modname) 78 write(*,*) 'Problem with dimensions :' 79 write(*,*) 'nlayer = ',nlayer 80 write(*,*) 'klev = ',klev 81 abort_message = '' 82 CALL abort_gcm (modname,abort_message,1) 83 ENDIF 84 85 !IF (ngrid.NE.klon_glo) THEN 86 ! write(*,*) 'STOP in ',trim(modname) 87 ! write(*,*) 'Problem with dimensions :' 88 ! write(*,*) 'ngrid = ',ngrid 89 ! write(*,*) 'klon = ',klon_glo 90 ! abort_message = '' 91 ! CALL abort_gcm (modname,abort_message,1) 92 !ENDIF 95 ! Initialize Physics distibution and parameters and interface with dynamics 96 CALL init_physics_distribution(regular_lonlat,4, & 97 nbp,ii,jj+1,nlayer,communicator) 98 CALL init_interface_dyn_phys 93 99 94 100 ! init regular global longitude-latitude grid points and boundaries … … 115 121 116 122 ! Generate global arrays on full physics grid 117 allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo)) 118 latfi(1)=rlatu(1) 119 lonfi(1)=0. 120 cufi(1) = cu(1) 121 cvfi(1) = cv(1) 123 allocate(latfi_glo(klon_glo),lonfi_glo(klon_glo)) 124 allocate(cufi_glo(klon_glo),cvfi_glo(klon_glo)) 125 allocate(airefi_glo(klon_glo)) 126 allocate(boundslonfi_glo(klon_glo,4)) 127 allocate(boundslatfi_glo(klon_glo,4)) 128 129 ! North pole 130 latfi_glo(1)=rlatu(1) 131 lonfi_glo(1)=0. 132 cufi_glo(1) = cu(1) 133 cvfi_glo(1) = cv(1) 134 boundslonfi_glo(1,north_east)=0 135 boundslatfi_glo(1,north_east)=PI/2 136 boundslonfi_glo(1,north_west)=2*PI 137 boundslatfi_glo(1,north_west)=PI/2 138 boundslonfi_glo(1,south_west)=2*PI 139 boundslatfi_glo(1,south_west)=rlatv(1) 140 boundslonfi_glo(1,south_east)=0 141 boundslatfi_glo(1,south_east)=rlatv(1) 122 142 DO j=2,jj 123 143 DO i=1,ii 124 latfi((j-2)*ii+1+i)= rlatu(j) 125 lonfi((j-2)*ii+1+i)= rlonv(i) 126 cufi((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i) 127 cvfi((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i) 144 k=(j-2)*ii+1+i 145 latfi_glo((j-2)*ii+1+i)= rlatu(j) 146 lonfi_glo((j-2)*ii+1+i)= rlonv(i) 147 cufi_glo((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i) 148 cvfi_glo((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i) 149 boundslonfi_glo(k,north_east)=rlonu(i) 150 boundslatfi_glo(k,north_east)=rlatv(j-1) 151 boundslonfi_glo(k,north_west)=rlonu(i+1) 152 boundslatfi_glo(k,north_west)=rlatv(j-1) 153 boundslonfi_glo(k,south_west)=rlonu(i+1) 154 boundslatfi_glo(k,south_west)=rlatv(j) 155 boundslonfi_glo(k,south_east)=rlonu(i) 156 boundslatfi_glo(k,south_east)=rlatv(j) 128 157 ENDDO 129 158 ENDDO 130 latfi(klon_glo)= rlatu(jj+1) 131 lonfi(klon_glo)= 0. 132 cufi(klon_glo) = cu((ii+1)*jj+1) 133 cvfi(klon_glo) = cv((ii+1)*jj-ii) 159 ! South pole 160 latfi_glo(klon_glo)= rlatu(jj+1) 161 lonfi_glo(klon_glo)= 0. 162 cufi_glo(klon_glo) = cu((ii+1)*jj+1) 163 cvfi_glo(klon_glo) = cv((ii+1)*jj-ii) 164 boundslonfi_glo(klon_glo,north_east)= 0 165 boundslatfi_glo(klon_glo,north_east)= rlatv(jj) 166 boundslonfi_glo(klon_glo,north_west)= 2*PI 167 boundslatfi_glo(klon_glo,north_west)= rlatv(jj) 168 boundslonfi_glo(klon_glo,south_west)= 2*PI 169 boundslatfi_glo(klon_glo,south_west)= -PI/2 170 boundslonfi_glo(klon_glo,south_east)= 0 171 boundslatfi_glo(klon_glo,south_east)= -Pi/2 134 172 135 173 ! build airefi(), mesh area on physics grid 136 allocate(airefi(klon_glo)) 137 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi) 174 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo) 138 175 ! Poles are single points on physics grid 139 airefi (1)=sum(aire(1:ii,1))140 airefi (klon_glo)=sum(aire(1:ii,jj+1))176 airefi_glo(1)=sum(aire(1:ii,1)) 177 airefi_glo(klon_glo)=sum(aire(1:ii,jj+1)) 141 178 142 179 ! Sanity check: do total planet area match between physics and dynamics? 143 180 total_area_dyn=sum(aire(1:ii,1:jj+1)) 144 total_area_phy=sum(airefi (1:klon_glo))181 total_area_phy=sum(airefi_glo(1:klon_glo)) 145 182 IF (total_area_dyn/=total_area_phy) THEN 146 183 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' … … 158 195 !$OMP PARALLEL 159 196 ! Now generate local lon/lat/cu/cv/area arrays 160 call initcomgeomphy 161 162 !!!!$OMP PARALLEL PRIVATE(ibegin,iend) 163 !!!$OMP+ SHARED(parea,pcu,pcv,plon,plat) 197 allocate(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp)) 198 allocate(airefi(klon_omp)) 199 allocate(boundslonfi(klon_omp,4)) 200 allocate(boundslatfi(klon_omp,4)) 201 !call initcomgeomphy 164 202 165 203 offset=klon_mpi_begin-1 166 cell_area(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end) 167 dx(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end) 168 dy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end) 169 longitude(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end) 170 latitude(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end) 204 airefi(1:klon_omp)=airefi_glo(offset+klon_omp_begin:offset+klon_omp_end) 205 cufi(1:klon_omp)=cufi_glo(offset+klon_omp_begin:offset+klon_omp_end) 206 cvfi(1:klon_omp)=cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 207 lonfi(1:klon_omp)=lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 208 latfi(1:klon_omp)=latfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 209 boundslonfi(1:klon_omp,:)=boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 210 boundslatfi(1:klon_omp,:)=boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 211 212 ! copy over local grid longitudes and latitudes 213 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, & 214 airefi,cufi,cvfi) 171 215 172 216 ! copy some fundamental parameters to physics 173 217 ! and do some initializations 218 219 call init_dimphy(klon_omp,nlayer) ! Initialize dimphy module 174 220 call phys_state_var_init(klon_omp,nlayer,nqtot, & 175 221 day_ini,hour_ini,punjours,ptimestep, & 176 222 prad,pg,pr,pcpp) 177 call ini_fillgeom(klon_omp,lat itude,longitude,cell_area)223 call ini_fillgeom(klon_omp,latfi,lonfi,airefi) 178 224 call conf_phys(klon_omp,nlayer,nqtot) 179 225 -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F
r1524 r1543 15 15 c======================================================================= 16 16 17 use ioipsl_getincom, only: getin 17 use ioipsl_getincom, only: getin 18 use mod_phys_lmdz_para, only: is_parallel, is_sequential, 19 & is_mpi_root, is_omp_root, 20 & is_master 18 21 use infotrac, only: infotrac_init, nqtot, tname 19 22 use tracer_mod, only: noms, mmol, … … 29 32 use phyredem, only: physdem0, physdem1 30 33 use iostart, only: open_startphy 31 use comgeomphy, only: initcomgeomphy32 ! use planete_h33 34 use dimradmars_mod, only: tauscaling 34 35 use turb_mod, only: q2 35 use comgeomfi_h, only: ini_fillgeom36 36 use filtreg_mod, only: inifilr 37 USE mod_const_mpi, ONLY: COMM_LMDZ 37 38 USE comvert_mod, ONLY: ap,bp,pa,preff 38 39 USE comconst_mod, ONLY: lllm,daysec,dtphys,dtvr, … … 41 42 USE temps_mod, ONLY: day_ini,hour_ini 42 43 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 43 USE phys_state_var_init_mod, ONLY: phys_state_var_init44 USE iniphysiq_mod, ONLY: iniphysiq 44 45 45 46 implicit none 46 47 47 #include "dimensions.h"48 include "dimensions.h" 48 49 integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 49 #include "paramet.h"50 #include "comgeom2.h"51 #include "comdissnew.h"52 #include "clesph0.h"53 #include "netcdf.inc"54 #include "datafile.h"50 include "paramet.h" 51 include "comgeom2.h" 52 include "comdissnew.h" 53 include "clesph0.h" 54 include "netcdf.inc" 55 include "datafile.h" 55 56 c======================================================================= 56 57 c Declarations … … 181 182 planet_type="mars" 182 183 183 ! initialize "serial/parallel" related stuff 184 CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) 185 call initcomgeomphy 186 184 ! initialize "serial/parallel" related stuff: 185 ! (required because we call tabfi() below, before calling iniphysiq) 186 is_sequential=.true. 187 is_parallel=.false. 188 is_mpi_root=.true. 189 is_omp_root=.true. 190 is_master=.true. 191 187 192 ! Load tracer number and names: 188 ! call iniadvtrac(nqtot,numvanle)189 193 call infotrac_init 190 194 ! allocate arrays … … 335 339 mugaz = p_mugaz 336 340 daysec = p_daysec 337 ! write(*,*) 'aire',aire338 341 339 342 … … 349 352 idum=0 350 353 351 c Initialisation coordonnees /aires 352 c ------------------------------- 353 ! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h" 354 ! rlatu() and rlonv() are given in radians 355 latfi(1)=rlatu(1) 356 lonfi(1)=0. 357 DO j=2,jjm 358 DO i=1,iim 359 latfi((j-2)*iim+1+i)=rlatu(j) 360 lonfi((j-2)*iim+1+i)=rlonv(i) 361 ENDDO 362 ENDDO 363 latfi(ngridmx)=rlatu(jjp1) 364 lonfi(ngridmx)=0. 365 366 ! build airefi(), mesh area on physics grid 367 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi) 368 ! Poles are single points on physics grid 369 airefi(1)=sum(aire(1:iim,1)) 370 airefi(ngridmx)=sum(aire(1:iim,jjm+1)) 371 372 ! also initialize various physics flags/settings which might be needed 373 ! (for instance initracer needs to know about some flags, and/or 374 ! 'datafile' path may be changed by user) 375 call phys_state_var_init(ngridmx,llm,nqtot, 376 & day_ini,hour_ini,daysec,dtphys, 377 & rad,g,r,cpp) 378 call ini_fillgeom(ngridmx,latfi,lonfi,airefi) 379 call conf_phys(ngridmx,llm,nqtot) 354 ! Initialize the physics 355 CALL iniphysiq(iim,jjm,llm, 356 & (jjm-1)*iim+2,comm_lmdz, 357 & daysec,day_ini,dtphys, 358 & rlatu,rlatv,rlonu,rlonv, 359 & aire,cu,cv,rad,g,r,cpp, 360 & 1) 380 361 381 362 c======================================================================= -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F
r1433 r1543 23 23 use surfdat_h, only: ini_surfdat_h, qsurf 24 24 use comsoil_h, only: ini_comsoil_h 25 use comgeomphy, only: initcomgeomphy25 ! use comgeomphy, only: initcomgeomphy 26 26 use filtreg_mod, only: inifilr 27 USE mod_const_mpi, ONLY: COMM_LMDZ 27 28 use control_mod, only: planet_type 28 29 USE comvert_mod, ONLY: ap,bp 29 USE comconst_mod, ONLY: g,cpp30 USE comconst_mod, ONLY: daysec,dtphys,rad,g,r,cpp 30 31 USE logic_mod, ONLY: grireg 31 32 USE temps_mod, ONLY: day_ini,hour_ini 33 USE iniphysiq_mod, ONLY: iniphysiq 32 34 implicit none 33 35 34 #include "dimensions.h"36 include "dimensions.h" 35 37 integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) 36 #include "paramet.h"37 #include "comdissip.h"38 #include "comgeom.h"39 #include "netcdf.inc"38 include "paramet.h" 39 include "comdissip.h" 40 include "comgeom.h" 41 include "netcdf.inc" 40 42 41 43 c----------------------------------------------------------------------- … … 59 61 c Variable Physiques (grille physique) 60 62 c ------------------------------------ 61 REAL tsurf(ngridmx) 63 REAL tsurf(ngridmx) ! Surface temperature 62 64 REAL tsoil(ngridmx,nsoilmx) ! Soil temperature 63 REAL co2ice(ngridmx) 65 REAL co2ice(ngridmx) ! CO2 ice layer 64 66 REAL tauscaling(ngridmx) ! dust conversion factor 65 67 REAL q2(ngridmx,llm+1) … … 116 118 CALL defrun_new(99, .TRUE. ) 117 119 grireg = .TRUE. 118 ! initialize "serial/parallel" related stuff 119 CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) 120 call initcomgeomphy 120 121 121 planet_type='mars' 122 122 … … 125 125 c======================================================================= 126 126 ! Load tracer number and names: 127 ! call iniadvtrac(nqtot,numvanle)128 127 call infotrac_init 129 128 … … 131 130 allocate(q(ip1jmp1,llm,nqtot)) 132 131 allocate(qsurfS(ip1jmp1,nqtot)) 133 call ini_surfdat_h(ngridmx,nqtot)134 call ini_comsoil_h(ngridmx)135 132 136 133 … … 139 136 . ps,phis,timedyn) 140 137 138 c----------------------------------------------------------------------- 139 c Initialisations 140 c----------------------------------------------------------------------- 141 142 CALL defrun_new(99, .FALSE. ) 143 call iniconst 144 call inigeom 145 call inifilr 146 147 ! Initialize the physics 148 CALL iniphysiq(iim,jjm,llm, 149 & (jjm-1)*iim+2,comm_lmdz, 150 & daysec,day_ini,dtphys, 151 & rlatu,rlatv,rlonu,rlonv, 152 & aire,cu,cv,rad,g,r,cpp, 153 & 1) 141 154 142 155 fichnom = 'startfi.nc' … … 185 198 c ***************************************************************** 186 199 187 c-----------------------------------------------------------------------188 c Initialisations189 c-----------------------------------------------------------------------190 191 CALL defrun_new(99, .FALSE. )192 call iniconst193 call inigeom194 call inifilr195 200 CALL pression(ip1jmp1, ap, bp, ps, p3d) 196 201 call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
Note: See TracChangeset
for help on using the changeset viewer.