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

Last change on this file since 4076 was 4074, checked in by jbclement, 11 days ago

PEM:

  • Correct management of H2O ice tendency in 1D when there is not enough ice anymore.
  • Clean initialization of allocatable module arrays (especially needed when no slope)
  • One more renaming for consistency + few small updates thoughout the code.

JBC

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