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