Changeset 4539 for LMDZ6/trunk
- Timestamp:
- May 17, 2023, 12:53:42 AM (19 months ago)
- Location:
- LMDZ6/trunk/libf/phylmd
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/physiqex_mod.F90
r4537 r4539 17 17 USE geometry_mod, only : latitude 18 18 ! USE comcstphy, only : rg 19 USE iophy, only : histbeg_phy,histwrite_phy 20 USE ioipsl, only : getin,histvert,histdef,histend,ymds2ju 21 USE mod_phys_lmdz_para, only : jj_nb 19 USE ioipsl, only : ymds2ju 22 20 USE phys_state_var_mod, only : phys_state_var_init 23 USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat24 21 USE phyetat0_mod, only: phyetat0 25 USE iophy, ONLY : init_iophy_new 26 USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg 27 28 29 #ifdef CPP_XIOS 30 USE xios, ONLY: xios_update_calendar 31 USE wxios, only: wxios_add_vaxis, wxios_set_cal, wxios_closedef 32 USE iophy, ONLY: histwrite_phy 33 #endif 22 USE output_physiqex_mod, ONLY: output_physiqex 34 23 35 24 IMPLICIT none … … 69 58 70 59 71 integer,save :: itau=0 ! counter to count number of calls to physics72 !$OMP THREADPRIVATE(itau)73 60 real :: temp_newton(klon,klev) 74 61 integer :: k … … 82 69 integer :: itau0 83 70 real :: zjulian 84 real :: dtime85 integer :: nhori ! horizontal coordinate ID86 integer,save :: nid_hist ! output file ID87 !$OMP THREADPRIVATE(nid_hist)88 integer :: zvertid ! vertical coordinate ID89 integer,save :: iwrite_phys ! output every iwrite_phys physics step90 !$OMP THREADPRIVATE(iwrite_phys)91 integer,save :: iwrite_phys_omp ! intermediate variable to read iwrite_phys92 ! (must be shared by all threads)93 real :: t_ops ! frequency of the IOIPSL operations (eg average over...)94 real :: t_wrt ! frequency of the IOIPSL outputs95 96 71 97 72 … … 108 83 call phys_state_var_init(1) ! some initializations, required before calling phyetat0 109 84 call phyetat0("startphy.nc", clesphy0, tabcntr0) 110 CALL init_iophy_new(latitude_deg,longitude_deg)111 85 112 86 ! Initialize outputs: 113 87 itau0=0 114 !$OMP MASTER115 iwrite_phys_omp=1 !default: output every physics timestep116 ! NB: getin() is not threadsafe; only one thread should call it.117 call getin("iwrite_phys",iwrite_phys_omp)118 !$OMP END MASTER119 !$OMP BARRIER120 iwrite_phys=iwrite_phys_omp121 t_ops=pdtphys*iwrite_phys ! frequency of the IOIPSL operation122 t_wrt=pdtphys*iwrite_phys ! frequency of the outputs in the file123 88 ! compute zjulian for annee0=1979 and month=1 dayref=1 and hour=0.0 124 89 !CALL ymds2ju(annee0, month, dayref, hour, zjulian) 125 90 call ymds2ju(1979, 1, 1, 0.0, zjulian) 126 dtime=pdtphys127 91 128 92 #ifndef CPP_IOIPSL_NO_OUTPUT 129 93 ! Initialize IOIPSL output file 130 call histbeg_phy("histins.nc",itau0,zjulian,dtime,nhori,nid_hist)131 94 #endif 132 95 … … 137 100 !------------------------------------------------------------ 138 101 139 ! increment local time counter itau140 itau=itau+1141 102 142 103 ! set all tendencies to zero … … 166 127 !------------------------------------------------------------ 167 128 168 print*,'PHYDEV: itau=',itau169 129 170 171 if(debut)then 172 !$OMP MASTER 173 #ifndef CPP_IOIPSL_NO_OUTPUT 174 ! IOIPSL 175 ! define vertical coordinate 176 call histvert(nid_hist,"presnivs","Vertical levels","Pa",klev, & 177 presnivs,zvertid,'down') 178 ! define variables which will be written in "histins.nc" file 179 call histdef(nid_hist,'temperature','Atmospheric temperature','K', & 180 nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, & 181 'inst(X)',t_ops,t_wrt) 182 call histdef(nid_hist,'u','Eastward Zonal Wind','m/s', & 183 nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, & 184 'inst(X)',t_ops,t_wrt) 185 call histdef(nid_hist,'v','Northward Meridional Wind','m/s', & 186 nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, & 187 'inst(X)',t_ops,t_wrt) 188 call histdef(nid_hist,'ps','Surface Pressure','Pa', & 189 nbp_lon,jj_nb,nhori,1,1,1,zvertid,32, & 190 'inst(X)',t_ops,t_wrt) 191 ! end definition sequence 192 call histend(nid_hist) 193 #endif 194 195 #ifdef CPP_XIOS 196 !XIOS 197 ! Declare available vertical axes to be used in output files: 198 CALL wxios_add_vaxis("presnivs", klev, presnivs) 199 200 ! Declare calendar and time step 201 CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0) 202 203 !Finalize the context: 204 CALL wxios_closedef() 205 #endif 206 !$OMP END MASTER 207 !$OMP BARRIER 208 endif 209 ! write some outputs: 210 ! IOIPSL 211 #ifndef CPP_IOIPSL_NO_OUTPUT 212 if (modulo(itau,iwrite_phys)==0) then 213 call histwrite_phy(nid_hist,.false.,"temperature",itau,t) 214 call histwrite_phy(nid_hist,.false.,"u",itau,u) 215 call histwrite_phy(nid_hist,.false.,"v",itau,v) 216 call histwrite_phy(nid_hist,.false.,"ps",itau,paprs(:,1)) 217 endif 218 #endif 219 220 !XIOS 221 #ifdef CPP_XIOS 222 !$OMP MASTER 223 !Increment XIOS time 224 CALL xios_update_calendar(itau) 225 !$OMP END MASTER 226 !$OMP BARRIER 227 228 !Send fields to XIOS: (NB these fields must also be defined as 229 ! <field id="..." /> in iodef.xml to be correctly used 230 CALL histwrite_phy("temperature",t) 231 CALL histwrite_phy("temp_newton",temp_newton) 232 CALL histwrite_phy("u",u) 233 CALL histwrite_phy("v",v) 234 CALL histwrite_phy("ps",paprs(:,1)) 235 #endif 130 call output_physiqex(debut,zjulian,pdtphys,presnivs,paprs,u,v,t) 236 131 237 132 ! if lastcall, then it is time to write "restartphy.nc" file … … 240 135 endif 241 136 137 242 138 end subroutine physiqex 243 139
Note: See TracChangeset
for help on using the changeset viewer.