[2794] | 1 | subroutine soil_settings_PEM(ngrid,nslope,nsoil_PEM,nsoil_GCM, |
---|
| 2 | & TI_GCM,TI_PEM) |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | ! use netcdf |
---|
| 6 | use comsoil_h_PEM, only: layer_PEM, mlayer_PEM |
---|
| 7 | use comsoil_h, only: inertiedat,layer,mlayer, volcapa |
---|
| 8 | use iostart, only: inquire_field_ndims, get_var, get_field, |
---|
| 9 | & inquire_field, inquire_dimension_length |
---|
| 10 | |
---|
| 11 | implicit none |
---|
| 12 | |
---|
| 13 | !====================================================================== |
---|
[2855] | 14 | ! Author: LL, based on work by Ehouarn Millour (07/2006) |
---|
[2794] | 15 | ! |
---|
| 16 | ! Purpose: Read and/or initialise soil depths and properties |
---|
| 17 | ! |
---|
| 18 | ! Modifications: Aug.2010 EM : use NetCDF90 to load variables (enables using |
---|
| 19 | ! r4 or r8 restarts independently of having compiled |
---|
| 20 | ! the GCM in r4 or r8) |
---|
| 21 | ! June 2013 TN : Possibility to read files with a time axis |
---|
| 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! The various actions and variable read/initialized are: |
---|
[2855] | 25 | ! 1. Read/build layer (and midlayer) depth |
---|
| 26 | ! 2. Interpolate thermal inertia and temperature on the new grid, if |
---|
[2794] | 27 | ! necessary |
---|
| 28 | !====================================================================== |
---|
| 29 | |
---|
| 30 | !====================================================================== |
---|
| 31 | ! arguments |
---|
| 32 | ! --------- |
---|
| 33 | ! inputs: |
---|
| 34 | integer,intent(in) :: ngrid ! # of horizontal grid points |
---|
| 35 | integer,intent(in) :: nslope ! # of subslope wihtin the mesh |
---|
| 36 | integer,intent(in) :: nsoil_PEM ! # of soil layers in the PEM |
---|
| 37 | integer,intent(in) :: nsoil_GCM ! # of soil layers in the GCM |
---|
[2855] | 38 | real,intent(in) :: TI_GCM(ngrid,nsoil_GCM,nslope) ! Thermal inertia in the GCM [SI] |
---|
| 39 | real,intent(inout) :: TI_PEM(ngrid,nsoil_PEM,nslope) ! Thermal inertia in the PEM [SI] |
---|
[2794] | 40 | |
---|
| 41 | !====================================================================== |
---|
| 42 | ! local variables: |
---|
| 43 | integer ig,iloop,islope ! loop counters |
---|
| 44 | logical found |
---|
| 45 | |
---|
| 46 | real alpha,lay1 ! coefficients for building layers |
---|
| 47 | real xmin,xmax ! to display min and max of a field |
---|
| 48 | |
---|
| 49 | !====================================================================== |
---|
| 50 | |
---|
| 51 | ! 1. Depth coordinate |
---|
| 52 | ! ------------------- |
---|
| 53 | |
---|
| 54 | ! 1.4 Build mlayer(), if necessary |
---|
| 55 | ! default mlayer distribution, following a power law: |
---|
| 56 | ! mlayer(k)=lay1*alpha**(k-1/2) |
---|
| 57 | lay1=2.e-4 |
---|
| 58 | alpha=2 |
---|
| 59 | do iloop=0,nsoil_PEM-1 |
---|
| 60 | mlayer_PEM(iloop)=lay1*(alpha**(iloop-0.5)) |
---|
| 61 | enddo |
---|
| 62 | |
---|
| 63 | ! 1.5 Build layer(); following the same law as mlayer() |
---|
| 64 | ! Assuming layer distribution follows mid-layer law: |
---|
| 65 | ! layer(k)=lay1*alpha**(k-1) |
---|
| 66 | lay1=sqrt(mlayer_PEM(0)*mlayer_PEM(1)) |
---|
| 67 | alpha=mlayer_PEM(1)/mlayer_PEM(0) |
---|
| 68 | do iloop=1,nsoil_PEM |
---|
| 69 | layer_PEM(iloop)=lay1*(alpha**(iloop-1)) |
---|
| 70 | enddo |
---|
| 71 | |
---|
| 72 | ! 2. Thermal inertia (note: it is declared in comsoil_h) |
---|
| 73 | ! ------------------ |
---|
| 74 | |
---|
| 75 | do ig = 1,ngrid |
---|
| 76 | do islope = 1,nslope |
---|
| 77 | do iloop = 1,nsoil_GCM |
---|
| 78 | TI_PEM(ig,iloop,islope) = TI_GCM(ig,iloop,islope) |
---|
| 79 | enddo |
---|
| 80 | if(nsoil_PEM.gt.nsoil_GCM) then |
---|
| 81 | do iloop = nsoil_GCM+1,nsoil_PEM |
---|
| 82 | TI_PEM(ig,iloop,islope) = TI_GCM(ig,nsoil_GCM,islope) |
---|
| 83 | enddo |
---|
| 84 | endif |
---|
| 85 | enddo |
---|
| 86 | enddo |
---|
[2835] | 87 | |
---|
[2794] | 88 | end subroutine soil_settings_PEM |
---|