source: trunk/LMDZ.COMMON/libf/evolution/criterion_pem_stop_mod.F90 @ 3093

Last change on this file since 3093 was 3050, checked in by jbclement, 14 months ago

Mars PEM:
Minor changes concerning the form of the code in the PEM.
JBC

File size: 5.9 KB
Line 
1  module criterion_pem_stop_mod
2  implicit none
3
4  contains
5
6
7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8!!!
9!!! Purpose: Criterions to check if the PEM needs to call the GCM !!!
10!!! Author: RV & LL, 02/2023
11!!!
12!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13
14
15SUBROUTINE criterion_waterice_stop(cell_area,ini_surf,qsurf,STOPPING,ngrid,initial_h2o_ice)
16
17  use time_evol_mod, only: water_ice_criterion
18  use comslope_mod,  only: subslope_dist,nslope
19
20      IMPLICIT NONE
21
22!=======================================================================
23!
24!  Routine that checks if the water ice criterion to stop the PEM is reached
25!
26!=======================================================================
27
28!   arguments:
29!   ----------
30
31!   INPUT
32  INTEGER, intent(in) :: ngrid                         ! # of grid physical grid points
33  REAL,    intent(in) :: cell_area(ngrid)              ! physical point field : Area of the cells
34  REAL,    intent(in) :: qsurf(ngrid,nslope)           ! physical point field : Actual density of water ice
35  REAL,    intent(in) :: ini_surf                      ! Initial surface of h2o ice that was sublimating
36  REAL,    intent(in) :: initial_h2o_ice(ngrid,nslope) ! Grid point that initialy were covered by h2o_ice
37
38!   OUTPUT
39  LOGICAL, intent(out) :: STOPPING              ! Logical : is the criterion reached?
40
41!   local:
42!   -----
43  INTEGER :: i,islope   ! Loop
44  REAL :: present_surf  ! Initial/Actual surface of water ice
45
46!=======================================================================
47
48!   initialisation to false
49    STOPPING=.FALSE.
50
51!   computation of the present surface of water ice sublimating
52  present_surf=0.
53  do i=1,ngrid
54    do islope=1, nslope
55      if (initial_h2o_ice(i,islope).GT.0.5 .and. qsurf(i,islope).GT.0.) then
56         present_surf=present_surf+cell_area(i)*subslope_dist(i,islope)
57      endif
58    enddo
59  enddo
60 
61!   check of the criterion
62  if(present_surf.LT.ini_surf*(1-water_ice_criterion) .OR. &
63     present_surf.GT.ini_surf*(1+water_ice_criterion)) then
64    STOPPING=.TRUE.
65    write(*,*) "Reason of stopping : The surface of water ice sublimating reach the threshold:"
66    write(*,*) "Current surface of water ice sublimating=", present_surf
67    write(*,*) "Initial surface of water ice sublimating=", ini_surf
68    write(*,*) "Percentage of change accepted=", water_ice_criterion*100
69    write(*,*) "present_surf<ini_surf*(1-water_ice_criterion)", (present_surf.LT.ini_surf*(1-water_ice_criterion))
70  endif
71
72  if (ini_surf.LT. 1E-5 .and. ini_surf.GT. -1E-5) then
73    STOPPING=.FALSE.
74  endif
75END SUBROUTINE criterion_waterice_stop
76
77! ------------------------------------------------------------------------------------------------
78
79SUBROUTINE criterion_co2_stop(cell_area,ini_surf,qsurf,STOPPING_ice,STOPPING_ps,ngrid,initial_co2_ice,global_ave_press_GCM,global_ave_press_new,nslope)
80
81  use time_evol_mod, only: co2_ice_criterion,ps_criterion
82  use comslope_mod,  only: subslope_dist
83
84      IMPLICIT NONE
85
86!=======================================================================
87!
88!  Routine that checks if the criterion to stop the PEM is reached
89!
90!=======================================================================
91
92!   arguments:
93!   ----------
94
95!   INPUT
96  INTEGER, intent(in) :: ngrid,nslope                  ! # of grid physical grid points
97  REAL,    intent(in) :: cell_area(ngrid)              ! physical point field : Area of the cells
98  REAL,    intent(in) ::  qsurf(ngrid,nslope)          ! physical point field : Actual density of water ice
99  REAL,    intent(in) :: ini_surf                      ! Initial surface of co2 ice that was sublimating
100  REAL,    intent(in) :: initial_co2_ice(ngrid,nslope) ! Grid point that initialy were covered by co2_ice
101  REAL,    intent(in) :: global_ave_press_GCM          ! Planet average pressure from the GCM start files
102  REAL,    intent(in) :: global_ave_press_new          ! Planet average pressure from the PEM computations
103
104!   OUTPUT
105  LOGICAL, intent(out) :: STOPPING_ice              ! Logical : is the criterion for ice reached?
106  LOGICAL, intent(out) :: STOPPING_ps               ! Logical : is the criterion for pressure reached ?
107!   local:
108!   -----
109  INTEGER :: i,islope   ! Loop
110  REAL :: present_surf  ! Initial/Actual surface of water ice
111
112!=======================================================================
113
114!   initialisation to false
115    STOPPING_ice=.FALSE.
116    STOPPING_ps =.FALSE.
117!   computation of the actual surface
118  present_surf=0.
119  do i=1,ngrid
120   do islope=1,nslope
121      if (initial_co2_ice(i,islope).GT.0.5 .and. qsurf(i,islope).GT.0.) then
122         present_surf=present_surf+cell_area(i)*subslope_dist(i,islope)
123      endif
124   enddo
125  enddo
126 
127!   check of the criterion
128  if(present_surf.LT.ini_surf*(1-co2_ice_criterion) .OR. &
129     present_surf.GT.ini_surf*(1+co2_ice_criterion)) then
130    STOPPING_ice=.TRUE.
131    write(*,*) "Reason of stopping : The surface of co2 ice sublimating reach the threshold:"
132    write(*,*) "Current surface of co2 ice sublimating=", present_surf
133    write(*,*) "Initial surface of co2 ice sublimating=", ini_surf
134    write(*,*) "Percentage of change accepted=", co2_ice_criterion*100
135    write(*,*) "present_surf<ini_surf*(1-co2_ice_criterion)", (present_surf.LT.ini_surf*(1-co2_ice_criterion))
136  endif
137
138  if (ini_surf.LT. 1E-5 .and. ini_surf.GT. -1E-5) then
139       STOPPING_ice=.FALSE.
140  endif
141
142  if(global_ave_press_new.LT.global_ave_press_GCM*(1-ps_criterion) .OR. &
143     global_ave_press_new.GT.global_ave_press_GCM*(1+ps_criterion)) then
144    STOPPING_ps=.TRUE.
145    write(*,*) "Reason of stopping : The global pressure reach the threshold:"
146    write(*,*) "Current global pressure=", global_ave_press_new
147    write(*,*) "GCM global pressure=", global_ave_press_GCM
148    write(*,*) "Percentage of change accepted=", ps_criterion*100
149    write(*,*) "global_ave_press_new<global_ave_press_GCM*(ps_criterion)", (global_ave_press_new.LT.global_ave_press_GCM*(1-ps_criterion))
150  endif
151
152END SUBROUTINE criterion_co2_stop
153
154
155END MODULE
Note: See TracBrowser for help on using the repository browser.