Changeset 3503 for trunk/LMDZ.PLUTO/libf/phypluto/soil_settings.F90
- Timestamp:
- Nov 8, 2024, 10:57:04 AM (13 days ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/phypluto/soil_settings.F90
r3502 r3503 2 2 3 3 ! use netcdf 4 use comsoil_h, only: layer, mlayer, inertiedat, volcapa, 5 & lay1_soil, alpha_soil 6 use iostart, only: inquire_field_ndims, get_var, get_field, 7 & inquire_field, inquire_dimension_length 4 use comsoil_h, only: layer, mlayer, inertiedat, volcapa, & 5 lay1_soil, alpha_soil 6 use iostart, only: inquire_field_ndims, get_var, get_field, & 7 inquire_field, inquire_dimension_length 8 use mod_phys_lmdz_para, only : is_master 8 9 implicit none 9 10 … … 92 93 allocate(oldmlayer(dimlen),stat=ierr) 93 94 if (ierr.ne.0) then 94 write(*,*) 'soil_settings: failed allocation of oldmlayer!'95 if (is_master) write(*,*) 'soil_settings: failed allocation of oldmlayer!' 95 96 stop 96 97 endif … … 105 106 endif 106 107 ! check if loaded mid-layer depth value differs from current one 107 if (abs((oldmlayer(1)-lay1_soil*alpha_soil**(-1./2.))/ 108 &(lay1_soil*alpha_soil**(-1./2.))).gt.1.e-6) then108 if (abs((oldmlayer(1)-lay1_soil*alpha_soil**(-1./2.))/& 109 (lay1_soil*alpha_soil**(-1./2.))).gt.1.e-6) then 109 110 interpol=.true. 110 111 endif … … 112 113 113 114 if (interpol) then 114 write(*,*)'soil_settings: Interpolation of soil temperature ',115 &'and thermal inertia will be required!'115 if (is_master) write(*,*)'soil_settings: Interpolation of soil temperature ', & 116 'and thermal inertia will be required!' 116 117 endif 117 118 … … 120 121 ! 1.3 Read depths values or set olddepthdef flag and values 121 122 if (ndims.eq.1) then ! we know that there is none 122 write(*,*)'soil_settings: no <soildepth> field expected'123 write(*,*)'building one mimicking old definitions'123 if (is_master) write(*,*)'soil_settings: no <soildepth> field expected' 124 if (is_master) write(*,*)'building one mimicking old definitions' 124 125 olddepthdef=.true. 125 126 interpol=.true. … … 128 129 allocate(oldmlayer(dimlen),stat=ierr) 129 130 if (ierr.ne.0) then 130 write(*,*) 'soil_settings: failed allocation of oldmlayer!'131 if (is_master) write(*,*) 'soil_settings: failed allocation of oldmlayer!' 131 132 stop 132 133 endif … … 140 141 call get_var("soildepth",oldmlayer,found) 141 142 if (.not.found) then 142 write(*,*)'soil_settings: Problem while reading <soildepth>'143 if (is_master) write(*,*)'soil_settings: Problem while reading <soildepth>' 143 144 endif 144 145 else ! put values in mlayer 145 146 call get_var("soildepth",mlayer,found) 146 print*,"mlayer",mlayer147 if (is_master) print*,"mlayer",mlayer 147 148 if (.not.found) then 148 write(*,*)'soil_settings: Problem while reading <soildepth>'149 if (is_master) write(*,*)'soil_settings: Problem while reading <soildepth>' 149 150 endif 150 151 endif !of if (interpol) … … 165 166 ! Check that these values are the same as those prescibed for mlayers 166 167 if ((abs(mlay1_soil-lay1_soil)/lay1_soil).gt.1.e-6) then 167 write(*,*) "soil_settings error: mlay1_soil=",mlay1_soil168 write(*,*) " does not match comsoil_h lay1_soil=",lay1_soil168 if (is_master) write(*,*) "soil_settings error: mlay1_soil=",mlay1_soil 169 if (is_master) write(*,*) " does not match comsoil_h lay1_soil=",lay1_soil 169 170 stop 170 171 endif 171 172 if ((abs(malpha-alpha_soil)/alpha_soil).gt.1.e-6) then 172 write(*,*) "soil_settings error: malpha=",malpha173 write(*,*) " does not match comsoil_h alpha_soil=",alpha_soil173 if (is_master) write(*,*) "soil_settings error: malpha=",malpha 174 if (is_master) write(*,*) " does not match comsoil_h alpha_soil=",alpha_soil 174 175 stop 175 176 endif … … 186 187 187 188 if (volcapa.le.0.0) then 188 write(*,*)'soil_settings: Warning, volcapa = ',volcapa189 write(*,*)' That doesn t seem right'190 write(*,*)' Initializing Volumetric heat capacity to ',191 &default_volcapa189 if (is_master) write(*,*)'soil_settings: Warning, volcapa = ',volcapa 190 if (is_master) write(*,*)' That doesn t seem right' 191 if (is_master) write(*,*)' Initializing Volumetric heat capacity to ', & 192 default_volcapa 192 193 volcapa=default_volcapa 193 194 endif … … 201 202 202 203 if (ndims.eq.1) then ! "old 2D-surface" format 203 write(*,*)'soil_settings: Thermal inertia is only given as surfac204 &e data!'204 if (is_master) write(*,*)'soil_settings: Thermal inertia is only given as surfac& 205 e data!' 205 206 ! Read Surface thermal inertia 206 207 allocate(surfinertia(ngrid)) 207 208 call get_field("inertiedat",surfinertia,found) 208 209 if (.not.found) then 209 write(*,*) "soil_settings: Failed loading <inertiedat>"210 if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>" 210 211 call abort 211 212 endif 212 213 213 write(*,*)' => Building soil thermal inertia (using reference sur214 &face thermal inertia)'214 if (is_master) write(*,*)' => Building soil thermal inertia (using reference sur& 215 face thermal inertia)' 215 216 do iloop=1,nsoil 216 217 inertiedat(:,iloop)=surfinertia(:) … … 223 224 allocate(oldinertiedat(ngrid,dimlen),stat=ierr) 224 225 if (ierr.ne.0) then 225 write(*,*) 'soil_settings: failed allocation of ',226 &'oldinertiedat!'226 if (is_master) write(*,*) 'soil_settings: failed allocation of ', & 227 'oldinertiedat!' 227 228 stop 228 229 endif … … 230 231 call get_field("inertiedat",oldinertiedat,found) 231 232 if (.not.found) then 232 write(*,*) "soil_settings: Failed loading <inertiedat>"233 if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>" 233 234 call abort 234 235 endif … … 236 237 call get_field("inertiedat",inertiedat,found) 237 238 if (.not.found) then 238 write(*,*) "soil_settings: Failed loading <inertiedat>"239 if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>" 239 240 call abort 240 241 endif … … 249 250 ! if (ierr.ne.nf90_noerr) then 250 251 if (.not.ok) then 251 write(*,*)'soil_settings: Field <tsoil> not found!'252 write(*,*)' => Building <tsoil> from surface values <tsurf>'252 if (is_master) write(*,*)'soil_settings: Field <tsoil> not found!' 253 if (is_master) write(*,*)' => Building <tsoil> from surface values <tsurf>' 253 254 do iloop=1,nsoil 254 255 tsoil(:,iloop)=tsurf(:) … … 259 260 allocate(oldtsoil(ngrid,dimlen),stat=ierr) 260 261 if (ierr.ne.0) then 261 write(*,*) 'soil_settings: failed allocation of ',262 &'oldtsoil!'262 if (is_master) write(*,*) 'soil_settings: failed allocation of ', & 263 'oldtsoil!' 263 264 stop 264 265 endif … … 266 267 call get_field("tsoil",oldtsoil,found) 267 268 if (.not.found) then 268 write(*,*) "soil_settings: Failed loading <tsoil>"269 if (is_master) write(*,*) "soil_settings: Failed loading <tsoil>" 269 270 call abort 270 271 endif … … 272 273 call get_field("tsoil",tsoil,found,timeindex=indextime) 273 274 if (.not.found) then 274 write(*,*) "soil_settings: Failed loading <tsoil>"275 if (is_master) write(*,*) "soil_settings: Failed loading <tsoil>" 275 276 call abort 276 277 endif … … 292 293 ! build vertical coordinate 293 294 oldgrid(1)=0. ! ground 294 oldgrid(2:dimlen+1)=oldmlayer(1:dimlen)* 295 &(inertiedat(ig,1)/volcapa)295 oldgrid(2:dimlen+1)=oldmlayer(1:dimlen)*& 296 (inertiedat(ig,1)/volcapa) 296 297 ! interpolate 297 298 call interp_line(oldgrid,oldval,dimlen+1,mlayer,newval,nsoil) … … 308 309 309 310 if (interpol) then 310 write(*,*)'soil_settings: Vertical interpolation along new grid'311 if (is_master) write(*,*)'soil_settings: Vertical interpolation along new grid' 311 312 ! interpolate soil temperatures and thermal inertias 312 313 if (.not.allocated(oldgrid)) then … … 351 352 ! ---------------------------------------------------------------------- 352 353 353 write(*,*)354 write(*,*)'Soil volumetric heat capacity:',volcapa354 if (is_master) write(*,*) 355 if (is_master) write(*,*)'Soil volumetric heat capacity:',volcapa 355 356 356 357 xmin = MINVAL(inertiedat) 357 358 xmax = MAXVAL(inertiedat) 358 write(*,*)'Soil thermal inertia <inertiedat>:',xmin,xmax359 if (is_master) write(*,*)'Soil thermal inertia <inertiedat>:',xmin,xmax 359 360 360 361 xmin = 1.0E+20 … … 362 363 xmin = MINVAL(tsoil) 363 364 xmax = MAXVAL(tsoil) 364 write(*,*)'Soil temperature <tsoil>:',xmin,xmax365 if (is_master) write(*,*)'Soil temperature <tsoil>:',xmin,xmax 365 366 end
Note: See TracChangeset
for help on using the changeset viewer.