1 | MODULE comsoil_h |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | ! nsoilmx : number of subterranean layers |
---|
6 | integer, parameter :: nsoilmx = 57 |
---|
7 | |
---|
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) |
---|
15 | |
---|
16 | !$OMP THREADPRIVATE(layer,mlayer,inertiedat,inertiesoil,volcapa) |
---|
17 | |
---|
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 |
---|
28 | |
---|
29 | !$OMP THREADPRIVATE(tsoil,mthermdiff,thermdiff,coefq,coefd,alph,beta,mu,flux_geo) |
---|
30 | |
---|
31 | ! Subsurface tracers: |
---|
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) |
---|
34 | logical, save :: ads_const_D ! boolean to have constant diffusion coefficient |
---|
35 | logical, save :: ads_massive_ice ! boolean to have massive subsurface ice |
---|
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 |
---|
38 | integer, parameter :: igcm_h2o_vap_soil = 1 |
---|
39 | integer, parameter :: igcm_h2o_ice_soil = 2 |
---|
40 | integer, parameter :: igcm_h2o_vap_ads = 3 |
---|
41 | REAL, parameter :: porosity_reg = 0.45 |
---|
42 | !$OMP THREADPRIVATE(adsorption_soil,qsoil,choice_ads) |
---|
43 | !$OMP THREADPRIVATE(ads_const_D,ads_massive_ice) |
---|
44 | |
---|
45 | !======================================================================= |
---|
46 | contains |
---|
47 | !======================================================================= |
---|
48 | |
---|
49 | subroutine ini_comsoil_h(ngrid,nslope) |
---|
50 | |
---|
51 | implicit none |
---|
52 | |
---|
53 | integer,intent(in) :: ngrid ! number of atmospheric columns |
---|
54 | integer,intent(in) :: nslope ! number of sub grid slopes |
---|
55 | |
---|
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)) |
---|
69 | |
---|
70 | END SUBROUTINE ini_comsoil_h |
---|
71 | |
---|
72 | !======================================================================= |
---|
73 | SUBROUTINE end_comsoil_h |
---|
74 | |
---|
75 | implicit none |
---|
76 | |
---|
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) |
---|
90 | |
---|
91 | END SUBROUTINE end_comsoil_h |
---|
92 | |
---|
93 | !======================================================================= |
---|
94 | SUBROUTINE ini_comsoil_h_slope_var(ngrid,nslope) |
---|
95 | |
---|
96 | implicit none |
---|
97 | |
---|
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 |
---|