source: trunk/LMDZ.COMMON/libf/evolution/frost.F90

Last change on this file was 4147, checked in by jbclement, 3 weeks ago

PEM:

  • Simplification of subroutines to convert data between the physical and the dynamical/lon-lat grids + making them more robust.
  • Correction for air mass to give back to the PCM. The variable is extensive so poles must be treated specifically.
  • Making the PEM able to do 0 year.
  • Explicit information about the frost values computed by the PEM + enforcing positivity of yearly minima.

JBC

File size: 5.9 KB
Line 
1MODULE frost
2!-----------------------------------------------------------------------
3! NAME
4!     frost
5!
6! DESCRIPTION
7!     Module for managing frost variables.
8!
9! AUTHORS & DATE
10!     JB Clement, 12/2025
11!
12! NOTES
13!
14!-----------------------------------------------------------------------
15
16! DEPENDENCIES
17! ------------
18use numerics, only: dp, di
19
20! DECLARATION
21! -----------
22implicit none
23
24! VARIABLES
25! ---------
26! Different types of frost retained by the PEM to give back to the PCM at the end
27real(dp), dimension(:,:), allocatable :: h2o_frost4PCM
28real(dp), dimension(:,:), allocatable :: co2_frost4PCM
29
30! PARAMETERS
31! ----------
32! Different types of frost in the PCM at the beginning [Pa]
33real(dp), dimension(:,:), allocatable, protected :: h2ofrost_PCM
34real(dp), dimension(:,:), allocatable, protected :: co2frost_PCM
35
36contains
37!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38
39!=======================================================================
40SUBROUTINE ini_frost()
41!-----------------------------------------------------------------------
42! NAME
43!     ini_frost
44!
45! DESCRIPTION
46!     Initialize the parameters of module 'frost'.
47!
48! AUTHORS & DATE
49!     JB Clement, 12/2025
50!
51! NOTES
52!
53!-----------------------------------------------------------------------
54
55! DEPENDENCIES
56! ------------
57use geometry, only: ngrid, nslope
58
59! DECLARATION
60! -----------
61implicit none
62
63! CODE
64! ----
65allocate(h2ofrost_PCM(ngrid,nslope))
66allocate(co2frost_PCM(ngrid,nslope))
67allocate(h2o_frost4PCM(ngrid,nslope))
68allocate(co2_frost4PCM(ngrid,nslope))
69h2ofrost_PCM(:,:) = 0._dp
70co2frost_PCM(:,:) = 0._dp
71h2o_frost4PCM(:,:) = 0._dp
72co2_frost4PCM(:,:) = 0._dp
73
74END SUBROUTINE ini_frost
75!=======================================================================
76
77!=======================================================================
78SUBROUTINE end_frost()
79!-----------------------------------------------------------------------
80! NAME
81!     end_frost
82!
83! DESCRIPTION
84!     Deallocate frost arrays.
85!
86! AUTHORS & DATE
87!     JB Clement, 12/2025
88!
89! NOTES
90!
91!-----------------------------------------------------------------------
92
93! DECLARATION
94! -----------
95implicit none
96
97! CODE
98! ----
99if (allocated(h2ofrost_PCM)) deallocate(h2ofrost_PCM)
100if (allocated(co2frost_PCM)) deallocate(co2frost_PCM)
101if (allocated(h2o_frost4PCM)) deallocate(h2o_frost4PCM)
102if (allocated(co2_frost4PCM)) deallocate(co2_frost4PCM)
103
104END SUBROUTINE end_frost
105!=======================================================================
106
107!=======================================================================
108SUBROUTINE set_h2ofrost_PCM(h2ofrost_PCM_in)
109!-----------------------------------------------------------------------
110! NAME
111!     set_h2ofrost_PCM
112!
113! DESCRIPTION
114!     Setter for 'h2ofrost_PCM'.
115!
116! AUTHORS & DATE
117!     JB Clement, 12/2025
118!
119! NOTES
120!
121!-----------------------------------------------------------------------
122
123! DECLARATION
124! -----------
125implicit none
126
127! ARGUMENTS
128! ---------
129real(dp), dimension(:,:), intent(in) :: h2ofrost_PCM_in
130
131! CODE
132! ----
133h2ofrost_PCM(:,:) = h2ofrost_PCM_in(:,:)
134
135END SUBROUTINE set_h2ofrost_PCM
136!=======================================================================
137
138!=======================================================================
139SUBROUTINE set_co2frost_PCM(co2frost_PCM_in)
140!-----------------------------------------------------------------------
141! NAME
142!     set_co2frost_PCM
143!
144! DESCRIPTION
145!     Setter for 'co2frost_PCM'.
146!
147! AUTHORS & DATE
148!     JB Clement, 12/2025
149!
150! NOTES
151!
152!-----------------------------------------------------------------------
153
154! DECLARATION
155! -----------
156implicit none
157
158! ARGUMENTS
159! ---------
160real(dp), dimension(:,:), intent(in) :: co2frost_PCM_in
161
162! CODE
163! ----
164co2frost_PCM(:,:) = co2frost_PCM_in(:,:)
165
166END SUBROUTINE set_co2frost_PCM
167!=======================================================================
168
169!=======================================================================
170SUBROUTINE compute_frost4PCM(minPCM_h2ofrost,minPCM_co2frost)
171!-----------------------------------------------------------------------
172! NAME
173!     compute_frost4PCM
174!
175! DESCRIPTION
176!     Compute the frost to give back to the PCM (metamorphism).
177!
178! AUTHORS & DATE
179!     JB Clement, 12/2025
180!
181! NOTES
182!     For the PEM, frost is the extra part of the PCM frost above the
183!     yearly minimum.
184!-----------------------------------------------------------------------
185
186! DEPENDENCIES
187! ------------
188use display, only: print_msg, LVL_NFO
189use utility, only: real2str
190
191! DECLARATION
192! -----------
193implicit none
194
195! ARGUMENTS
196! ---------
197real(dp), dimension(:,:), intent(in) :: minPCM_h2ofrost, minPCM_co2frost
198
199! CODE
200! ----
201call print_msg('> Computing frost to give back to the PCM (metamorphism)',LVL_NFO)
202
203h2o_frost4PCM(:,:) = 0._dp
204co2_frost4PCM(:,:) = 0._dp
205where (h2ofrost_PCM(:,:) > 0._dp) h2o_frost4PCM(:,:) = h2ofrost_PCM(:,:) - minPCM_h2ofrost(:,:)
206call print_msg('Yearly minimum of H2O frost [kg/m2] (min|max): '//real2str(minval(minPCM_h2ofrost))//' | '//real2str(maxval(minPCM_h2ofrost)),LVL_NFO)
207call print_msg('Raw input of H2O frost      [kg/m2] (min|max): '//real2str(minval(h2ofrost_PCM))//' | '//real2str(maxval(h2ofrost_PCM)),LVL_NFO)
208call print_msg('Residual H2O frost          [kg/m2] (min|max): '//real2str(minval(h2o_frost4PCM))//' | '//real2str(maxval(h2o_frost4PCM)),LVL_NFO)
209where (co2frost_PCM(:,:) > 0._dp) co2_frost4PCM(:,:) = co2frost_PCM(:,:) - minPCM_co2frost(:,:)
210call print_msg('Yearly minimum of CO2 frost [kg/m2] (min|max): '//real2str(minval(minPCM_co2frost))//' | '//real2str(maxval(minPCM_co2frost)),LVL_NFO)
211call print_msg('Raw input of CO2 frost      [kg/m2] (min|max): '//real2str(minval(co2frost_PCM))//' | '//real2str(maxval(co2frost_PCM)),LVL_NFO)
212call print_msg('Residual CO2 frost          [kg/m2] (min|max): '//real2str(minval(co2_frost4PCM))//' | '//real2str(maxval(co2_frost4PCM)),LVL_NFO)
213
214END SUBROUTINE compute_frost4PCM
215!=======================================================================
216
217END MODULE frost
Note: See TracBrowser for help on using the repository browser.