[3183] | 1 | MODULE comsoil_h |
---|
[1047] | 2 | |
---|
| 3 | implicit none |
---|
[3183] | 4 | |
---|
[1047] | 5 | ! nsoilmx : number of subterranean layers |
---|
[3183] | 6 | integer, parameter :: nsoilmx = 57 |
---|
[1047] | 7 | |
---|
[3183] | 8 | real, save, allocatable, dimension(:) :: layer ! soil layer depths |
---|
| 9 | real, save, allocatable, dimension(:) :: mlayer ! soil mid-layer depths |
---|
| 10 | real, save, allocatable, dimension(:,:) :: inertiedat ! soil thermal inertia for present climate |
---|
| 11 | real, save, allocatable, dimension(:,:,:) :: inertiesoil ! soil thermal inertia |
---|
| 12 | real, save :: volcapa ! soil volumetric heat capacity |
---|
| 13 | ! NB: volcapa is read from control(35) from physics start file |
---|
| 14 | ! in physdem (or set via tabfi, or initialized in soil_settings.F) |
---|
[1047] | 15 | |
---|
[2951] | 16 | !$OMP THREADPRIVATE(layer,mlayer,inertiedat,inertiesoil,volcapa) |
---|
[2578] | 17 | |
---|
[3183] | 18 | ! Variables (FC: built in firstcall in soil.F) |
---|
| 19 | real, save, allocatable, dimension(:,:,:) :: tsoil ! sub-surface temperatures (K) |
---|
| 20 | real, save, allocatable, dimension(:,:,:) :: mthermdiff ! (FC) mid-layer thermal diffusivity |
---|
| 21 | real, save, allocatable, dimension(:,:,:) :: thermdiff ! (FC) inter-layer thermal diffusivity |
---|
| 22 | real, save, allocatable, dimension(:) :: coefq ! (FC) q_{k+1/2} coefficients |
---|
| 23 | real, save, allocatable, dimension(:,:,:) :: coefd ! (FC) d_k coefficients |
---|
| 24 | real, save, allocatable, dimension(:,:,:) :: alph ! (FC) alpha_k coefficients |
---|
| 25 | real, save, allocatable, dimension(:,:,:) :: beta ! beta_k coefficients |
---|
| 26 | real, save, allocatable, dimension(:,:) :: flux_geo ! Geothermal Flux (W/m^2) |
---|
| 27 | real, save :: mu |
---|
[1224] | 28 | |
---|
[2887] | 29 | !$OMP THREADPRIVATE(tsoil,mthermdiff,thermdiff,coefq,coefd,alph,beta,mu,flux_geo) |
---|
[2578] | 30 | |
---|
[3183] | 31 | ! Subsurface tracers: |
---|
[3230] | 32 | logical, save :: adsorption_soil ! boolean to call adosrption (or not) |
---|
| 33 | real, save :: choice_ads ! Choice for adsorption isotherm (3 means no adsorption, see soilwater.F90) |
---|
[3272] | 34 | logical, save :: ads_const_D ! boolean to have constant diffusion coefficient |
---|
| 35 | logical, save :: ads_massive_ice ! boolean to have massive subsurface ice |
---|
[3230] | 36 | real, save, allocatable, dimension(:,:,:,:) :: qsoil ! subsurface tracers (kg/m^3 of regol) |
---|
| 37 | integer, parameter :: nqsoil = 3 ! number of subsurface tracers, only three when working with water |
---|
[3183] | 38 | integer, parameter :: igcm_h2o_vap_soil = 1 |
---|
| 39 | integer, parameter :: igcm_h2o_ice_soil = 2 |
---|
| 40 | integer, parameter :: igcm_h2o_vap_ads = 3 |
---|
[3230] | 41 | REAL, parameter :: porosity_reg = 0.45 |
---|
[3126] | 42 | !$OMP THREADPRIVATE(adsorption_soil,qsoil,choice_ads) |
---|
[3272] | 43 | !$OMP THREADPRIVATE(ads_const_D,ads_massive_ice) |
---|
[3113] | 44 | |
---|
[3183] | 45 | !======================================================================= |
---|
[1047] | 46 | contains |
---|
[3183] | 47 | !======================================================================= |
---|
[1047] | 48 | |
---|
[3183] | 49 | subroutine ini_comsoil_h(ngrid,nslope) |
---|
[1047] | 50 | |
---|
[3183] | 51 | implicit none |
---|
[1770] | 52 | |
---|
[3183] | 53 | integer,intent(in) :: ngrid ! number of atmospheric columns |
---|
| 54 | integer,intent(in) :: nslope ! number of sub grid slopes |
---|
[1770] | 55 | |
---|
[3183] | 56 | allocate(layer(nsoilmx)) !soil layer depths |
---|
| 57 | allocate(mlayer(0:nsoilmx - 1)) ! soil mid-layer depths |
---|
| 58 | allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia for present climate |
---|
| 59 | allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia |
---|
| 60 | allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures |
---|
| 61 | allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope)) |
---|
| 62 | allocate(thermdiff(ngrid,nsoilmx - 1,nslope)) |
---|
| 63 | allocate(coefq(0:nsoilmx - 1)) |
---|
| 64 | allocate(coefd(ngrid,nsoilmx - 1,nslope)) |
---|
| 65 | allocate(alph(ngrid,nsoilmx - 1,nslope)) |
---|
| 66 | allocate(beta(ngrid,nsoilmx - 1,nslope)) |
---|
| 67 | allocate(flux_geo(ngrid,nslope)) |
---|
| 68 | allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope)) |
---|
[1770] | 69 | |
---|
[3183] | 70 | END SUBROUTINE ini_comsoil_h |
---|
[1770] | 71 | |
---|
[3183] | 72 | !======================================================================= |
---|
| 73 | SUBROUTINE end_comsoil_h |
---|
[2909] | 74 | |
---|
[3183] | 75 | implicit none |
---|
[2909] | 76 | |
---|
[3183] | 77 | if (allocated(layer)) deallocate(layer) |
---|
| 78 | if (allocated(mlayer)) deallocate(mlayer) |
---|
| 79 | if (allocated(inertiedat)) deallocate(inertiedat) |
---|
| 80 | if (allocated(inertiesoil)) deallocate(inertiesoil) |
---|
| 81 | if (allocated(tsoil)) deallocate(tsoil) |
---|
| 82 | if (allocated(mthermdiff)) deallocate(mthermdiff) |
---|
| 83 | if (allocated(thermdiff)) deallocate(thermdiff) |
---|
| 84 | if (allocated(coefq)) deallocate(coefq) |
---|
| 85 | if (allocated(coefd)) deallocate(coefd) |
---|
| 86 | if (allocated(alph)) deallocate(alph) |
---|
| 87 | if (allocated(beta)) deallocate(beta) |
---|
| 88 | if (allocated(flux_geo)) deallocate(flux_geo) |
---|
| 89 | if (allocated(qsoil)) deallocate(qsoil) |
---|
[2909] | 90 | |
---|
[3183] | 91 | END SUBROUTINE end_comsoil_h |
---|
[2909] | 92 | |
---|
[3183] | 93 | !======================================================================= |
---|
| 94 | SUBROUTINE ini_comsoil_h_slope_var(ngrid,nslope) |
---|
[2909] | 95 | |
---|
[3183] | 96 | implicit none |
---|
[2909] | 97 | |
---|
[3183] | 98 | integer,intent(in) :: ngrid ! number of atmospheric columns |
---|
| 99 | integer,intent(in) :: nslope ! number of sub grid slopes |
---|
| 100 | |
---|
| 101 | allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures |
---|
| 102 | allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia |
---|
| 103 | allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope)) |
---|
| 104 | allocate(thermdiff(ngrid,nsoilmx - 1,nslope)) |
---|
| 105 | allocate(coefd(ngrid,nsoilmx - 1,nslope)) |
---|
| 106 | allocate(alph(ngrid,nsoilmx - 1,nslope)) |
---|
| 107 | allocate(beta(ngrid,nsoilmx - 1,nslope)) |
---|
| 108 | allocate(flux_geo(ngrid,nslope)) |
---|
| 109 | allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope)) |
---|
| 110 | |
---|
| 111 | END SUBROUTINE ini_comsoil_h_slope_var |
---|
| 112 | |
---|
| 113 | !======================================================================= |
---|
| 114 | SUBROUTINE end_comsoil_h_slope_var |
---|
| 115 | |
---|
| 116 | implicit none |
---|
| 117 | |
---|
| 118 | if (allocated(tsoil)) deallocate(tsoil) |
---|
| 119 | if (allocated(inertiesoil)) deallocate(inertiesoil) |
---|
| 120 | if (allocated(mthermdiff)) deallocate(mthermdiff) |
---|
| 121 | if (allocated(thermdiff)) deallocate(thermdiff) |
---|
| 122 | if (allocated(coefd)) deallocate(coefd) |
---|
| 123 | if (allocated(alph)) deallocate(alph) |
---|
| 124 | if (allocated(beta)) deallocate(beta) |
---|
| 125 | if (allocated(flux_geo)) deallocate(flux_geo) |
---|
| 126 | if (allocated(qsoil)) deallocate(qsoil) |
---|
| 127 | |
---|
| 128 | END SUBROUTINE end_comsoil_h_slope_var |
---|
| 129 | |
---|
| 130 | END MODULE comsoil_h |
---|