Changeset 2835
- Timestamp:
- Nov 30, 2022, 11:29:29 AM (2 years ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 3 added
- 4 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/ComputeCO2Adsorption.F90
r2794 r2835 16 16 REAL,INTENT(INOUT) :: m_co2_completesoil(ngrid,nsoil_PEM,nslope) 17 17 REAL,INTENT(INOUT) :: delta_mreg(ngrid) 18 19 20 18 21 19 ! Constants: … … 71 69 enddo 72 70 73 74 71 ! 2. Check the exchange between the atmosphere and the regolith 75 72 -
trunk/LMDZ.COMMON/libf/evolution/adsorption_mod.F90
r2794 r2835 3 3 contains 4 4 5 6 7 5 subroutine regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen, ps,q_co2,q_h2o,tsoil_PEM,TI_PEM, theta_h2o_adsorbded,m_h2o_adsorbed) 8 6 … … 11 9 12 10 implicit none 13 14 11 15 12 INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM,timelen ! size dimension … … 20 17 REAL,INTENT(IN) :: tsoil_PEM(ngrid,nsoil_PEM,nslope) ! Soil temperature (K) 21 18 22 23 19 ! output 24 20 REAL,INTENT(OUT) :: m_h2o_adsorbed(ngrid,nsoil_PEM,nslope) ! Density of h2o adsorbed (kg/m^3) 25 21 REAL,INTENT(OUT) :: theta_h2o_adsorbded(ngrid,nsoil_PEM,nslope) ! Fraction of the pores occupied by H2O molecules 26 27 22 28 23 ! constant … … 40 35 real :: as = 18.9e3 ! Specific area, Buhler & Piqueux 2021 41 36 42 43 44 45 46 37 ! local variable 47 38 real :: A,B ! Used to compute the mean mass above the surface … … 54 45 real, allocatable :: pvapor_avg(:) ! yearly average vapor pressure above the surface 55 46 56 57 58 47 ! 0. Some initializations 59 48 60 61 62 49 allocate(mass_mean(ngrid,timelen)) 63 50 allocate(zplev_mean(ngrid,timelen)) … … 77 64 enddo 78 65 79 80 66 ! b. pressure level 81 67 do it = 1,timelen … … 92 78 deallocate(zplev_mean) 93 79 deallocate(mass_mean) 94 95 96 97 98 80 99 81 ! 2. we compute the mass of co2 adsorded in each layer of the meshes … … 110 92 theta_h2o_adsorbded(ig,iloop,islope) = (K*p_sat/(1+K*p_sat))**mu 111 93 m_h2o_adsorbed(ig,iloop,islope) =as*theta_h2o_adsorbded(ig,iloop,islope)*mi*rho_regolith 112 endif 113 94 endif 114 95 enddo 115 96 enddo … … 118 99 RETURN 119 100 end subroutine 120 121 101 122 102 SUBROUTINE regolith_co2adsorption(ngrid,nslope,nsoil_PEM,timelen,ps,tsoil_PEM,TI_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,q_co2,q_h2o,m_co2_completesoil,delta_mreg) … … 140 120 REAL,INTENT(INOUT) :: m_co2_completesoil(ngrid,nsoil_PEM,nslope) ! Density of co2 adsorbed (kg/m^3) 141 121 REAL,INTENT(INOUT) :: delta_mreg(ngrid) ! Difference density of co2 adsorbed (kg/m^3) 142 143 144 122 145 123 ! Constants: … … 170 148 real, allocatable :: pco2_avg(:) ! yearly averaged 171 149 172 173 174 150 ! 0. Some initializations 175 176 177 151 178 152 allocate(mass_mean(ngrid,timelen)) … … 188 162 delta_mreg(:) = 0. 189 163 190 191 192 164 !0.1 Look at perenial ice 193 165 do ig = 1,ngrid … … 207 179 enddo 208 180 209 210 181 ! 0.2 Compute the partial pressure of CO2 211 182 !a. the molecular mass into the column … … 213 184 mass_mean(ig,:) = 1/(A*q_co2(ig,:) +B) 214 185 enddo 215 216 186 217 187 ! b. pressure level … … 226 196 pco2_avg(:) = sum(pco2(:,:),2)/timelen 227 197 228 229 198 deallocate(zplev_mean) 230 199 deallocate(mass_mean) … … 234 203 ! 1. Compute the fraction of the pores occupied by H2O 235 204 call regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen, ps,q_co2,q_h2o,tsoil_PEM,TI_PEM,theta_h2o_adsorbed, m_h2o_adsorbed) 236 237 238 205 239 206 ! 2. we compute the mass of co2 adsorded in each layer of the meshes … … 256 223 enddo 257 224 enddo 258 259 225 260 226 ! 2. Check the exchange between the atmosphere and the regolith … … 278 244 m_co2_completesoil(:,:,:) = dm_co2_regolith_slope(:,:,:) 279 245 280 281 246 !======================================================================= 282 247 RETURN -
trunk/LMDZ.COMMON/libf/evolution/compute_tendencies_mod.F90
r2779 r2835 47 47 ENDDO 48 48 49 50 49 ! We reorganise the difference on the physical grid 51 50 tendencies_h2o_ice_phys(1)=tendencies_h2o_ice(1,1) … … 61 60 tendencies_h2o_ice_phys(ig0) = tendencies_h2o_ice(1,jjm_input+1) 62 61 63 64 62 END SUBROUTINE compute_tendencies 65 63 -
trunk/LMDZ.COMMON/libf/evolution/compute_tendencies_mod_slope.F90
r2794 r2835 6 6 7 7 IMPLICIT NONE 8 9 8 10 9 !======================================================================= … … 34 33 !======================================================================= 35 34 36 37 35 ! We compute the difference 38 ! tendencies_h2o_ice(:,:,:)=min_h2o_ice_Y2(:,:,:)-min_h2o_ice_Y1(:,:,:)39 36 40 37 DO j=1,jjm_input+1 … … 46 43 ENDDO 47 44 48 print *, "jjm_input+1", jjm_input+149 print *, "iim_input+1", iim_input+150 print *, "nslope+1", nslope+151 52 45 ! If the difference is too small; there is no evolution 53 46 DO j=1,jjm_input+1 54 47 DO i = 1, iim_input 55 48 DO islope = 1, nslope 56 ! print *, "tendencies_h2o_ice(i,j,islope)LAAA", tendencies_h2o_ice(i,j,islope)57 49 if(abs(tendencies_h2o_ice(i,j,islope)).LT.1.0E-10) then 58 50 tendencies_h2o_ice(i,j,islope)=0. 59 51 endif 60 ! print *, "tendencies_h2o_ice(i,j,islope)HERE", tendencies_h2o_ice(i,j,islope)61 52 enddo 62 53 ENDDO 63 54 ENDDO 64 55 65 66 ! We reorganise the difference on the physical grid 67 tendencies_h2o_ice_phys(1,:)=tendencies_h2o_ice(1,1,:) 68 69 ig0 = 2 70 DO j=2,jjm_input 71 DO i = 1, iim_input 72 tendencies_h2o_ice_phys(ig0,:) =tendencies_h2o_ice(i,j,:) 73 ig0= ig0 + 1 74 ENDDO 56 DO islope = 1,nslope 57 CALL gr_dyn_fi(1,iim_input+1,jjm_input+1,ngrid,tendencies_h2o_ice(:,:,islope),tendencies_h2o_ice_phys(:,islope)) 75 58 ENDDO 76 77 tendencies_h2o_ice_phys(ig0,:) = tendencies_h2o_ice(1,jjm_input+1,:)78 79 ! print *, "tendencies_h2o_ice_physze", tendencies_h2o_ice_phys(:,:)80 81 59 82 60 END SUBROUTINE compute_tendencies_slope 83 61 84 85 86 87 -
trunk/LMDZ.COMMON/libf/evolution/computeice_table.F90
r2794 r2835 4 4 USE comsoil_h_PEM, only: layer_PEM 5 5 implicit none 6 7 6 8 7 integer,intent(in) :: timelen,ngrid,nslope,nsoil_PEM,nsoil_GCM … … 14 13 real,intent(out) :: ice_table(ngrid,nslope) ! ice table [m] 15 14 16 17 15 real :: m_h2o = 18.01528E-3 18 16 real :: m_co2 = 44.01E-3 … … 21 19 real :: alpha = -6143.7 22 20 real :: beta = 29.9074 23 24 21 25 22 integer ig, islope,isoil,it … … 37 34 real,allocatable :: diff_rho(:,:,:) ! difference of vapor content 38 35 39 40 41 36 allocate(rhovapor(ngrid,nslope,timelen)) 42 37 allocate(rhovapor_avg(ngrid,nslope)) … … 45 40 allocate(mass_mean(ngrid,timelen)) 46 41 allocate(zplev_mean(ngrid,timelen)) 47 48 49 50 42 51 43 ! 0. Some initializations … … 60 52 mass_mean(ig,:) = 1/(A*q_co2(ig,:) +B) 61 53 enddo 62 63 54 64 55 ! b. pressure level … … 91 82 deallocate(pvapor) 92 83 93 94 95 96 84 ! 1.3 Density at the surface yearly averaged 97 85 rhovapor_avg(:,:) = SUM(rhovapor(:,:,:),3)/timelen 98 86 99 100 87 deallocate(rhovapor) 101 102 103 104 88 105 89 ! 2. Compute rho soil vapor … … 118 102 enddo 119 103 120 121 122 104 rho_soil_avg(:,:,:) = SUM( rho_soil(:,:,:,:),4)/timelen 123 105 deallocate(rho_soil) 124 125 126 106 127 107 ! 3. Computing ice table … … 132 112 133 113 do isoil = 1,nsoil_PEM 134 135 136 diff_rho(:,:,isoil) = rhovapor_avg(:,:) - rho_soil_avg(:,:,isoil) 137 ! write(*,*) 'diff =',ig,islope,isoil,diff_rho(ig,islope,isoil),rhovapor_avg(ig,islope) ,rho_soil_avg(ig,islope,isoil) 114 diff_rho(:,:,isoil) = rhovapor_avg(:,:) - rho_soil_avg(:,:,isoil) 115 ! write(*,*) 'diff =',ig,islope,isoil,diff_rho(ig,islope,isoil),rhovapor_avg(ig,islope) ,rho_soil_avg(ig,islope,isoil) 138 116 enddo 139 117 140 141 118 deallocate(rhovapor_avg) 142 deallocate(rho_soil_avg) 143 144 145 146 147 148 119 deallocate(rho_soil_avg) 149 120 150 121 do ig = 1,ngrid … … 164 135 enddo 165 136 enddo 166 167 137 168 138 deallocate(diff_rho) 169 170 171 172 173 174 139 175 140 !======================================================================= … … 177 142 178 143 179 180 181 182 144 END -
trunk/LMDZ.COMMON/libf/evolution/criterion_co2_ice_stop_mod.F90
r2794 r2835 23 23 REAL, intent(in) :: latitude(ngrid) ! physical point field : Latitude 24 24 REAL, intent(in) :: initial_co2_ice(n_band_lat) ! Initial/Actual surface of water ice 25 26 27 25 28 26 ! OUTPUT … … 59 57 present_co2(j).GT.initial_co2_ice(j)*(1+alpha_criterion)) then 60 58 STOPPING=.TRUE. 61 print *, "j", j62 print *, "present_co2(j)", present_co2(j)63 print *, "initial_co2_ice(j)", initial_co2_ice(j)64 59 endif 65 60 enddo -
trunk/LMDZ.COMMON/libf/evolution/criterion_ice_stop_mod_slope.F90
r2794 r2835 20 20 ! INPUT 21 21 INTEGER, intent(in) :: ngrid,nslope ! # of grid physical grid points 22 REAL, intent(in) :: cell_area(ngrid) ! physical point field : Area of the cells22 REAL, intent(in) :: cell_area(ngrid) ! physical point field : Area of the cells 23 23 REAL, intent(in) :: qsurf(ngrid,nslope) ! physical point field : Actual density of water ice 24 24 REAL, intent(in) :: ini_surf … … 27 27 REAL, intent(in) :: global_ave_press_new 28 28 29 30 29 ! OUTPUT 31 30 LOGICAL, intent(out) :: STOPPING ! Logical : is the criterion reached? … … 33 32 ! local: 34 33 ! ----- 35 INTEGER :: i,islope 34 INTEGER :: i,islope ! Loop 36 35 REAL :: present_surf ! Initial/Actual surface of water ice 37 36 … … 46 45 do islope=1,nslope 47 46 if (initial_h2o_ice(i,islope).GT.0.5 .and. qsurf(i,islope).GT.0.) then 48 print *, "i", i49 print *, "initial_h2o_ice(i,islope)", initial_h2o_ice(i,islope)50 print *, "qsurf(i,:)", qsurf(i,:)51 print *, "cell_area(i)", cell_area(i)52 print *, "present_surf",present_surf53 47 present_surf=present_surf+cell_area(i)*subslope_dist(i,islope) 54 48 endif 55 49 enddo 56 50 enddo 57 58 ! print *, "initial_h2o_ice", initial_h2o_ice59 ! print *, "qsurf", qsurf60 61 print *, "present_surf", present_surf62 print *, "ini_surf", ini_surf63 print *, "ini_surf*0.8", ini_surf*(1-alpha_criterion)64 51 65 52 ! check of the criterion 66 53 if(present_surf.LT.ini_surf*(1-alpha_criterion) .OR. & 67 54 present_surf.GT.ini_surf*(1+alpha_criterion)) then 68 STOPPING=.TRUE. 55 STOPPING=.TRUE. 56 print *, "Reason of stopping : The surface of co2 ice sublimating reach the threshold:" 57 print *, "Current surface of co2 ice sublimating=", present_surf 58 print *, "Initial surface of co2 ice sublimating=", ini_surf 59 print *, "Percentage of change accepted=", alpha_criterion*100 60 print *, "present_surf<ini_surf*(1-alpha_criterion)", (present_surf.LT.ini_surf*(1-alpha_criterion)) 69 61 endif 70 62 … … 73 65 endif 74 66 75 ! if(global_ave_press_GCM.LT.global_ave_press_new*(1-alpha_criterion) .OR. &76 ! global_ave_press_GCM.GT.global_ave_press_new*(1+alpha_criterion)) then77 ! STOPPING=.TRUE.78 ! endif79 80 67 if(global_ave_press_new.LT.global_ave_press_GCM*(0.9) .OR. & 81 68 global_ave_press_new.GT.global_ave_press_GCM*(1.1)) then 82 STOPPING=.TRUE. 69 STOPPING=.TRUE. 70 print *, "Reason of stopping : The global pressure reach the threshold:" 71 print *, "Current global pressure=", global_ave_press_new 72 print *, "GCM global pressure=", global_ave_press_GCM 73 print *, "Percentage of change accepted=", 0.1*100 74 print *, "global_ave_press_new<global_ave_press_GCM*(0.9)", (global_ave_press_new.LT.global_ave_press_GCM*(0.9)) 83 75 endif 84 76 … … 86 78 87 79 88 89 90 -
trunk/LMDZ.COMMON/libf/evolution/criterion_ice_stop_mod_water_slope.F90
r2794 r2835 25 25 REAL, intent(in) :: initial_h2o_ice(ngrid,nslope) 26 26 27 28 27 ! OUTPUT 29 28 LOGICAL, intent(out) :: STOPPING ! Logical : is the criterion reached? … … 39 38 STOPPING=.FALSE. 40 39 41 ! computation of the actual surface40 ! computation of the present surface of water ice sublimating 42 41 present_surf=0. 43 42 do i=1,ngrid 44 43 do islope=1, nslope 45 44 if (initial_h2o_ice(i,islope).GT.0.5 .and. qsurf(i,islope).GT.0.) then 46 ! print *, "i", i47 ! print *, "initial_h2o_ice(i,islope)", initial_h2o_ice(i,islope)48 ! print *, "qsurf(i,islope)", qsurf(i,islope)49 ! print *, "cell_area(i)", cell_area(i)50 ! print *, "present_surf",present_surf51 45 present_surf=present_surf+cell_area(i)*subslope_dist(i,islope) 52 46 endif 53 47 enddo 54 48 enddo 55 56 ! print *, "initial_h2o_ice", initial_h2o_ice57 ! print *, "qsurf", qsurf58 59 ! print *, "present_surf", present_surf60 ! print *, "ini_surf", ini_surf61 ! print *, "ini_surf*0.8", ini_surf*(1-alpha_criterion)62 49 63 50 ! check of the criterion 64 51 if(present_surf.LT.ini_surf*(1-alpha_criterion) .OR. & 65 52 present_surf.GT.ini_surf*(1+alpha_criterion)) then 66 STOPPING=.TRUE. 53 STOPPING=.TRUE. 54 print *, "Reason of stopping : The surface of water ice sublimating reach the threshold:" 55 print *, "Current surface of water ice sublimating=", present_surf 56 print *, "Initial surface of water ice sublimating=", ini_surf 57 print *, "Percentage of change accepted=", alpha_criterion*100 58 print *, "present_surf<ini_surf*(1-alpha_criterion)", (present_surf.LT.ini_surf*(1-alpha_criterion)) 67 59 endif 68 60 69 61 if (ini_surf.LT. 1E-5 .and. ini_surf.GT. -1E-5) then 70 62 STOPPING=.FALSE. 71 63 endif 72 64 -
trunk/LMDZ.COMMON/libf/evolution/evol_co2_ice_s_mod_slope.F90
r2794 r2835 21 21 22 22 INTEGER, intent(in) :: iim_input,jjm_input, ngrid,nslope ! # of grid points along longitude/latitude/ total 23 ! REAL, intent(in) :: tendencies_h2o_ice_phys(ngrid) ! physical point field : Evolution of perenial ice over one year24 23 REAL, intent(in) :: cell_area(ngrid) 25 24 … … 28 27 LOGICAL :: STOPPING 29 28 REAL, intent(inout) :: tendencies_co2_ice_phys(ngrid,nslope) ! physical point field : Evolution of perenial ice over one year 30 31 29 32 30 ! local: -
trunk/LMDZ.COMMON/libf/evolution/evol_h2o_ice_s_mod_slope.F90
r2794 r2835 6 6 7 7 USE temps_mod_evol, ONLY: dt_pem 8 8 use comslope_mod, ONLY: subslope_dist 9 9 10 10 IMPLICIT NONE … … 22 22 23 23 INTEGER, intent(in) :: iim_input,jjm_input, ngrid,nslope ! # of grid points along longitude/latitude/ total 24 ! REAL, intent(in) :: tendencies_h2o_ice_phys(ngrid) ! physical point field : Evolution of perenial ice over one year25 24 REAL, intent(in) :: cell_area(ngrid) 26 25 … … 30 29 REAL, intent(inout) :: tendencies_h2o_ice_phys(ngrid,nslope) ! physical point field : Evolution of perenial ice over one year 31 30 32 33 31 ! local: 34 32 ! ---- 35 33 36 34 INTEGER :: i,j,ig0,islope ! loop variable 37 ! REAL :: not_budget, budget38 35 REAL :: pos_tend, neg_tend, real_coefficient,negative_part 39 36 REAL :: new_tendencies(ngrid,nslope) 40 37 41 42 38 !======================================================================= 43 44 ! budget=sum(qsurf(:))45 39 46 40 pos_tend=0. … … 59 53 enddo 60 54 61 ! print *, "pos_tend", pos_tend62 ! print *, "neg_tend", neg_tend63 64 55 if(neg_tend.GT.pos_tend .and. pos_tend.GT.0) then 65 56 do i=1,ngrid 66 57 do islope=1,nslope 67 58 if(tendencies_h2o_ice_phys(i,islope).LT.0) then 68 ! print *, "pos_tend/neg_tend", pos_tend/neg_tend69 59 new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)*(pos_tend/neg_tend) 70 60 else … … 74 64 enddo 75 65 elseif(neg_tend.LT.pos_tend .and. neg_tend.GT.0) then 76 ! print *, "neg_tend/pos_tend", neg_tend/pos_tend77 66 do i=1,ngrid 78 67 do islope=1,nslope … … 85 74 enddo 86 75 elseif(pos_tend.EQ.0 .OR. neg_tend.EQ.0) then 87 88 ! call criterion_ice_stop(cell_area,1,qsurf*0.,STOPPING,ngrid,cell_area) 76 print *, "Reason of stopping : There is either no water ice sublimating or no water ice increasing !!" 77 print *, "Tendencies on ice sublimating=", neg_tend 78 print *, "Tendencies on ice increasing=", pos_tend 79 print *, "This can be due to the absence of water ice in the PCM run!!" 89 80 call criterion_ice_stop_water_slope(cell_area,1,qsurf(:,:)*0.,STOPPING,ngrid,cell_area) 90 81 do i=1,ngrid … … 95 86 endif 96 87 97 98 99 88 negative_part = 0. 100 101 89 102 90 ! Evolution of the water ice for each physical point 103 91 do i=1,ngrid 104 92 do islope=1, nslope 105 ! qsurf(i)=qsurf(i)+tendencies_h2o_ice_phys(i)*dt_pem106 93 qsurf(i,islope)=qsurf(i,islope)+new_tendencies(i,islope)*dt_pem 107 ! budget=budget+tendencies_h2o_ice_phys(i)*dt_pem108 94 if (qsurf(i,islope).lt.0) then 109 ! not_budget=not_budget+qsurf(i)110 ! print *, "NNqsurf(i,islope)", qsurf(i,islope)111 ! print *, "NNnew_tendencies(i,islope)", new_tendencies(i,islope)112 ! print *, "NNtendencies_h2o_ice_phys(i,islope)", tendencies_h2o_ice_phys(i,islope)113 95 negative_part=negative_part-qsurf(i,islope)*cell_area(i)*subslope_dist(i,islope) 114 96 qsurf(i,islope)=0. 115 97 tendencies_h2o_ice_phys(i,islope)=0. 116 ! print *, "NNineg", i117 endif118 if(qsurf(i,islope).NE.qsurf(i,islope)) then119 ! print *, "qsurf(i,islope)",qsurf(i,islope)120 ! print *, "new_tendencies",new_tendencies(i,islope)121 ! print *, "tendencies_h2o_ice_phys",tendencies_h2o_ice_phys(i,islope)122 ! print *, "i", i123 ! print *,"islope",islope124 98 endif 125 99 enddo 126 100 enddo 127 101 128 ! print *, "negative_part", negative_part129 102 real_coefficient=negative_part/pos_tend 130 ! print *, "real_coefficient", real_coefficient131 103 132 104 do i=1,ngrid … … 140 112 141 113 142 ! Conservation of water ice143 ! qsurf(:)=qsurf(:)*budget/sum(qsurf(:))144 145 146 114 END SUBROUTINE evol_h2o_ice_s_slope -
trunk/LMDZ.COMMON/libf/evolution/ini_soil_mod.F90
r2794 r2835 1 1 MODULE ini_soil_mod 2 3 2 4 3 IMPLICIT NONE … … 6 5 CONTAINS 7 6 8 9 7 subroutine ini_icetable(timelen,ngrid,nsoil_PEM, & 10 8 therm_i, timestep,tsurf_ave,tsoil_ave,tsurf_inst, tsoil_inst,q_co2,q_h2o,ps,ice_table) 11 12 13 9 14 10 use vertical_layers_mod, only: ap,bp … … 28 24 29 25 #include "dimensions.h" 30 !#include "dimphys.h"31 32 !#include"comsoil.h"33 34 26 35 27 !----------------------------------------------------------------------- … … 41 33 integer,intent(in) :: nsoil_PEM ! number of soil layers in the PEM 42 34 43 44 35 real,intent(in) :: timestep ! time step 45 36 real,intent(in) :: tsurf_ave(ngrid) ! surface temperature … … 49 40 real,intent(in) :: ps(ngrid,timelen) ! surface pressure [Pa] 50 41 real,intent(in) :: tsurf_inst(ngrid,timelen) ! soil (mid-layer) temperature 51 52 42 53 43 ! outputs: … … 57 47 real,intent(inout) :: therm_i(ngrid,nsoil_PEM) ! thermal inertia 58 48 59 60 61 49 ! local variables: 62 50 integer ig,isoil,it,k,iref … … 99 87 real,allocatable :: diff_rho(:) ! difference of vapor content 100 88 101 102 A =(1/m_co2 - 1/m_noco2) 103 B=1/m_noco2 104 105 106 ice_table(:) = 1. 107 do ig = 1,ngrid 108 109 error_depth = 1. 110 countloop = 0 111 112 113 114 do while(( error_depth.gt.tol_error).and.(countloop.lt.countmax).and.(ice_table(ig).gt.-1e-20)) 115 116 countloop = countloop +1 117 Tcol_saved(:) = tsoil_ave(ig,:) 89 A =(1/m_co2 - 1/m_noco2) 90 B=1/m_noco2 91 92 ice_table(:) = 1. 93 do ig = 1,ngrid 94 error_depth = 1. 95 countloop = 0 96 97 do while(( error_depth.gt.tol_error).and.(countloop.lt.countmax).and.(ice_table(ig).gt.-1e-20)) 98 99 countloop = countloop +1 100 Tcol_saved(:) = tsoil_ave(ig,:) 118 101 119 102 !2. Compute ice table 120 103 121 104 ! 2.1 Compute water density at the surface, yearly averaged 122 allocate(mass_mean(timelen))105 allocate(mass_mean(timelen)) 123 106 ! 1.1 Compute the partial pressure of vapor 124 107 ! a. the molecular mass into the column 125 108 mass_mean(:) = 1/(A*q_co2(ig,:) +B) 126 109 ! b. pressure level 127 allocate(zplev(timelen))128 do it = 1,timelen110 allocate(zplev(timelen)) 111 do it = 1,timelen 129 112 zplev(it) = ap(1) + bp(1)*ps(ig,it) 130 enddo113 enddo 131 114 132 115 ! c. Vapor pressure 133 allocate(pvapor(timelen)) 134 pvapor(:) = mass_mean(:)/m_h2o*q_h2o(ig,:)*zplev(:) 135 deallocate(zplev) 136 deallocate(mass_mean) 137 138 116 allocate(pvapor(timelen)) 117 pvapor(:) = mass_mean(:)/m_h2o*q_h2o(ig,:)*zplev(:) 118 deallocate(zplev) 119 deallocate(mass_mean) 139 120 140 121 ! d! Check if there is frost at the surface and then compute the density 141 122 ! at the surface 142 allocate(rhovapor(timelen))123 allocate(rhovapor(timelen)) 143 124 144 125 do it = 1,timelen … … 146 127 rhovapor(it) = min(psv_surf,pvapor(it))/tsurf_inst(ig,it) 147 128 enddo 148 deallocate(pvapor)149 rhovapor_avg =SUM(rhovapor(:),1)/timelen150 deallocate(rhovapor)129 deallocate(pvapor) 130 rhovapor_avg =SUM(rhovapor(:),1)/timelen 131 deallocate(rhovapor) 151 132 152 133 ! 2.2 Compute water density at the soil layer, yearly averaged 153 134 154 allocate(rho_soil(timelen)) 155 allocate(rho_soil_avg(nsoil_PEM)) 156 157 158 159 do isoil = 1,nsoil_PEM 160 do it = 1,timelen 161 rho_soil(it) = exp(alpha/tsoil_inst(ig,isoil,it) +beta)/tsoil_inst(ig,isoil,it) 162 enddo 163 rho_soil_avg(isoil) = SUM(rho_soil(:),1)/timelen 164 enddo 165 deallocate(rho_soil) 135 allocate(rho_soil(timelen)) 136 allocate(rho_soil_avg(nsoil_PEM)) 137 138 do isoil = 1,nsoil_PEM 139 do it = 1,timelen 140 rho_soil(it) = exp(alpha/tsoil_inst(ig,isoil,it) +beta)/tsoil_inst(ig,isoil,it) 141 enddo 142 rho_soil_avg(isoil) = SUM(rho_soil(:),1)/timelen 143 enddo 144 deallocate(rho_soil) 166 145 167 168 146 !2.3 Final: compute ice table 169 icedepth_prev = ice_table(ig) 170 ice_table(ig) = -1 171 allocate(diff_rho(nsoil_PEM)) 172 do isoil = 1,nsoil_PEM 173 diff_rho(isoil) = rhovapor_avg - rho_soil_avg(isoil) 147 icedepth_prev = ice_table(ig) 148 ice_table(ig) = -1 149 allocate(diff_rho(nsoil_PEM)) 150 do isoil = 1,nsoil_PEM 151 diff_rho(isoil) = rhovapor_avg - rho_soil_avg(isoil) 152 enddo 153 deallocate(rho_soil_avg) 154 155 if(diff_rho(1) > 0) then 156 ice_table(ig) = 0. 157 else 158 do isoil = 1,nsoil_PEM -1 159 if((diff_rho(isoil).lt.0).and.(diff_rho(isoil+1).gt.0.)) then 160 z1 = (diff_rho(isoil) - diff_rho(isoil+1))/(layer_PEM(isoil) - layer_PEM(isoil+1)) 161 z2 = -layer_PEM(isoil+1)*z1 + diff_rho(isoil+1) 162 ice_table(ig) = -z2/z1 163 exit 164 endif 165 enddo 166 endif 167 168 deallocate(diff_rho) 169 170 !3. Update Soil Thermal Inertia 171 172 if (ice_table(ig).gt. 0.) then 173 if (ice_table(ig).lt. 1e-10) then 174 do isoil = 1,nsoil_PEM 175 therm_i(ig,isoil)=ice_inertia 176 enddo 177 else 178 ! 4.1 find the index of the mixed layer 179 iref=0 ! initialize iref 180 do k=1,nsoil_PEM ! loop on layers 181 if (ice_table(ig).ge.layer_PEM(k)) then 182 iref=k ! pure regolith layer up to here 183 else 184 ! correct iref was obtained in previous cycle 185 exit 186 endif 187 enddo 188 189 ! 4.2 Build the new ti 190 do isoil=1,iref 191 therm_i(ig,isoil) =inertiedat_PEM(ig,isoil) 174 192 enddo 175 deallocate(rho_soil_avg) 176 177 178 if(diff_rho(1) > 0) then 179 ice_table(ig) = 0. 180 else 181 do isoil = 1,nsoil_PEM -1 182 if((diff_rho(isoil).lt.0).and.(diff_rho(isoil+1).gt.0.)) then 183 z1 = (diff_rho(isoil) - diff_rho(isoil+1))/(layer_PEM(isoil) - layer_PEM(isoil+1)) 184 z2 = -layer_PEM(isoil+1)*z1 + diff_rho(isoil+1) 185 ice_table(ig) = -z2/z1 186 exit 187 endif 188 enddo 189 endif 190 191 192 193 deallocate(diff_rho) 194 195 196 !3. Update Soil Thermal Inertia 197 198 if (ice_table(ig).gt. 0.) then 199 if (ice_table(ig).lt. 1e-10) then 200 do isoil = 1,nsoil_PEM 201 therm_i(ig,isoil)=ice_inertia 202 enddo 203 else 204 ! 4.1 find the index of the mixed layer 205 iref=0 ! initialize iref 206 do k=1,nsoil_PEM ! loop on layers 207 if (ice_table(ig).ge.layer_PEM(k)) then 208 iref=k ! pure regolith layer up to here 209 else 210 ! correct iref was obtained in previous cycle 211 exit 212 endif 213 214 enddo 215 216 217 218 ! 4.2 Build the new ti 219 do isoil=1,iref 220 therm_i(ig,isoil) =inertiedat_PEM(ig,isoil) 221 enddo 222 223 224 if (iref.lt.nsoil_PEM) then 225 if (iref.ne.0) then 226 ! mixed layer 227 therm_i(ig,iref+1)=sqrt((layer_PEM(iref+1)-layer_PEM(iref))/ & 228 (((ice_table(ig)-layer_PEM(iref))/(inertiedat_PEM(ig,iref)**2))+ & 193 194 if (iref.lt.nsoil_PEM) then 195 if (iref.ne.0) then 196 ! mixed layer 197 therm_i(ig,iref+1)=sqrt((layer_PEM(iref+1)-layer_PEM(iref))/ & 198 (((ice_table(ig)-layer_PEM(iref))/(inertiedat_PEM(ig,iref)**2))+ & 229 199 ((layer_PEM(iref+1)-ice_table(ig))/(ice_inertia**2)))) 230 200 231 232 233 else ! first layer is already a mixed layer 234 ! (ie: take layer(iref=0)=0) 235 therm_i(ig,1)=sqrt((layer_PEM(1))/ & 201 else ! first layer is already a mixed layer 202 ! (ie: take layer(iref=0)=0) 203 therm_i(ig,1)=sqrt((layer_PEM(1))/ & 236 204 (((ice_table(ig))/(inertiedat_PEM(ig,1)**2))+ & 237 205 ((layer_PEM(1)-ice_table(ig))/(ice_inertia**2)))) 238 endif ! of if (iref.ne.0) 239 ! lower layers of pure ice 240 do isoil=iref+2,nsoil_PEM 241 therm_i(ig,isoil)=ice_inertia 242 enddo 243 endif ! of if (iref.lt.(nsoilmx)) 244 endif ! permanent glaciers 245 246 206 endif ! of if (iref.ne.0) 207 ! lower layers of pure ice 208 do isoil=iref+2,nsoil_PEM 209 therm_i(ig,isoil)=ice_inertia 210 enddo 211 endif ! of if (iref.lt.(nsoilmx)) 212 endif ! permanent glaciers 247 213 248 214 call soil_pem_1D(nsoil_PEM,.true.,therm_i(ig,:),timestep,tsurf_ave(ig),tsoil_ave(ig,:),alph_PEM,beta_PEM) 249 250 215 call soil_pem_1D(nsoil_PEM,.false.,therm_i(ig,:),timestep,tsurf_ave(ig),tsoil_ave(ig,:),alph_PEM,beta_PEM) 251 216 252 253 do it = 1,timelen 254 tsoil_inst(ig,:,it) = tsoil_inst(ig,:,it) - (Tcol_saved(:) - tsoil_ave(ig,:)) 255 enddo 256 257 258 259 error_depth = abs(icedepth_prev - ice_table(ig)) 260 261 endif 262 263 264 enddo 265 266 error_depth = 1. 267 countloop = 0 268 enddo 217 do it = 1,timelen 218 tsoil_inst(ig,:,it) = tsoil_inst(ig,:,it) - (Tcol_saved(:) - tsoil_ave(ig,:)) 219 enddo 220 221 error_depth = abs(icedepth_prev - ice_table(ig)) 222 endif 223 224 enddo 225 226 error_depth = 1. 227 countloop = 0 228 enddo 269 229 270 271 230 END SUBROUTINE ini_icetable 272 231 subroutine soil_pem_1D(nsoil,firstcall, & 273 232 therm_i, & 274 233 timestep,tsurf,tsoil,alph,beta) 275 276 234 277 235 use comsoil_h_PEM, only: layer_PEM, mlayer_PEM, & … … 309 267 real,intent(inout) :: alph(nsoil-1) 310 268 real,intent(inout) :: beta(nsoil-1) 311 312 313 314 315 269 316 270 ! local variables: … … 330 284 enddo 331 285 332 333 286 ! 0.2 Build thermdiff(:), the "interlayer" thermal diffusivities 334 287 do ik=1,nsoil-1 … … 336 289 +(mlayer_PEM(ik)-layer_PEM(ik))*mthermdiff_PEM(ik-1)) & 337 290 /(mlayer_PEM(ik)-mlayer_PEM(ik-1)) 338 339 291 enddo 340 292 … … 365 317 enddo 366 318 367 368 369 370 371 319 endif ! of if (firstcall) 372 373 374 320 375 321 IF (.not.firstcall) THEN … … 387 333 388 334 ENDIF 389 390 391 392 335 393 336 ! 2. Compute beta_PEM coefficients (preprocessing for next time step) … … 405 348 enddo 406 349 407 408 409 350 end 410 351 411 412 413 414 END MODULE ini_soil_mod 415 416 417 352 END MODULE ini_soil_mod -
trunk/LMDZ.COMMON/libf/evolution/nb_time_step_GCM.F90
r2794 r2835 56 56 CALL err(NF90_CLOSE(fID),"close",fichnom) 57 57 58 print *, "The number of timestep of the PCM run data=", timelen 59 58 60 CONTAINS 59 61 -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r2812 r2835 3 3 4 4 ! I Initialisation 5 ! I_a READ run.def , run_pem.def 6 ! I_b READ starfi_0.nc 7 ! I_c READ GCM data and convert to the physical grid 8 ! I_d Compute tendencies & Save initial situation 5 ! I_a READ run.def 6 ! I_b READ of start_evol.nc and starfi_evol.nc 7 ! I_c Subslope parametrisation 8 ! I_d READ GCM data and convert to the physical grid 9 ! I_e Initialisation of the PEM variable and soil 10 ! I_f Compute tendencies & Save initial situation 11 ! I_g Save initial PCM situation 12 ! I_h Read the PEMstart 13 ! I_i Compute orbit criterion 9 14 10 15 ! II Run 11 16 ! II_a update pressure, ice and tracers 12 ! II_b CO2 glaciers flows 13 ! II_c Update surface and soil temperatures 14 ! II_d Update the tendencies and stopping criterion 17 ! II_b Evolution of the ice 18 ! II_c CO2 glaciers flows 19 ! II_d Update surface and soil temperatures 20 ! II_e Update the tendencies 21 ! II_f Checking the stopping criterion 15 22 16 23 ! III Output 17 ! III_a Recomp tendencies for the start and startfi24 ! III_a Update surface value for the PCM start files 18 25 ! III_b Write start and starfi.nc 19 26 ! III_c Write start_pem 20 27 21 28 !------------------------ 22 23 29 24 30 PROGRAM pem … … 32 38 hmons, summit, base,albedo_h2o_frost, & 33 39 frost_albedo_threshold,emissiv 34 use dimradmars_mod, only: totcloudfrac, albedo, & 35 ini_dimradmars_mod 36 use turb_mod, only: q2, wstar, ini_turb_mod 37 use dust_param_mod, only: tauscaling, ini_dust_param_mod 38 ! use co2cloud_mod, only: mem_Mccn_co2, mem_Mh2o_co2,& 39 ! & mem_Nccn_co2,ini_co2cloud 40 use dimradmars_mod, only: totcloudfrac, albedo 41 use turb_mod, only: q2, wstar 42 use dust_param_mod, only: tauscaling 40 43 use netcdf, only: nf90_open,NF90_NOWRITE,nf90_noerr,nf90_strerror, & 41 44 nf90_get_var, nf90_inq_varid, nf90_inq_dimid, & 42 45 nf90_inquire_dimension,nf90_close 43 46 use phyredem, only: physdem0, physdem1 44 use tracer_mod, only: noms, nqmx,igcm_h2o_ice ! tracer names47 use tracer_mod, only: noms,igcm_h2o_ice ! tracer names 45 48 46 49 ! For phyredem : … … 56 59 USE iniphysiq_mod, ONLY: iniphysiq 57 60 USE infotrac 58 USE temps_mod_evol, ONLY: nyear, dt_pem59 ! USE vertical_layers_mod, ONLY: ap,bp60 61 USE comcstfi_h, only: pi 61 62 … … 68 69 iflat 69 70 70 USE geometry_mod, only: l ongitude_deg,latitude_deg71 USE geometry_mod, only: latitude_deg 71 72 72 73 use pemredem, only: pemdem1 73 USE soil_evolution_mod, ONLY: soil_pem_CN 74 74 75 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SOIL 75 76 USE soil_evolution_mod, ONLY: soil_pem, soil_pem_CN 76 77 use comsoil_h_PEM, only: ini_comsoil_h_PEM,end_comsoil_h_PEM,nsoilmx_PEM, & 77 TI_PEM,inertiedat_PEM,alph_PEM, beta_PEM, & ! soil thermal inertia 78 tsoil_PEM , & !number of subsurface layers 79 mlayer_PEM,layer_PEM, & ! soil mid layer depths 80 fluxgeo, & ! geothermal flux 81 co2_adsorbded_phys ! mass of co2 in the regolith 78 TI_PEM,inertiedat_PEM,alph_PEM, beta_PEM, & ! soil thermal inertia 79 tsoil_PEM, mlayer_PEM,layer_PEM, & !number of subsurface layers, soil mid layer depths 80 fluxgeo, co2_adsorbded_phys ! geothermal flux, mass of co2 in the regolith 82 81 use adsorption_mod, only : regolith_co2adsorption 82 83 !!! For orbit parameters 84 USE temps_mod_evol, ONLY: dt_pem, evol_orbit_pem, Max_iter_pem 85 use planete_h, only: aphelie, periheli, year_day, peri_day, & 86 obliquit 87 use orbit_param_criterion_mod, only : orbit_param_criterion 88 use recomp_orb_param_mod, only: recomp_orb_param 89 90 83 91 IMPLICIT NONE 84 92 … … 104 112 105 113 ! Variable for reading start.nc 106 character (len = *), parameter :: FILE_NAME_start = "start_ 0.nc" !Name of the file used for initialsing the PEM114 character (len = *), parameter :: FILE_NAME_start = "start_evol.nc" !Name of the file used for initialsing the PEM 107 115 ! variables dynamiques 108 116 REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants … … 120 128 ! Variable for reading starfi.nc 121 129 122 character (len = *), parameter :: FILE_NAME = "startfi_ 0.nc" !Name of the file used for initialsing the PEM130 character (len = *), parameter :: FILE_NAME = "startfi_evol.nc" !Name of the file used for initialsing the PEM 123 131 integer :: ncid, varid,status !Variable for handling opening of files 124 132 integer :: phydimid, subdimid, nlayerdimid, nqdimid !Variable ID for Netcdf files … … 152 160 REAL , dimension(:,:), allocatable :: min_h2o_ice_s_1 ! LON x LAT field : minimum of water ice at each point for the first year 153 161 REAL , dimension(:,:), allocatable :: min_h2o_ice_s_2 ! LON x LAT field : minimum of water ice at each point for the second year 154 REAL , dimension(:,:,:), allocatable :: h2o_ice_first_last_day ! LON x LAT x 2 field : First and Last value of a GCM year simulation of water ice155 162 156 163 REAL , dimension(:,:), allocatable :: min_co2_ice_s_1 ! LON x LAT field : minimum of water ice at each point for the first year 157 164 REAL , dimension(:,:), allocatable :: min_co2_ice_s_2 ! LON x LAT field : minimum of water ice at each point for the second year 158 REAL , dimension(:,:,:), allocatable :: co2_ice_first_last_day ! LON x LAT x 2 field : First and Last value of a GCM year simulation of water ice159 160 REAL, dimension(:),allocatable :: local_old_press ! physical point field : Local pressure of initial/previous time step161 REAL, dimension(:),allocatable :: local_new_press ! physical point field : Local pressure of current time step162 165 163 166 REAL :: global_ave_press_GCM … … 166 169 167 170 REAL , dimension(:,:), allocatable :: zplev_new 168 REAL , dimension(:,:), allocatable :: zplev_old171 REAL , dimension(:,:), allocatable :: zplev_gcm 169 172 REAL , dimension(:,:,:), allocatable :: zplev_new_timeseries ! same but with the time series 170 REAL , dimension(:,:,:), allocatable :: zplev_old_timeseries! same but with the time series 171 172 173 174 175 REAL :: tot_co2_atm,tot_var_co2_atm 176 177 178 INTEGER :: year_iter !Counter for the number of PEM iteration 173 REAL , dimension(:,:,:), allocatable :: zplev_old_timeseries ! same but with the time series 174 179 175 LOGICAL :: STOPPING_water ! Logical : is the criterion (% of change in the surface of sublimating water ice) reached? 180 176 LOGICAL :: STOPPING_1_water ! Logical : is there still water ice to sublimate? 181 LOGICAL :: STOPPING_co2 ! Logical : is the criterion (% of change in the surface of sublimating water ice) reached?182 LOGICAL :: STOPPING_1_co2 ! Logical : is there still water ice to sublimate?177 LOGICAL :: STOPPING_co2 ! Logical : is the criterion (% of change in the surface of sublimating water ice) reached? 178 LOGICAL :: STOPPING_1_co2 ! Logical : is there still water ice to sublimate? 183 179 184 180 REAL, dimension(:,:,:),allocatable :: q_co2_GCM ! Initial amount of co2 in the first layer … … 195 191 REAL, ALLOCATABLE :: q_h2o_GCM(:,:,:) 196 192 REAL ,allocatable :: q_h2o_PEM_phys(:,:) 197 real ,allocatable :: q_phys(:,:,:)198 193 integer :: timelen 199 194 REAL :: ave 200 195 201 196 REAL, ALLOCATABLE :: p(:,:) !(ngrid,llmp1) 202 REAL :: extra_mass ! Extra mass of a tracer if it is greater than 1 203 204 REAL :: deficit_mass ! Extra mass of a tracer if it is lower than 0 205 206 207 197 REAL :: extra_mass ! Extra mass of a tracer if it is greater than 1 208 198 209 199 !!!!!!!!!!!!!!!!!!!!!!!! SLOPE 210 200 character*2 :: str2 211 REAL ,allocatable :: watercap_slope(:,:) !(ngrid,nslope)201 REAL ,allocatable :: watercap_slope(:,:) !(ngrid,nslope) 212 202 REAL , dimension(:,:,:), allocatable :: min_co2_ice_slope_1 ! LON x LAT field : minimum of water ice at each point for the first year 213 203 REAL , dimension(:,:,:), allocatable :: min_co2_ice_slope_2 ! LON x LAT field : minimum of water ice at each point for the second year … … 217 207 218 208 REAL , dimension(:,:,:,:), allocatable :: co2_ice_GCM_slope ! LON x LATX NSLOPE x Times field : co2 ice given by the GCM 219 REAL , dimension(:,:,:), allocatable :: co2_ice_GCM_phys_slope 220 221 222 REAL, dimension(:,:),allocatable :: initial_co2_ice_sublim_slope 209 REAL , dimension(:,:,:), allocatable :: co2_ice_GCM_phys_slope ! LON x LATX NSLOPE x Times field : co2 ice given by the GCM 210 211 212 REAL, dimension(:,:),allocatable :: initial_co2_ice_sublim_slope ! physical point field : Logical array indicating sublimating point of co2 ice 223 213 REAL, dimension(:,:),allocatable :: initial_h2o_ice_slope ! physical point field : Logical array indicating sublimating point of h2o ice 224 214 REAL, dimension(:,:),allocatable :: initial_co2_ice_slope ! physical point field : Logical array indicating sublimating point of co2 ice … … 230 220 REAL, dimension(:,:),allocatable :: tendencies_h2o_ice_phys_slope ! physical point field : Tendency of evolution of perenial co2 ice over a year 231 221 232 REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: co2_hmax 222 REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: co2_hmax ! Maximum height for CO2 deposit on slopes (m) 233 223 234 224 REAL, PARAMETER :: rho_co2 = 1600 ! CO2 ice density (kg/m^3) … … 237 227 REAL , dimension(:), allocatable :: flag_co2flow_mesh(:) !(ngrid) ! To flag where there is a glacier flow 238 228 239 240 229 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SURFACE/SOIL 241 230 242 243 REAL, ALLOCATABLE :: tsurf_ave(:,:,:) ! LON x LAT x SLOPE field : Averaged Surface Temperature [K] 244 REAL, ALLOCATABLE :: tsurf_ave_phys(:,:) ! IG x LAT x SLOPE field : Averaged Surface Temperature [K] 245 REAL, ALLOCATABLE :: tsoil_ave(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Soil Temperature [K] 246 REAL, ALLOCATABLE :: tsoil_ave_yr1(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Soil Temperature [K] 231 REAL, ALLOCATABLE :: tsurf_ave(:,:,:) ! LON x LAT x SLOPE field : Averaged Surface Temperature [K] 232 REAL, ALLOCATABLE :: tsurf_ave_phys(:,:) ! IG x LAT x SLOPE field : Averaged Surface Temperature [K] 233 REAL, ALLOCATABLE :: tsoil_ave(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Soil Temperature [K] 234 REAL, ALLOCATABLE :: tsoil_ave_yr1(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Soil Temperature [K] 247 235 REAL, ALLOCATABLE :: tsoil_ave_phys_yr1(:,:,:) !IG x SLOPE field : Averaged Soil Temperature [K] 248 236 249 REAL, ALLOCATABLE :: TI_GCM(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Thermal Inertia [SI]250 REAL, ALLOCATABLE :: tsurf_GCM_timeseries(:,:,:,:) !LONX LAT x SLOPE XTULES field : NOn averaged Surf Temperature [K]237 REAL, ALLOCATABLE :: TI_GCM(:,:,:,:) ! LON x LAT x SLOPE field : Averaged Thermal Inertia [SI] 238 REAL, ALLOCATABLE :: tsurf_GCM_timeseries(:,:,:,:) !LONX LAT x SLOPE XTULES field : NOn averaged Surf Temperature [K] 251 239 REAL, ALLOCATABLE :: tsurf_phys_GCM_timeseries(:,:,:) !IG x SLOPE XTULES field : NOn averaged Surf Temperature [K] 252 240 253 241 REAL, ALLOCATABLE :: tsoil_phys_PEM_timeseries(:,:,:,:) !IG x SLOPE XTULES field : NOn averaged Soil Temperature [K] 254 REAL, ALLOCATABLE :: tsoil_GCM_timeseries(:,:,:,:,:) !IG x SLOPE XTULES field : NOn averaged Soil Temperature [K]255 256 REAL, ALLOCATABLE :: tsurf_ave_yr1(:,:,:) ! LON x LAT x SLOPE field : Averaged Surface Temperature of the first year of the gcm [K]242 REAL, ALLOCATABLE :: tsoil_GCM_timeseries(:,:,:,:,:) !IG x SLOPE XTULES field : NOn averaged Soil Temperature [K] 243 244 REAL, ALLOCATABLE :: tsurf_ave_yr1(:,:,:) ! LON x LAT x SLOPE field : Averaged Surface Temperature of the first year of the gcm [K] 257 245 REAL, ALLOCATABLE :: tsurf_ave_phys_yr1(:,:) ! IG x LAT x SLOPE field : Averaged Surface Temperature of first call of the gcm [K] 258 246 259 260 261 REAL :: tol_soil = 1.e-6262 INTEGER :: countmax = 15263 INTEGER :: countloop264 REAL, ALLOCATABLE :: tsoil_phys_PEM_saved(:,:,:)265 REAL :: error_tsoil266 267 268 LOGICAL :: firstcall269 ! REAL, PARAMETER :: daysec=88775. ! duree du sol (s) ~88775 s270 REAL, PARAMETER :: year_day = 669271 247 REAL, PARAMETER :: year_step = 1 248 INTEGER :: year_iter !Counter for the number of PEM iteration 249 INTEGER :: year_iter_max 272 250 REAL :: timestep 273 251 274 REAL, ALLOCATABLE :: inertiesoil(:,:) ! Thermal inertia of the mesh for restart275 276 REAL, ALLOCATABLE :: TI_GCM_phys(:,:,:) ! Averaged GCM Thermal Inertia [SI]252 REAL, ALLOCATABLE :: inertiesoil(:,:) ! Thermal inertia of the mesh for restart 253 254 REAL, ALLOCATABLE :: TI_GCM_phys(:,:,:) ! Averaged GCM Thermal Inertia [SI] 277 255 REAL, ALLOCATABLE :: TI_GCM_start(:,:,:) ! Averaged GCM Thermal Inertia [SI] 278 279 REAL,ALLOCATABLE :: q_h2o_PEM_phys_ave(:) ! averaged water vapor content280 REAL,ALLOCATABLE :: interp_coef(:)281 256 282 257 REAL,ALLOCATABLE :: ice_depth(:,:) 283 258 REAL,ALLOCATABLE :: TI_locslope(:,:) 284 259 REAL,ALLOCATABLE :: Tsoil_locslope(:,:) 285 REAL,ALLOCATABLE :: Tsoil_locslope_CN(:,:)286 260 REAL,ALLOCATABLE :: Tsurf_locslope(:) 287 REAL,ALLOCATABLE :: Tsurf_locslope_prev(:)288 261 REAL,ALLOCATABLE :: alph_locslope(:,:) 289 262 REAL,ALLOCATABLE :: beta_locslope(:,:) 290 REAL :: kcond 263 291 264 REAL,ALLOCATABLE :: Tsurfave_before_saved(:,:) 292 265 REAL, ALLOCATABLE :: delta_co2_adsorbded(:) 293 266 REAL :: totmass_adsorbded 267 294 268 !!!!!!!!!!!!!!!!!!!!!!!!!!!! 295 269 … … 310 284 time_phys=0. !test 311 285 312 ! n_band_lat=18 286 ! Some constants 287 288 ngrid=ngridmx 289 nlayer=llm 313 290 314 291 m_co2 = 44.01E-3 ! CO2 molecular mass (kg/mol) … … 317 294 B=1/m_noco2 318 295 319 296 year_day=669 297 daysec=88775. 298 dtphys=0 299 timestep=year_day*daysec/year_step 320 300 321 301 !------------------------ … … 324 304 ! I_a READ run.def 325 305 326 327 306 !------------------------ 328 307 329 308 !----------------------------READ run.def --------------------- 330 309 CALL conf_gcm( 99, .TRUE. ) 331 CALL conf_evol( 99, .TRUE. ) 332 310 311 call infotrac_init 312 nq=nqtot 333 313 334 314 !------------------------ … … 336 316 ! I Initialisation 337 317 ! I_a READ run.def 338 ! I_b READ starfi_0.nc 339 340 !----------------------------READ startfi.nc --------------------- 341 342 !----------------------------initialisation --------------------- 343 318 ! I_b READ of start_evol.nc and starfi_evol.nc 319 320 !------------------------ 321 322 !----------------------------Initialisation : READ some constant of startfi_evol.nc --------------------- 323 324 ! In the gcm, these values are given to the physic by the dynamic. 325 ! Here we simply read them in the startfi_evol.nc file 344 326 status =nf90_open(FILE_NAME, NF90_NOWRITE, ncid) 345 status =nf90_inq_dimid(ncid, "physical_points", phydimid)346 status =nf90_inquire_dimension(ncid, phydimid, len = ngrid)347 348 status =nf90_inq_dimid(ncid, "nlayer", nlayerdimid)349 status =nf90_inquire_dimension(ncid, nlayerdimid, len = nlayer)350 351 status =nf90_inq_dimid(ncid,"number_of_advected_fields",nqdimid)352 status =nf90_inquire_dimension(ncid, nqdimid, len = nq)353 327 354 328 allocate(longitude(ngrid)) … … 372 346 status =nf90_close(ncid) 373 347 374 375 376 348 !----------------------------READ start.nc --------------------- 377 378 call infotrac_init379 349 380 350 allocate(q(ip1jmp1,llm,nqtot)) … … 392 362 status = nf90_get_var(ncid, bpvarid, bp) 393 363 status =nf90_close(ncid) 394 395 396 397 daysec=88775. 398 dtphys=0 399 400 401 402 CALL iniphysiq(iim,jjm,llm, & 364 365 CALL iniphysiq(iim,jjm,llm, & 403 366 (jjm-1)*iim+2,comm_lmdz, & 404 367 daysec,day_ini,dtphys/nsplit_phys, & 405 368 rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, & 406 369 iflag_phys) 407 DO nnq=1,nqtot 408 if(noms(nnq).eq."h2o_ice") igcm_h2o_ice = nnq 409 ENDDO 410 411 412 !----------------------------reading --------------------- 413 370 371 DO nnq=1,nqtot 372 if(noms(nnq).eq."h2o_ice") igcm_h2o_ice = nnq 373 ENDDO 374 375 !----------------------------READ startfi.nc --------------------- 414 376 415 377 ! First we read the initial state (starfi.nc) 416 378 417 418 allocate(watercap_slope(ngrid,nslope)) 419 allocate(TI_GCM_start(ngrid,nsoilmx,nslope)) 420 allocate(q_h2o_PEM_phys_ave(ngrid)) 379 allocate(watercap_slope(ngrid,nslope)) 380 allocate(TI_GCM_start(ngrid,nsoilmx,nslope)) 421 381 allocate(inertiesoil(ngrid,nsoilmx)) 422 382 423 424 CALL phyetat0 (FILE_NAME,0,0, & 383 CALL phyetat0 (FILE_NAME,0,0, & 425 384 nsoilmx,ngrid,nlayer,nq, & 426 385 day_ini,time_phys, & … … 432 391 qsurf_slope,watercap_slope) 433 392 434 435 436 deallocate(TI_GCM_start) !not used then 437 393 if(soil_pem) then 394 deallocate(TI_GCM_start) !not used then 395 endif 396 397 ! Remove unphysical values of surface tracer 438 398 DO i=1,ngrid 439 DO nnq=1,nqtot 440 DO islope=1,nslope 441 if(qsurf_slope(i,nnq,islope).LT.0) then 442 qsurf_slope(i,nnq,islope)=0. 443 endif 444 enddo 399 DO nnq=1,nqtot 400 DO islope=1,nslope 401 if(qsurf_slope(i,nnq,islope).LT.0) then 402 qsurf_slope(i,nnq,islope)=0. 403 endif 445 404 enddo 446 405 enddo 406 enddo 407 408 !------------------------ 409 410 ! I Initialisation 411 ! I_a READ run.def 412 ! I_b READ of start_evol.nc and starfi_evol.nc 413 ! I_c Subslope parametrisation 414 415 !------------------------ 416 417 !----------------------------Subslope parametrisation definition --------------------- 447 418 448 419 ! Define some slope statistics 449 450 451 452 453 iflat=1 454 DO islope=2,nslope 455 IF(abs(def_slope_mean(islope)).lt. & 456 abs(def_slope_mean(iflat)))THEN 457 iflat = islope 458 ENDIF 459 460 ENDDO 461 PRINT*,'Flat slope for islope = ',iflat 462 PRINT*,'corresponding criterium = ',def_slope_mean(iflat) 420 iflat=1 421 DO islope=2,nslope 422 IF(abs(def_slope_mean(islope)).lt. & 423 abs(def_slope_mean(iflat))) THEN 424 iflat = islope 425 ENDIF 426 ENDDO 427 428 PRINT*,'Flat slope for islope = ',iflat 429 PRINT*,'corresponding criterium = ',def_slope_mean(iflat) 430 463 431 ! CO2 max thickness (for glaciers flows) 464 465 allocate(co2_hmax(nslope) 466 if(nslope.eq.7) ! ugly way to implement that ... 432 allocate(co2_hmax(nslope)) 433 if(nslope.eq.7) then ! ugly way to implement that ... 467 434 ! CF documentation that explain how the values are computed 468 435 co2_hmax(1) = 1.5 469 co2_hmax(7) = co2_ max(1)436 co2_hmax(7) = co2_hmax(1) 470 437 co2_hmax(2) = 2.4 471 438 co2_hmax(6) = co2_hmax(2) … … 475 442 endif 476 443 477 478 479 444 allocate(flag_co2flow(ngrid,nslope)) 445 allocate(flag_co2flow_mesh(ngrid)) 480 446 481 447 flag_co2flow(:,:) = 0. 482 448 flag_co2flow_mesh(:) = 0. 483 449 484 !------------------------ 450 !---------------------------- READ GCM data --------------------- 485 451 486 452 ! I Initialisation 487 ! I_a READ run.def , run_pem.def 488 ! I_b READ starfi_0.nc 489 ! I_c READ GCM data and convert to the physical grid 453 ! I_a READ run.def 454 ! I_b READ of start_evol.nc and starfi_evol.nc 455 ! I_c Subslope parametrisation 456 ! I_d READ GCM data and convert to the physical grid 490 457 491 458 !------------------------ … … 493 460 ! First we read the evolution of water and co2 ice (and the mass mixing ratio) over the first year of the GCM run, saving only the minimum value 494 461 495 496 call nb_time_step_GCM("concat_year_one.nc",timelen) 462 call nb_time_step_GCM("data_GCM_Y1.nc",timelen) 463 497 464 allocate(min_h2o_ice_s_1(iim+1,jjm+1)) 498 465 allocate(min_co2_ice_s_1(iim+1,jjm+1)) … … 506 473 allocate(tsurf_ave(iim+1,jjm+1,nslope)) 507 474 allocate(tsurf_ave_yr1(iim+1,jjm+1,nslope)) 508 allocate(tsoil_ave(iim+1,jjm+1,nsoilmx,nslope))509 allocate(tsoil_ave_yr1(iim+1,jjm+1,nsoilmx,nslope))510 allocate(tsoil_ave_phys_yr1(ngrid,nsoilmx_PEM,nslope))511 475 allocate(tsurf_ave_phys(ngrid,nslope)) 512 476 allocate(tsurf_ave_phys_yr1(ngrid,nslope)) 513 allocate(TI_GCM(iim+1,jjm+1,nsoilmx,nslope))514 allocate(tsoil_GCM_timeseries(iim+1,jjm+1,nsoilmx,nslope,timelen))515 allocate(tsoil_phys_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen))516 517 477 allocate(tsurf_GCM_timeseries(iim+1,jjm+1,nslope,timelen)) 518 478 allocate(tsurf_phys_GCM_timeseries(ngrid,nslope,timelen)) … … 520 480 allocate(co2_ice_GCM_slope(iim+1,jjm+1,nslope,timelen)) 521 481 allocate(Tsurfave_before_saved(ngrid,nslope)) 522 allocate(tsoil_phys_PEM_saved(ngrid,nsoilmx_PEM,nslope)) 482 allocate(tsoil_ave(iim+1,jjm+1,nsoilmx,nslope)) 483 allocate(tsoil_ave_yr1(iim+1,jjm+1,nsoilmx,nslope)) 484 allocate(tsoil_ave_phys_yr1(ngrid,nsoilmx_PEM,nslope)) 485 allocate(TI_GCM(iim+1,jjm+1,nsoilmx,nslope)) 486 allocate(tsoil_GCM_timeseries(iim+1,jjm+1,nsoilmx,nslope,timelen)) 487 allocate(tsoil_phys_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen)) 523 488 allocate(delta_co2_adsorbded(ngrid)) 524 allocate(q_phys(ngrid,llm,nqtot)) 525 526 527 528 call read_data_GCM("concat_year_one.nc", min_h2o_ice_s_1,min_co2_ice_s_1,iim,jjm,nlayer,vmr_co2_gcm,ps_GCM_yr1,timelen,min_co2_ice_slope_1,min_h2o_ice_slope_1,& 489 490 print *, "Downloading data Y1..." 491 492 call read_data_GCM("data_GCM_Y1.nc", min_h2o_ice_s_1,min_co2_ice_s_1,iim,jjm,nlayer,vmr_co2_gcm,ps_GCM_yr1,timelen,min_co2_ice_slope_1,min_h2o_ice_slope_1,& 529 493 nslope,tsurf_ave_yr1,tsoil_ave_yr1, tsurf_GCM_timeseries,tsoil_GCM_timeseries,TI_GCM,q_co2_GCM,q_h2o_GCM,co2_ice_GCM_slope) 530 494 531 532 495 ! Then we read the evolution of water and co2 ice (and the mass mixing ratio) over the second year of the GCM run, saving only the minimum value 496 497 print *, "Downloading data Y1 done" 533 498 534 499 allocate(min_h2o_ice_s_2(iim+1,jjm+1)) … … 537 502 allocate(min_h2o_ice_slope_2(iim+1,jjm+1,nslope)) 538 503 539 call read_data_GCM("concat_year_two.nc", min_h2o_ice_s_2,min_co2_ice_s_2,iim,jjm,nlayer,vmr_co2_gcm,ps_GCM,timelen,min_co2_ice_slope_2,min_h2o_ice_slope_2, & 504 print *, "Downloading data Y2" 505 506 call read_data_GCM("data_GCM_Y2.nc", min_h2o_ice_s_2,min_co2_ice_s_2,iim,jjm,nlayer,vmr_co2_gcm,ps_GCM,timelen,min_co2_ice_slope_2,min_h2o_ice_slope_2, & 540 507 nslope,tsurf_ave,tsoil_ave, tsurf_GCM_timeseries,tsoil_GCM_timeseries,TI_GCM,q_co2_GCM,q_h2o_GCM,co2_ice_GCM_slope) 541 508 542 543 509 print *, "Downloading data Y2 done" 544 510 545 511 ! The variables in the dynamic grid are transfered to the physical grid 546 547 512 548 513 allocate(vmr_co2_gcm_phys(ngrid,timelen)) … … 552 517 allocate(q_co2_GCM_phys(ngrid,timelen)) 553 518 allocate(q_co2_PEM_phys(ngrid,timelen)) 554 519 allocate(ps_phys(ngrid)) 520 allocate(ps_phys_timeseries(ngrid,timelen)) 521 allocate(ps_phys_timeseries_yr1(ngrid,timelen)) 555 522 556 523 CALL gr_dyn_fi(timelen,iip1,jjp1,ngridmx,vmr_co2_gcm,vmr_co2_gcm_phys) 557 524 CALL gr_dyn_fi(timelen,iip1,jjp1,ngridmx,q_h2o_GCM,q_h2o_GCM_phys) 558 525 CALL gr_dyn_fi(timelen,iip1,jjp1,ngridmx,q_co2_GCM,q_co2_GCM_phys) 559 560 do nnq=1,nqtot 561 562 call gr_dyn_fi(llm,iip1,jjp1,ngridmx,q(:,:,nnq),q_phys(:,:,nnq)) 563 enddo 564 526 call gr_dyn_fi(1,iip1,jjp1,ngridmx,ps,ps_phys) 527 call gr_dyn_fi(timelen,iip1,jjp1,ngridmx,ps_GCM,ps_phys_timeseries) 528 call gr_dyn_fi(timelen,iip1,jjp1,ngridmx,ps_GCM_yr1,ps_phys_timeseries_yr1) 529 CALL gr_dyn_fi(nslope,iip1,jjp1,ngridmx,tsurf_ave,tsurf_ave_phys) 530 CALL gr_dyn_fi(nslope,iip1,jjp1,ngridmx,tsurf_ave_yr1,tsurf_ave_phys_yr1) 565 531 566 532 deallocate(vmr_co2_gcm) 567 533 deallocate(q_h2o_GCM) 568 534 deallocate(q_co2_GCM) 569 570 571 q_co2_PEM_phys(:,:)= q_co2_GCM_phys(:,:) 572 q_h2o_PEM_phys(:,:)= q_h2o_GCM_phys(:,:) 573 574 575 allocate(ps_phys(ngrid)) 576 allocate(ps_phys_timeseries(ngrid,timelen)) 577 allocate(ps_phys_timeseries_yr1(ngrid,timelen)) 578 579 580 581 582 583 call gr_dyn_fi(1,iip1,jjp1,ngridmx,ps,ps_phys) 584 585 586 ! for the time series: 587 588 589 590 call gr_dyn_fi(timelen,iip1,jjp1,ngridmx,ps_GCM,ps_phys_timeseries) 591 call gr_dyn_fi(timelen,iip1,jjp1,ngridmx,ps_GCM_yr1,ps_phys_timeseries_yr1) 592 deallocate(ps_GCM) 593 deallocate(ps_GCM_yr1) 594 595 596 !!!!!!!!!!!!!!!!!!!!! Initialisation for soil_PEM 535 deallocate(ps_GCM) 536 deallocate(ps_GCM_yr1) 537 deallocate(tsurf_ave) 538 deallocate(tsurf_ave_yr1) 539 540 q_co2_PEM_phys(:,:)= q_co2_GCM_phys(:,:) 541 q_h2o_PEM_phys(:,:)= q_h2o_GCM_phys(:,:) 542 543 !------------------------ 544 545 ! I Initialisation 546 ! I_a READ run.def 547 ! I_b READ of start_evol.nc and starfi_evol.nc 548 ! I_c Subslope parametrisation 549 ! I_d READ GCM data and convert to the physical grid 550 ! I_e Initialisation of the PEM variable and soil 551 552 !------------------------ 553 554 !---------------------------- Initialisation of the PEM soil and values --------------------- 597 555 598 556 call end_comsoil_h_PEM 599 557 call ini_comsoil_h_PEM(ngrid,nslope) 600 timestep=year_day*daysec/year_step601 602 558 603 559 allocate(ice_depth(ngrid,nslope)) … … 605 561 606 562 DO islope = 1,nslope 563 if(soil_pem) then 607 564 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,TI_GCM(:,:,:,islope),TI_GCM_phys(:,:,islope)) 565 endif !soil_pem 566 DO t=1,timelen 567 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsurf_GCM_timeseries(:,:,islope,t),tsurf_phys_GCM_timeseries(:,islope,t)) 568 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,co2_ice_GCM_slope(:,:,islope,t),co2_ice_GCM_phys_slope(:,islope,t)) 569 enddo 608 570 ENDDO 609 571 610 572 deallocate(co2_ice_GCM_slope) 573 deallocate(TI_GCM) 574 575 if(soil_pem) then 576 577 deallocate(tsurf_GCM_timeseries) 611 578 call soil_settings_PEM(ngrid,nslope,nsoilmx_PEM,nsoilmx,TI_GCM_phys,TI_PEM) 612 579 613 deallocate(TI_GCM)614 615 616 580 DO islope = 1,nslope 617 618 581 DO l=1,nsoilmx 619 582 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_ave_yr1(:,:,l,islope),tsoil_ave_phys_yr1(:,l,islope)) 583 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_ave(:,:,l,islope),tsoil_PEM(:,l,islope)) 584 DO t=1,timelen 585 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_GCM_timeseries(:,:,l,islope,t),tsoil_phys_PEM_timeseries(:,l,islope,t)) 586 ENDDO 620 587 ENDDO 621 588 DO l=nsoilmx+1,nsoilmx_PEM 622 589 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_ave_yr1(:,:,nsoilmx,islope),tsoil_ave_phys_yr1(:,l,islope)) 623 ENDDO624 ENDDO625 626 627 628 deallocate(tsoil_ave_yr1)629 630 631 632 633 634 635 636 637 638 639 DO islope = 1,nslope640 641 DO l=1,nsoilmx642 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_ave(:,:,l,islope),tsoil_PEM(:,l,islope))643 ENDDO644 DO l=nsoilmx+1,nsoilmx_PEM645 590 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_ave(:,:,nsoilmx,islope),tsoil_PEM(:,l,islope)) 646 591 ENDDO 647 592 ENDDO 648 649 650 651 deallocate(tsoil_ave) 652 653 654 DO islope = 1,nslope 655 656 DO l=1,nsoilmx 657 DO t=1,timelen 658 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsoil_GCM_timeseries(:,:,l,islope,t),tsoil_phys_PEM_timeseries(:,l,islope,t)) 659 ENDDO 660 ENDDO 661 ENDDO 662 593 594 deallocate(tsoil_ave_yr1) 595 deallocate(tsoil_ave) 663 596 deallocate(tsoil_GCM_timeseries) 664 665 666 667 668 CALL gr_dyn_fi(nslope,iip1,jjp1,ngridmx,tsurf_ave,tsurf_ave_phys) 669 670 CALL gr_dyn_fi(nslope,iip1,jjp1,ngridmx,tsurf_ave_yr1,tsurf_ave_phys_yr1) 671 672 deallocate(tsurf_ave) 673 deallocate(tsurf_ave_yr1) 674 675 676 677 678 DO islope = 1,nslope 679 680 DO t=1,timelen 681 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,tsurf_GCM_timeseries(:,:,islope,t),tsurf_phys_GCM_timeseries(:,islope,t)) 682 enddo 683 enddo 684 deallocate(tsurf_GCM_timeseries) 685 686 687 DO islope = 1,nslope 688 689 DO t=1,timelen 690 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,co2_ice_GCM_slope(:,:,islope,t),co2_ice_GCM_phys_slope(:,islope,t)) 691 enddo 692 enddo 693 694 695 696 deallocate(co2_ice_GCM_slope) 697 698 597 endif !soil_pem 699 598 700 599 !------------------------ 701 600 702 601 ! I Initialisation 703 ! I_a READ run.def , run_pem.def 704 ! I_b READ starfi_0.nc 705 ! I_c READ GCM data and convert to the physical grid 706 ! I_d Compute tendencies & Save initial situation 707 708 !------------------------ 709 710 711 712 713 714 !----- Compute tendencies 715 602 ! I_a READ run.def 603 ! I_b READ of start_evol.nc and starfi_evol.nc 604 ! I_c Subslope parametrisation 605 ! I_d READ GCM data and convert to the physical grid 606 ! I_e Initialisation of the PEM variable and soil 607 ! I_f Compute tendencies & Save initial situation 608 609 !----- Compute tendencies from the PCM run 716 610 717 611 allocate(tendencies_h2o_ice(iim+1,jjm+1)) 718 612 allocate(tendencies_h2o_ice_phys(ngrid)) 719 720 613 allocate(tendencies_co2_ice(iim+1,jjm+1)) 721 614 allocate(tendencies_co2_ice_phys(ngrid)) 722 723 615 allocate(tendencies_co2_ice_slope(iim+1,jjm+1,nslope)) 724 616 allocate(tendencies_co2_ice_phys_slope(ngrid,nslope)) 725 617 allocate(tendencies_co2_ice_phys_slope_ini(ngrid,nslope)) 726 727 728 618 allocate(tendencies_h2o_ice_slope(iim+1,jjm+1,nslope)) 729 619 allocate(tendencies_h2o_ice_phys_slope(ngrid,nslope)) 730 620 731 ! Compute the tendencies of the evolution of waterice over the years621 ! Compute the tendencies of the evolution of ice over the years 732 622 733 623 call compute_tendencies(tendencies_h2o_ice,min_h2o_ice_s_1,& … … 740 630 min_co2_ice_slope_2,iim,jjm,ngrid,tendencies_co2_ice_phys_slope,nslope) 741 631 742 743 632 tendencies_co2_ice_phys_slope_ini(:,:)=tendencies_co2_ice_phys_slope(:,:) 744 633 … … 746 635 min_h2o_ice_slope_2,iim,jjm,ngrid,tendencies_h2o_ice_phys_slope,nslope) 747 636 748 749 !----- Save initial situation 637 !------------------------ 638 639 ! I Initialisation 640 ! I_a READ run.def 641 ! I_b READ of start_evol.nc and starfi_evol.nc 642 ! I_c Subslope parametrisation 643 ! I_d READ GCM data and convert to the physical grid 644 ! I_e Initialisation of the PEM variable and soil 645 ! I_f Compute tendencies & Save initial situation 646 ! I_g Save initial PCM situation 647 648 !---------------------------- Save initial PCM situation --------------------- 750 649 751 650 allocate(initial_h2o_ice(ngrid)) … … 754 653 allocate(initial_co2_ice_slope(ngrid,nslope)) 755 654 allocate(initial_h2o_ice_slope(ngrid,nslope)) 756 year_iter=0757 655 758 656 ! We save the places where water ice is sublimating 657 ! We compute the surface of water ice sublimating 658 ini_surf=0. 659 ini_surf_co2=0. 660 ini_surf_h2o=0. 661 Total_surface=0. 759 662 do i=1,ngrid 760 if (tendencies_h2o_ice_phys(i).LT.0) then 663 Total_surface=Total_surface+cell_area(i) 664 if (tendencies_h2o_ice_phys(i).LT.0) then 761 665 initial_h2o_ice(i)=1. 762 else 666 ini_surf=ini_surf+cell_area(i) 667 else 763 668 initial_h2o_ice(i)=0. 764 669 endif 765 670 do islope=1,nslope 766 767 671 if (tendencies_co2_ice_phys_slope(i,islope).LT.0) then 768 672 initial_co2_ice_sublim_slope(i,islope)=1. 673 ini_surf_co2=ini_surf_co2+cell_area(i)*subslope_dist(i,islope) 769 674 else 770 675 initial_co2_ice_sublim_slope(i,islope)=0. … … 777 682 if (tendencies_h2o_ice_phys_slope(i,islope).LT.0) then 778 683 initial_h2o_ice_slope(i,islope)=1. 684 ini_surf_h2o=ini_surf_h2o+cell_area(i)*subslope_dist(i,islope) 779 685 else 780 686 initial_h2o_ice_slope(i,islope)=0. … … 783 689 enddo 784 690 785 ! We compute the surface of water ice sublimating 786 ini_surf=0. 787 ini_surf_co2=0. 788 ini_surf_h2o=0. 789 Total_surface=0. 790 do i=1,ngrid 791 if (initial_h2o_ice(i).GT.0.5) then 792 ini_surf=ini_surf+cell_area(i) 793 endif 794 do islope=1,nslope 795 if (initial_co2_ice_sublim_slope(i,islope).GT.0.5) then 796 ini_surf_co2=ini_surf_co2+cell_area(i)*subslope_dist(i,islope) 797 endif 798 if (initial_h2o_ice_slope(i,islope).GT.0.5) then 799 ini_surf_h2o=ini_surf_h2o+cell_area(i)*subslope_dist(i,islope) 800 endif 801 enddo 802 Total_surface=Total_surface+cell_area(i) 803 enddo 804 805 print *, "ini_surf_co2=", ini_surf_co2 806 print *, "ini_surf=", ini_surf 807 print *, "ini_surf_h2o=", ini_surf_h2o 808 809 810 allocate(local_old_press(ngrid)) 811 allocate(local_new_press(ngrid)) 691 print *, "Total initial surface of co2ice sublimating (slope)=", ini_surf_co2 692 print *, "Total initial surface of h2o ice sublimating=", ini_surf 693 print *, "Total initial surface of h2o ice sublimating (slope)=", ini_surf_h2o 694 print *, "Total surface of the planet=", Total_surface 812 695 813 allocate(zplev_new(ngrid,nlayer+1)) 814 allocate(zplev_old(ngrid,nlayer+1)) 815 696 allocate(zplev_gcm(ngrid,nlayer+1)) 697 698 DO l=1,nlayer+1 699 DO ig=1,ngrid 700 zplev_gcm(ig,l) = ap(l) + bp(l)*ps_phys(ig) 701 ENDDO 702 ENDDO 816 703 817 704 global_ave_press_old=0. … … 821 708 822 709 global_ave_press_GCM=global_ave_press_old 823 print *, "global_ave_press_old", global_ave_press_old 824 825 826 827 !----- Time loop 828 print *, "Before timeloop" 829 allocate(flag_co2flow(ngrid,nslope)) 830 allocate(flag_co2flow_mesh(ngrid)) 831 832 firstcall=.TRUE. 833 834 835 836 710 global_ave_press_new=global_ave_press_old 711 print *, "Initial global average pressure=", global_ave_press_GCM 837 712 838 713 !------------------------ 839 714 840 715 ! I Initialisation 841 ! I_a READ run.def , run_pem.def842 ! I_b READ starfi_0.nc843 ! I_c READ GCM data and convert to the physical grid844 ! I_d Compute tendencies & Save initial situation845 ! I_e Read startfi_PEM846 847 ! ------------------------848 849 850 ! now we complete with the PEMstart716 ! I_a READ run.def 717 ! I_b READ of start_evol.nc and starfi_evol.nc 718 ! I_c Subslope parametrisation 719 ! I_d READ GCM data and convert to the physical grid 720 ! I_e Initialisation of the PEM variable and soil 721 ! I_f Compute tendencies & Save initial situation 722 ! I_g Save initial PCM situation 723 ! I_h Read the PEMstart 724 725 !---------------------------- Read the PEMstart --------------------- 851 726 852 727 call pemetat0(.false.,"startfi_PEM.nc",ngrid,nsoilmx,nsoilmx_PEM,nslope,timelen,timestep,TI_PEM,tsoil_ave_phys_yr1,tsoil_PEM,ice_depth, & 853 tsurf_ave_phys_yr1, tsurf_ave_phys, q_co2_PEM_phys, q_h2o_PEM_phys,ps_phys_timeseries _yr1,ps_phys_timeseries,tsurf_phys_GCM_timeseries,tsoil_phys_PEM_timeseries,&728 tsurf_ave_phys_yr1, tsurf_ave_phys, q_co2_PEM_phys, q_h2o_PEM_phys,ps_phys_timeseries,tsurf_phys_GCM_timeseries,tsoil_phys_PEM_timeseries,& 854 729 tendencies_h2o_ice_phys_slope,tendencies_co2_ice_phys_slope,co2ice_slope,qsurf_slope(:,igcm_h2o_ice,:), co2_adsorbded_phys,delta_co2_adsorbded) 855 totmass_adsorbded = 0. 730 731 732 if(soil_pem) then 733 totmass_adsorbded = 0. 734 856 735 do ig = 1,ngrid 857 736 do islope =1, nslope 858 737 do l = 1,nsoilmx_PEM - 1 859 860 738 totmass_adsorbded = totmass_adsorbded + co2_adsorbded_phys(ig,l,islope)*(layer_PEM(l+1) - layer_PEM(l))* & 861 739 subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180.) * & 862 740 cell_area(ig) 863 741 enddo 864 865 742 enddo 866 867 743 enddo 868 744 869 write(*,*) "tot mass in the regolith", totmass_adsorbded 870 stop 745 write(*,*) "Tot mass in the regolith=", totmass_adsorbded 746 deallocate(tsoil_ave_phys_yr1) 747 endif !soil_pem 871 748 deallocate(tsurf_ave_phys_yr1) 872 deallocate(ps_phys_timeseries_yr1) 873 deallocate(tsoil_ave_phys_yr1) 874 749 deallocate(ps_phys_timeseries_yr1) 750 751 !------------------------ 752 753 ! I Initialisation 754 ! I_a READ run.def 755 ! I_b READ of start_evol.nc and starfi_evol.nc 756 ! I_c Subslope parametrisation 757 ! I_d READ GCM data and convert to the physical grid 758 ! I_e Initialisation of the PEM variable and soil 759 ! I_f Compute tendencies & Save initial situation 760 ! I_g Save initial PCM situation 761 ! I_h Read the PEMstar 762 ! I_i Compute orbit criterion 763 764 CALL iniorbit(aphelie,periheli,year_day,peri_day,obliquit) 765 766 if(evol_orbit_pem) then 767 call orbit_param_criterion(year_iter_max) 768 else 769 year_iter_max=Max_iter_pem 770 endif 875 771 876 772 !--------------------------- END INITIALISATION --------------------- 877 773 878 879 880 881 774 !---------------------------- RUN --------------------- 882 883 884 885 775 886 776 !------------------------ … … 890 780 891 781 !------------------------ 892 893 894 do while ( .true.)895 ! II.a.1. global pressure 896 global_ave_press_new=global_ave_press_old 897 782 year_iter=0 783 print *, "Max_iter_pem", Max_iter_pem 784 do while (year_iter.LT.year_iter_max) 785 786 ! II.a.1. Compute updated global pressure 787 print *, "Recomputing the new pressure..." 898 788 do i=1,ngrid 899 789 do islope=1,nslope 900 790 global_ave_press_new=global_ave_press_new-g*cell_area(i)*tendencies_co2_ice_phys_slope(i,islope)*subslope_dist(i,islope)/cos(pi*def_slope_mean(islope)/180.)/Total_surface 901 791 enddo 902 903 global_ave_press_new = global_ave_press_new -g*cell_area(i)*delta_co2_adsorbded(i)/Total_surface 792 if(soil_pem) then 793 global_ave_press_new = global_ave_press_new -g*cell_area(i)*delta_co2_adsorbded(i)/Total_surface 794 endif 904 795 enddo 905 ! II.a.2. tracers 796 797 ! II.a.2. Old pressure levels for the timeseries, this value is deleted when unused and recreated each time (big memory consuption) 906 798 allocate(zplev_old_timeseries(ngrid,nlayer+1,timelen)) 907 DO l=1,nlayer+1 908 DO ig=1,ngrid 909 zplev_old(ig,l) = ap(l) + bp(l)*ps_phys(ig) 910 zplev_old_timeseries(ig,l,:) = ap(l) + bp(l)*ps_phys_timeseries(ig,:) 911 ENDDO 912 ENDDO 913 914 do i=1,ip1jmp1 915 916 ps(i)=ps(i)*global_ave_press_new/global_ave_press_old 917 918 enddo 799 print *, "Recomputing the old pressure levels timeserie adapted to the old pressure..." 800 DO l=1,nlayer+1 801 DO ig=1,ngrid 802 zplev_old_timeseries(ig,l,:) = ap(l) + bp(l)*ps_phys_timeseries(ig,:) 803 ENDDO 804 ENDDO 805 806 ! II.a.3. Surface pressure timeseries 807 print *, "Recomputing the surface pressure timeserie adapted to the new pressure..." 919 808 do i = 1,ngrid 920 ps_phys(i)=ps_phys(i)*global_ave_press_new/global_ave_press_old921 809 ps_phys_timeseries(i,:) = ps_phys_timeseries(i,:)*global_ave_press_new/global_ave_press_old 922 810 enddo 923 811 812 ! II.a.4. New pressure levels timeseries 924 813 allocate(zplev_new_timeseries(ngrid,nlayer+1,timelen)) 925 926 do l=1,nlayer+1 927 do ig=1,ngrid 928 zplev_new(ig,l) = ap(l) + bp(l)*ps_phys(ig) 929 zplev_new_timeseries(ig,l,:) = ap(l) + bp(l)*ps_phys_timeseries(ig,:) 930 enddo 931 enddo 932 933 934 print *, "1 is okay" 935 936 DO nnq=1,nqtot 937 if (noms(nnq).NE."co2") then 938 DO l=1,llm-1 939 DO ig=1,ngrid 940 q(ig,l,nnq)=q(ig,l,nnq)*(zplev_old(ig,l)-zplev_old(ig,l+1))/(zplev_new(ig,l)-zplev_new(ig,l+1)) 941 ENDDO 942 q(:,llm,nnq)=q(:,llm-1,nnq) 943 ENDDO 944 else 945 DO l=1,llm-1 946 DO ig=1,ngrid 947 q(ig,l,nnq)=q(ig,l,nnq)*(zplev_old(ig,l)-zplev_old(ig,l+1))/(zplev_new(ig,l)-zplev_new(ig,l+1)) & 948 + ( (zplev_new(ig,l)-zplev_new(ig,l+1)) - & 949 (zplev_old(ig,l)-zplev_old(ig,l+1)) ) / & 950 (zplev_new(ig,l)-zplev_new(ig,l+1)) 951 ENDDO 952 q(:,llm,nnq)=q(:,llm-1,nnq) 953 ENDDO 954 endif 955 ENDDO 956 957 958 DO nnq=1,nqtot 959 DO ig=1,ngrid 960 DO l=1,llm-1 961 if(q(ig,l,nnq).GT.1 .and. (noms(nnq).NE."dust_number" .or. noms(nnq).NE."ccn_number") ) then 962 extra_mass=(q(ig,l,nnq)-1)*(zplev_new(ig,l)-zplev_new(ig,l+1)) 963 q(ig,l,nnq)=1. 964 q(ig,l+1,nnq)=q(ig,l+1,nnq)+extra_mass*(zplev_new(ig,l+1)-zplev_new(ig,l+2)) 965 endif 966 if(q(ig,l,nnq).LT.0) then 967 q(ig,l,nnq)=1E-30 968 endif 969 ENDDO 814 print *, "Recomputing the new pressure levels timeserie adapted to the new pressure..." 815 do l=1,nlayer+1 816 do ig=1,ngrid 817 zplev_new_timeseries(ig,l,:) = ap(l) + bp(l)*ps_phys_timeseries(ig,:) 970 818 enddo 971 enddo 972 973 974 975 976 l=1 977 DO ig=1,ngrid 978 DO t = 1, timelen 979 819 enddo 820 821 ! II.a.5. Tracers timeseries 822 print *, "Recomputing of tracer VMR timeseries for the new pressure..." 823 824 l=1 825 DO ig=1,ngrid 826 DO t = 1, timelen 980 827 q_h2o_PEM_phys(ig,t)=q_h2o_PEM_phys(ig,t)*(zplev_old_timeseries(ig,l,t)-zplev_old_timeseries(ig,l+1,t))/(zplev_new_timeseries(ig,l,t)-zplev_new_timeseries(ig,l+1,t)) 981 828 if(q_h2o_PEM_phys(ig,t).LT.0) then … … 985 832 q_h2o_PEM_phys(ig,t)=1. 986 833 endif 987 988 enddo 989 enddo 990 991 992 993 DO ig=1,ngrid 994 DO t = 1, timelen 834 enddo 835 enddo 836 837 DO ig=1,ngrid 838 DO t = 1, timelen 995 839 q_co2_PEM_phys(ig,t)=q_co2_PEM_phys(ig,t)*(zplev_old_timeseries(ig,l,t)-zplev_old_timeseries(ig,l+1,t))/(zplev_new_timeseries(ig,l,t)-zplev_new_timeseries(ig,l+1,t)) & 996 840 + ( (zplev_new_timeseries(ig,l,t)-zplev_new_timeseries(ig,l+1,t)) - & … … 1004 848 mmean=1/(A*q_co2_PEM_phys(ig,t) +B) 1005 849 vmr_co2_pem_phys(ig,t) = q_co2_PEM_phys(ig,t)*mmean/m_co2 1006 ENDDO1007 ENDDO850 ENDDO 851 ENDDO 1008 852 1009 853 deallocate(zplev_new_timeseries) 1010 854 deallocate(zplev_old_timeseries) 1011 855 1012 1013 ! II.a.3. Evolution of the ice1014 1015 1016 call evol_h2o_ice_s_slope(qsurf_slope(:,igcm_h2o_ice,:),tendencies_h2o_ice_phys_slope,iim,jjm,ngrid,cell_area,STOPPING_1_water,nslope)1017 print *, "4 is okay"1018 1019 call evol_co2_ice_s_slope(co2ice_slope,tendencies_co2_ice_phys_slope,iim,jjm,ngrid,cell_area,STOPPING_1_co2,nslope)1020 print *, "5 is okay"1021 1022 1023 !------------------------1024 1025 856 ! II Run 1026 857 ! II_a update pressure, ice and tracers 1027 ! II_b CO2 glaciers flows 1028 1029 !------------------------ 1030 1031 1032 1033 858 ! II_b Evolution of the ice 859 860 ! II.b. Evolution of the ice 861 print *, "Evolution of h2o ice" 862 call evol_h2o_ice_s_slope(qsurf_slope(:,igcm_h2o_ice,:),tendencies_h2o_ice_phys_slope,iim,jjm,ngrid,cell_area,STOPPING_1_water,nslope) 863 864 print *, "Evolution of co2 ice" 865 call evol_co2_ice_s_slope(co2ice_slope,tendencies_co2_ice_phys_slope,iim,jjm,ngrid,cell_area,STOPPING_1_co2,nslope) 866 867 !------------------------ 868 869 ! II Run 870 ! II_a update pressure, ice and tracers 871 ! II_b Evolution of the ice 872 ! II_c CO2 glaciers flows 873 874 !------------------------ 875 876 print *, "Co2 glacier flow" 1034 877 DO ig = 1,ngrid 1035 878 DO islope = 1,nslope … … 1038 881 IF(co2ice_slope(ig,islope).ge.rho_co2*co2_hmax(islope) * & 1039 882 cos(pi*def_slope_mean(islope)/180.)) THEN 1040 1041 883 ! Second: determine the flatest slopes possible: 1042 1043 884 IF(islope.gt.iflat) THEN 1044 885 iaval=islope-1 … … 1048 889 do while ((iaval.ne.iflat).and. & 1049 890 (subslope_dist(ig,iaval).eq.0)) 1050 1051 891 IF(iaval.gt.iflat) THEN 1052 892 iaval=iaval-1 … … 1054 894 iaval=iaval+1 1055 895 ENDIF 1056 1057 896 enddo 1058 1059 1060 co2ice_slope(ig,iaval) = co2ice_slope(ig,iaval) + & 897 co2ice_slope(ig,iaval) = co2ice_slope(ig,iaval) + & 1061 898 (co2ice_slope(ig,islope) - rho_co2* co2_hmax(islope) * & 1062 899 cos(pi*def_slope_mean(islope)/180.)) * & … … 1065 902 cos(pi*def_slope_mean(islope)/180.) 1066 903 1067 1068 1069 1070 flag_co2flow(ig,islope) = 1.1071 flag_co2flow_mesh(ig) = 1.904 co2ice_slope(ig,islope)=rho_co2*co2_hmax(islope) * & 905 cos(pi*def_slope_mean(islope)/180.) 906 907 flag_co2flow(ig,islope) = 1. 908 flag_co2flow_mesh(ig) = 1. 1072 909 ENDIF ! co2ice > hmax 1073 910 ENDIF ! iflattsoil_lope … … 1075 912 ENDDO !ig 1076 913 1077 print *, "6 is okay"1078 1079 914 !------------------------ 1080 915 1081 916 ! II Run 1082 917 ! II_a update pressure, ice and tracers 1083 ! II_b CO2 glaciers flows 1084 ! II_c Update surface and soil temperatures 1085 1086 !------------------------ 1087 1088 1089 ! II_c.1 Update Tsurf 918 ! II_b Evolution of the ice 919 ! II_c CO2 glaciers flows 920 ! II_d Update surface and soil temperatures 921 922 !------------------------ 923 924 ! II_d.1 Update Tsurf 925 926 print *, "Updating the new Tsurf" 1090 927 bool_sublim=0 1091 928 Tsurfave_before_saved(:,:) = tsurf_ave_phys(:,:) 1092 929 DO ig = 1,ngrid 1093 930 DO islope = 1,nslope 1094 if(initial_co2_ice_slope(ig,islope).gt.0.5 .and. co2ice_slope(ig,islope).LT. 1E-5) THEN !co2ice disappeared, look for closest point without co2ice 1095 1096 1097 if(latitude_deg(ig).gt.0) then 1098 do ig_loop=ig,ngrid 1099 DO islope_loop=islope,iflat,-1 1100 if(initial_co2_ice_slope(ig_loop,islope_loop).lt.0.5 .and. co2ice_slope(ig_loop,islope_loop).LT. 1E-5) then 1101 tsurf_ave_phys(ig,islope)=tsurf_ave_phys(ig_loop,islope_loop) 1102 bool_sublim=1 1103 exit 1104 endif 1105 enddo 1106 if (bool_sublim.eq.1) then 1107 exit 931 if(initial_co2_ice_slope(ig,islope).gt.0.5 .and. co2ice_slope(ig,islope).LT. 1E-5) THEN !co2ice disappeared, look for closest point without co2ice 932 if(latitude_deg(ig).gt.0) then 933 do ig_loop=ig,ngrid 934 DO islope_loop=islope,iflat,-1 935 if(initial_co2_ice_slope(ig_loop,islope_loop).lt.0.5 .and. co2ice_slope(ig_loop,islope_loop).LT. 1E-5) then 936 tsurf_ave_phys(ig,islope)=tsurf_ave_phys(ig_loop,islope_loop) 937 bool_sublim=1 938 exit 1108 939 endif 1109 940 enddo 1110 else1111 do ig_loop=ig,1,-11112 DO islope_loop=islope,iflat1113 if(initial_co2_ice_slope(ig_loop,islope_loop).lt.0.5 .and. co2ice_slope(ig_loop,islope_loop).LT. 1E-5) then1114 tsurf_ave_phys(ig,islope)=tsurf_ave_phys(ig_loop,islope_loop)1115 bool_sublim=11116 exit1117 endif1118 enddo1119 if (bool_sublim.eq.1) then1120 exit941 if (bool_sublim.eq.1) then 942 exit 943 endif 944 enddo 945 else 946 do ig_loop=ig,1,-1 947 DO islope_loop=islope,iflat 948 if(initial_co2_ice_slope(ig_loop,islope_loop).lt.0.5 .and. co2ice_slope(ig_loop,islope_loop).LT. 1E-5) then 949 tsurf_ave_phys(ig,islope)=tsurf_ave_phys(ig_loop,islope_loop) 950 bool_sublim=1 951 exit 1121 952 endif 1122 953 enddo 1123 954 if (bool_sublim.eq.1) then 955 exit 956 endif 957 enddo 958 endif 959 initial_co2_ice_slope(ig,islope)=0 960 if ((co2ice_slope(ig,islope).lt.1e-5).and. (qsurf_slope(ig,igcm_h2o_ice,islope).gt.frost_albedo_threshold)) then 961 albedo_slope(ig,1,islope) = albedo_h2o_frost 962 albedo_slope(ig,2,islope) = albedo_h2o_frost 963 else 964 albedo_slope(ig,1,islope) = albedodat(ig) 965 albedo_slope(ig,2,islope) = albedodat(ig) 966 emiss_slope(ig,islope) = emissiv 967 endif 968 elseif( co2ice_slope(ig,islope).GT. 1E-5) THEN !Put tsurf as tcond co2 969 ave=0. 970 do t=1,timelen 971 if(co2_ice_GCM_phys_slope(ig,islope,t).gt.1e-5) then 972 ave = ave + beta/(alpha-log(vmr_co2_pem_phys(ig,t)*ps_phys_timeseries(ig,t)/100.)) 973 else 974 ave = ave + tsurf_phys_GCM_timeseries(ig,islope,t) 1124 975 endif 1125 initial_co2_ice_slope(ig,islope)=0 1126 1127 if ((co2ice_slope(ig,islope).lt.1e-5).and. (qsurf_slope(ig,igcm_h2o_ice,islope).gt.frost_albedo_threshold)) then 1128 1129 albedo_slope(ig,1,islope) = albedo_h2o_frost 1130 albedo_slope(ig,2,islope) = albedo_h2o_frost 1131 1132 else 1133 1134 albedo_slope(ig,1,islope) = albedodat(ig) 1135 albedo_slope(ig,2,islope) = albedodat(ig) 1136 emiss_slope(ig,islope) = emissiv 1137 1138 endif 1139 1140 elseif( co2ice_slope(ig,islope).GT. 1E-5) THEN !Put tsurf as tcond co2 1141 1142 ave=0. 1143 do t=1,timelen 1144 if(co2_ice_GCM_phys_slope(ig,islope,t).gt.1e-5) then 1145 ave = ave + beta/(alpha-log(vmr_co2_pem_phys(ig,t)*ps_phys_timeseries(ig,t)/100.)) 1146 else 1147 ave = ave + tsurf_phys_GCM_timeseries(ig,islope,t) 1148 endif 1149 enddo 1150 1151 tsurf_ave_phys(ig,islope)=ave/timelen 1152 endif 976 enddo 977 tsurf_ave_phys(ig,islope)=ave/timelen 978 endif 1153 979 enddo 1154 enddo 1155 1156 print *, "7 is okay" 1157 1158 do t = 1,timelen 1159 tsurf_phys_GCM_timeseries(:,:,t) = tsurf_phys_GCM_timeseries(:,:,t) +( tsurf_ave_phys(:,:) -Tsurfave_before_saved(:,:)) 1160 enddo 1161 ! for the start 1162 do ig = 1,ngrid 1163 do islope = 1,nslope 1164 tsurf_slope(ig,islope) = tsurf_slope(ig,islope) - (Tsurfave_before_saved(ig,islope)-tsurf_ave_phys(ig,islope)) 1165 enddo 1166 enddo 1167 1168 ! II_c.2 Update soil temperature 1169 1170 allocate(TI_locslope(ngrid,nsoilmx_PEM)) 1171 allocate(Tsoil_locslope(ngrid,nsoilmx_PEM)) 1172 allocate(Tsurf_locslope(ngrid)) 1173 allocate(alph_locslope(ngrid,nsoilmx_PEM-1)) 1174 allocate(beta_locslope(ngrid,nsoilmx_PEM-1)) 1175 1176 1177 1178 1179 print *,"8 is ok" 980 enddo 981 982 do t = 1,timelen 983 tsurf_phys_GCM_timeseries(:,:,t) = tsurf_phys_GCM_timeseries(:,:,t) +( tsurf_ave_phys(:,:) -Tsurfave_before_saved(:,:)) 984 enddo 985 ! for the start 986 do ig = 1,ngrid 987 do islope = 1,nslope 988 tsurf_slope(ig,islope) = tsurf_slope(ig,islope) - (Tsurfave_before_saved(ig,islope)-tsurf_ave_phys(ig,islope)) 989 enddo 990 enddo 991 992 if(soil_pem) then 993 994 ! II_d.2 Update soil temperature 995 996 allocate(TI_locslope(ngrid,nsoilmx_PEM)) 997 allocate(Tsoil_locslope(ngrid,nsoilmx_PEM)) 998 allocate(Tsurf_locslope(ngrid)) 999 allocate(alph_locslope(ngrid,nsoilmx_PEM-1)) 1000 allocate(beta_locslope(ngrid,nsoilmx_PEM-1)) 1001 1002 print *,"Updating soil temperature" 1180 1003 1181 1004 ! Soil averaged … … 1186 1009 alph_locslope(:,:) = alph_PEM(:,:,islope) 1187 1010 beta_locslope(:,:) = beta_PEM(:,:,islope) 1188 call soil_pem (ngrid,nsoilmx_PEM,.true.,TI_locslope,timestep,Tsurf_locslope,Tsoil_locslope,alph_locslope,beta_locslope)1189 call soil_pem (ngrid,nsoilmx_PEM,.false.,TI_locslope,timestep,Tsurf_locslope,Tsoil_locslope,alph_locslope,beta_locslope)1011 call soil_pem_routine(ngrid,nsoilmx_PEM,.true.,TI_locslope,timestep,Tsurf_locslope,Tsoil_locslope,alph_locslope,beta_locslope) 1012 call soil_pem_routine(ngrid,nsoilmx_PEM,.false.,TI_locslope,timestep,Tsurf_locslope,Tsoil_locslope,alph_locslope,beta_locslope) 1190 1013 do t = 1,timelen 1191 1014 tsoil_phys_PEM_timeseries(:,:,islope,t) = tsoil_phys_PEM_timeseries(:,:,islope,t) + (Tsoil_locslope(:,:)- tsoil_PEM(:,:,islope)) … … 1198 1021 enddo 1199 1022 1200 1201 print *, "9 is okay" 1202 1203 1204 !!!!!! Check for the time series 1205 1206 1207 do ig = 1,ngrid 1023 print *, "Update of soil temperature done" 1024 1025 ! Check Nan in the time series 1026 do ig = 1,ngrid 1208 1027 do islope = 1,nslope 1209 1028 do iloop = 1,nsoilmx_PEM 1210 1211 if(isnan(tsoil_PEM(ig,iloop,islope))) then 1212 write(*,*) "is nan tsoil", ig, iloop, islope, tsoil_PEM(ig,iloop,islope) 1029 if(isnan(tsoil_PEM(ig,iloop,islope))) then 1030 write(*,*) "Problem : There is nan tsoil", ig, iloop, islope, tsoil_PEM(ig,iloop,islope) 1213 1031 stop 1214 endif1032 endif 1215 1033 enddo 1216 enddo 1217 enddo 1218 1219 1220 write(*,*) "before ice table, no stop" 1221 1222 ! II_c.3 Update the ice table 1034 enddo 1035 enddo 1036 1037 write(*,*) "Compute ice table" 1038 1039 ! II_d.3 Update the ice table 1223 1040 call computeice_table(timelen,ngrid,nslope,nsoilmx,nsoilmx_PEM, tsoil_phys_PEM_timeseries,tsurf_phys_GCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys, & 1224 1041 ps_phys_timeseries, ice_depth) 1225 1042 1226 print *, "10 is okay" 1227 ! II_c.3 Update the soil thermal properties 1228 call update_soil(ngrid,nslope,nsoilmx_PEM,tendencies_h2o_ice_phys_slope,tendencies_co2_ice_phys_slope,co2ice_slope,qsurf_slope(:,igcm_h2o_ice,:),ps_phys, & 1229 cell_area,ice_depth,TI_PEM) 1230 1231 ! II_c.4 Update the mass of the regolith adsorbded 1232 1233 1043 print *, "Update soil propreties" 1044 ! II_d.4 Update the soil thermal properties 1045 call update_soil(ngrid,nslope,nsoilmx_PEM,tendencies_h2o_ice_phys_slope,tendencies_co2_ice_phys_slope,co2ice_slope,qsurf_slope(:,igcm_h2o_ice,:),global_ave_press_new, & 1046 ice_depth,TI_PEM) 1047 1048 ! II_d.5 Update the mass of the regolith adsorbded 1234 1049 call regolith_co2adsorption(ngrid,nslope,nsoilmx_PEM,timelen,ps_phys_timeseries,tsoil_PEM,TI_PEM,tendencies_h2o_ice_phys_slope,tendencies_co2_ice_phys_slope, & 1235 1050 co2ice_slope,qsurf_slope(:,igcm_h2o_ice,:), q_co2_PEM_phys,q_h2o_PEM_phys,co2_adsorbded_phys,delta_co2_adsorbded) 1236 1051 1052 endif !soil_pem 1237 1053 1238 1054 !------------------------ … … 1240 1056 ! II Run 1241 1057 ! II_a update pressure, ice and tracers 1242 ! II_b CO2 glaciers flows 1243 ! II_c Update surface and soil temperatures 1244 ! II_d Update the tendencies and stopping criterion 1245 1246 !------------------------ 1247 1248 1058 ! II_b Evolution of the ice 1059 ! II_c CO2 glaciers flows 1060 ! II_d Update surface and soil temperatures 1061 ! II_e Update the tendencies 1062 1063 !------------------------ 1064 1065 print *, "Adaptation of the new co2 tendencies to the current pressure" 1249 1066 call recomp_tend_co2_slope(tendencies_co2_ice_phys_slope,tendencies_co2_ice_phys_slope_ini,vmr_co2_gcm_phys,vmr_co2_pem_phys,ps_phys_timeseries,& 1250 1067 global_ave_press_GCM,global_ave_press_new,timelen,ngrid,nslope) 1251 1068 1252 print *, "12 is okay" 1069 !------------------------ 1070 1071 ! II Run 1072 ! II_a update pressure, ice and tracers 1073 ! II_b Evolution of the ice 1074 ! II_c CO2 glaciers flows 1075 ! II_d Update surface and soil temperatures 1076 ! II_e Update the tendencies 1077 ! II_f Checking the stopping criterion 1078 1079 !------------------------ 1080 call criterion_ice_stop_water_slope(cell_area,ini_surf_h2o,qsurf_slope(:,igcm_h2o_ice,:),STOPPING_water,ngrid,initial_h2o_ice_slope) 1081 1082 call criterion_ice_stop_slope(cell_area,ini_surf_co2,co2ice_slope,STOPPING_co2,ngrid,initial_co2_ice_sublim_slope,global_ave_press_GCM,global_ave_press_new,nslope) 1083 1253 1084 year_iter=year_iter+dt_pem 1254 1085 1255 !We check with we should stop 1256 1257 1258 call criterion_ice_stop_water_slope(cell_area,ini_surf_h2o,qsurf_slope(:,igcm_h2o_ice,:),STOPPING_water,ngrid,initial_h2o_ice_slope) 1259 1260 1261 print *, "13 is okay" 1262 call criterion_ice_stop_slope(cell_area,ini_surf_co2,co2ice_slope,STOPPING_co2,ngrid,initial_co2_ice_sublim_slope,global_ave_press_GCM,global_ave_press_new,nslope) 1263 1264 print *, "criterion ok" 1265 1266 1267 print *, "STOPPING_water", STOPPING_water, "STOPPING1_water", STOPPING_1_water 1268 print *, "STOPPING_co2", STOPPING_co2, "STOPPING1_co2", STOPPING_1_co2 1269 print *, "year_iter=", year_iter 1086 print *, "Checking all the stopping criterion." 1087 if (STOPPING_water) then 1088 print *, "STOPPING because surface of water ice sublimating is too low, see message above", STOPPING_water 1089 endif 1090 if (STOPPING_1_water) then 1091 print *, "STOPPING because tendencies on water ice=0, see message above", STOPPING_1_water 1092 endif 1093 if (STOPPING_co2) then 1094 print *, "STOPPING because surface of co2 ice sublimating is too low or global pressure changed too much, see message above", STOPPING_co2 1095 endif 1096 if (STOPPING_1_co2) then 1097 print *, "STOPPING because tendencies on co2 ice=0, see message above", STOPPING_1_co2 1098 endif 1099 1270 1100 if (STOPPING_water .or. STOPPING_1_water .or. STOPPING_co2 .or. STOPPING_1_co2) then 1271 1101 exit 1102 else 1103 print *, "We continue!" 1104 print *, "Number of iteration of the PEM : year_iter=", year_iter 1272 1105 endif 1273 1106 1274 1107 global_ave_press_old=global_ave_press_new 1275 zplev_old=zplev_new 1276 1277 1278 enddo ! big loop of the pem 1108 1109 enddo ! big time iteration loop of the pem 1279 1110 1280 1111 1281 1112 !---------------------------- END RUN PEM --------------------- 1282 1113 1283 1284 1285 1286 1114 !---------------------------- OUTPUT --------------------- 1287 1115 1288 1289 1290 1291 1116 !------------------------ 1292 1117 1293 1118 ! III Output 1294 ! III_a Recomp tendencies for the start and startfi1295 1296 !------------------------ 1297 1298 1299 ! III_a.1 Ice update1119 ! III_a Update surface value for the PCM start files 1120 1121 !------------------------ 1122 1123 ! III_a.1 Ice update (for startfi) 1124 ! Co2 ice 1300 1125 DO ig = 1,ngrid 1301 1302 1303 1304 1305 1306 1126 co2ice(ig) = 0. 1127 DO islope = 1,nslope 1128 co2ice(ig) = co2ice(ig) + co2ice_slope(ig,islope) & 1129 * subslope_dist(ig,islope) / & 1130 cos(pi*def_slope_mean(islope)/180.) 1131 ENDDO 1307 1132 ENDDO ! of DO ig=1,ngrid 1308 1309 DO ig = 1,ngrid !!!!! TO DOC GHANGE IF QSURF ?ü!?!?!?1310 1311 1312 1313 * subslope_dist(ig,islope) / &1314 cos(pi*def_slope_mean(islope)/180.)1315 1133 ! H2o ice 1134 DO ig = 1,ngrid 1135 qsurf(ig,igcm_h2o_ice) = 0. 1136 DO islope = 1,nslope 1137 qsurf(ig,igcm_h2o_ice) = qsurf(ig,igcm_h2o_ice) + qsurf_slope(ig,igcm_h2o_ice,islope) & 1138 * subslope_dist(ig,islope) / & 1139 cos(pi*def_slope_mean(islope)/180.) 1140 ENDDO 1316 1141 ENDDO ! of DO ig=1,ngrid 1317 1142 1318 1319 1320 1321 ! III_a.2 Tsurf and Tsoil update 1322 1323 1324 call interpolate_TIPEM_TIGCM(ngrid,nslope,nsoilmx_PEM,nsoilmx,TI_PEM,TI_GCM_phys) 1325 tsoil_slope(:,:,:) = tsoil_phys_PEM_timeseries(:,:,:,timelen) 1326 1143 ! III_a.2 Tsurf and Tsoil update (for startfi) 1144 1145 if(soil_pem) then 1146 call interpolate_TIPEM_TIGCM(ngrid,nslope,nsoilmx_PEM,nsoilmx,TI_PEM,TI_GCM_phys) 1147 tsoil_slope(:,:,:) = tsoil_phys_PEM_timeseries(:,:,:,timelen) 1148 else 1149 TI_GCM_phys(:,:,:)=TI_GCM_start(:,:,:) 1150 endif !soil_pem 1327 1151 1328 1152 DO ig = 1,ngrid 1329 tsurf(ig) = 0. 1330 1331 DO islope = 1,nslope 1332 tsurf(ig) = tsurf(ig) + tsurf_slope(ig,islope) & 1333 * subslope_dist(ig,islope) 1334 ENDDO 1153 tsurf(ig) = 0. 1154 DO islope = 1,nslope 1155 tsurf(ig) = tsurf(ig) + tsurf_slope(ig,islope) & 1156 * subslope_dist(ig,islope) 1157 ENDDO 1335 1158 ENDDO ! of DO ig=1,ngrid 1336 1159 1337 1160 DO ig = 1,ngrid 1338 1161 DO iloop = 1,nsoilmx 1339 1162 tsoil(ig,iloop) = 0. 1340 1163 inertiesoil(ig,iloop) = 0. 1341 1342 1164 DO islope = 1,nslope 1165 tsoil(ig,iloop) = tsoil(ig,iloop) + tsoil_slope(ig,iloop,islope) & 1343 1166 * subslope_dist(ig,islope) 1344 1167 inertiesoil(ig,iloop) = inertiesoil(ig,iloop) + TI_GCM_phys(ig,iloop,islope) & 1345 1168 * subslope_dist(ig,islope) 1346 ENDDO1347 1169 ENDDO 1170 ENDDO 1348 1171 ENDDO ! of DO ig=1,ngrid 1349 1172 1350 ! III_a.3 Surface optical properties 1173 ! III_a.3 Surface optical properties (for startfi) 1351 1174 1352 1175 DO ig = 1,ngrid … … 1357 1180 *subslope_dist(ig,islope) 1358 1181 ENDDO 1359 ENDDO1360 1182 ENDDO 1361 1183 ENDDO 1362 1184 1363 1185 DO ig = 1,ngrid 1364 1365 emis(ig) =0. 1366 DO islope = 1,nslope 1367 emis(ig)= emis(ig)+emiss_slope(ig,islope) & 1186 emis(ig) =0. 1187 DO islope = 1,nslope 1188 emis(ig)= emis(ig)+emiss_slope(ig,islope) & 1368 1189 *subslope_dist(ig,islope) 1369 ENDDO 1370 ENDDO 1371 1372 1373 1374 !------------------------ 1190 ENDDO 1191 ENDDO 1192 1193 ! III_a.4 Pressure (for start) 1194 do i=1,ip1jmp1 1195 ps(i)=ps(i)*global_ave_press_new/global_ave_press_GCM 1196 enddo 1197 1198 do i = 1,ngrid 1199 ps_phys(i)=ps_phys(i)*global_ave_press_new/global_ave_press_GCM 1200 enddo 1201 1202 ! III_a.5 Tracer (for start) 1203 allocate(zplev_new(ngrid,nlayer+1)) 1204 1205 do l=1,nlayer+1 1206 do ig=1,ngrid 1207 zplev_new(ig,l) = ap(l) + bp(l)*ps_phys(ig) 1208 enddo 1209 enddo 1210 1211 DO nnq=1,nqtot 1212 if (noms(nnq).NE."co2") then 1213 DO l=1,llm-1 1214 DO ig=1,ngrid 1215 q(ig,l,nnq)=q(ig,l,nnq)*(zplev_gcm(ig,l)-zplev_gcm(ig,l+1))/(zplev_new(ig,l)-zplev_new(ig,l+1)) 1216 ENDDO 1217 q(:,llm,nnq)=q(:,llm-1,nnq) 1218 ENDDO 1219 else 1220 DO l=1,llm-1 1221 DO ig=1,ngrid 1222 q(ig,l,nnq)=q(ig,l,nnq)*(zplev_gcm(ig,l)-zplev_gcm(ig,l+1))/(zplev_new(ig,l)-zplev_new(ig,l+1)) & 1223 + ( (zplev_new(ig,l)-zplev_new(ig,l+1)) - & 1224 (zplev_gcm(ig,l)-zplev_gcm(ig,l+1)) ) / & 1225 (zplev_new(ig,l)-zplev_new(ig,l+1)) 1226 ENDDO 1227 q(:,llm,nnq)=q(:,llm-1,nnq) 1228 ENDDO 1229 endif 1230 ENDDO 1231 1232 ! Conserving the tracers's mass for GCM start files 1233 DO nnq=1,nqtot 1234 DO ig=1,ngrid 1235 DO l=1,llm-1 1236 if(q(ig,l,nnq).GT.1 .and. (noms(nnq).NE."dust_number" .or. noms(nnq).NE."ccn_number") ) then 1237 extra_mass=(q(ig,l,nnq)-1)*(zplev_new(ig,l)-zplev_new(ig,l+1)) 1238 q(ig,l,nnq)=1. 1239 q(ig,l+1,nnq)=q(ig,l+1,nnq)+extra_mass*(zplev_new(ig,l+1)-zplev_new(ig,l+2)) 1240 endif 1241 if(q(ig,l,nnq).LT.0) then 1242 q(ig,l,nnq)=1E-30 1243 endif 1244 ENDDO 1245 enddo 1246 enddo 1247 1248 !------------------------ 1249 if(evol_orbit_pem) then 1250 call recomp_orb_param(year_iter) 1251 endif 1375 1252 1376 1253 ! III Output 1377 ! III_a Recomp tendencies for the start and startfi1254 ! III_a Update surface value for the PCM start files 1378 1255 ! III_b Write start and starfi.nc 1379 1256 … … 1386 1263 ztime_fin=0. 1387 1264 1388 print *, "RVip1jmp1", ip1jmp11389 1265 allocate(p(ip1jmp1,nlayer+1)) 1390 print *, "ngrid", ngrid 1391 print *, "nlayer", nlayer 1392 CALL pression (ip1jmp1,ap,bp,ps,p) 1393 print *, "masse 1", masse(1,:) 1394 CALL massdair(p,masse) 1395 print *, "masse 2", masse(1,:) 1396 1397 do nnq=1,nqtot 1398 call gr_fi_dyn(llm,ngridmx,iip1,jjp1,q_phys(:,:,nnq),q(:,:,nnq)) 1399 enddo 1400 1266 CALL pression (ip1jmp1,ap,bp,ps,p) 1267 CALL massdair(p,masse) 1401 1268 1402 1269 CALL dynredem0("restart_evol.nc", day_ini, phis) … … 1404 1271 CALL dynredem1("restart_evol.nc", & 1405 1272 time_0,vcov,ucov,teta,q,masse,ps) 1406 1273 print *, "restart_evol.nc has been written" 1407 1274 1408 1275 ! III_b.2 WRITE restartfi.nc 1409 1410 1276 1411 1277 call physdem0("restartfi_evol.nc",longitude,latitude, & 1412 1278 nsoilmx,ngrid,nlayer,nq, & 1413 1279 ptimestep,pday,0.,cell_area, & … … 1416 1282 subslope_dist) 1417 1283 1418 1419 call physdem1("restartfi_evol.nc",nsoilmx,ngrid,nlayer,nq, & 1284 call physdem1("restartfi_evol.nc",nsoilmx,ngrid,nlayer,nq, & 1420 1285 ptimestep,ztime_fin, & 1421 1286 tsurf,tsoil,co2ice,albedo,emis, & … … 1425 1290 emiss_slope,qsurf_slope,watercap_slope, TI_GCM_phys) 1426 1291 1427 1292 print *, "restartfi_evol.nc has been written" 1428 1293 !------------------------ 1429 1294 1430 1295 ! III Output 1431 ! III_a Recomp tendencies for the start and startfi1296 ! III_a Update surface value for the PCM start files 1432 1297 ! III_b Write start and starfi.nc 1433 1298 ! III_c Write start_pem … … 1435 1300 !------------------------ 1436 1301 1437 1438 1439 call pemdem1("restartfi_PEM.nc",ztime_fin,nsoilmx_PEM,ngrid,nslope , & 1302 call pemdem1("restartfi_PEM.nc",year_iter,nsoilmx_PEM,ngrid,nslope , & 1440 1303 tsoil_PEM, TI_PEM, ice_depth,co2_adsorbded_phys) 1441 1304 1442 1443 1444 1305 print *, "restartfi_PEM.nc has been written" 1306 print *, "The PEM had run for ", year_iter, " years." 1445 1307 print *, "LL & RV : So far so good" 1446 1308 1447 1448 1449 1450 1451 1452 1309 END PROGRAM pem 1453 -
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r2794 r2835 1 1 SUBROUTINE pemetat0(startpem_file,filename,ngrid,nsoil_GCM,nsoil_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM_yr1,tsoil_PEM,ice_table, & 2 tsurf_ave_yr1,tsurf_ave,q_co2,q_h2o,ps_ yr1_inst,ps_inst,tsurf_inst,tsoil_inst,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice, m_co2_regolith_phys,deltam_co2_regolith_phys)2 tsurf_ave_yr1,tsurf_ave,q_co2,q_h2o,ps_inst,tsurf_inst,tsoil_inst,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice, m_co2_regolith_phys,deltam_co2_regolith_phys) 3 3 4 use iostart_PEM, only: open_startphy, close_startphy, get_field 4 use iostart_PEM, only: open_startphy, close_startphy, get_field, get_var 5 5 use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,n_1km,fluxgeo,inertiedat_PEM 6 6 use comsoil_h, only: volcapa,inertiedat 7 7 use ini_soil_mod, only: ini_icetable 8 use soil_evolution_mod, only: soil_pem _CN8 use soil_evolution_mod, only: soil_pem,soil_pem_CN 9 9 use adsorption_mod, only : regolith_co2adsorption 10 USE temps_mod_evol, ONLY: year_PEM 11 10 12 implicit none 11 12 13 13 14 character(len=*), intent(in) :: filename … … 23 24 real,intent(in) :: q_co2(ngrid,timelen) ! MMR tracer co2 [kg/kg] 24 25 real,intent(in) :: q_h2o(ngrid,timelen) ! MMR tracer h2o [kg/kg] 25 real,intent(in) :: ps_yr1_inst(ngrid,timelen)26 26 real,intent(in) :: ps_inst(ngrid,timelen) ! surface pressure [Pa] 27 27 real,intent(in) :: tsurf_inst(ngrid,nslope,timelen) ! soil (mid-layer) temperature … … 34 34 35 35 ! outputs 36 37 38 39 40 36 41 37 real,intent(inout) :: TI_PEM(ngrid,nsoil_PEM,nslope) !soil (mid-layer) thermal inertia (SI) … … 59 55 real :: tsoil_tmp_yr2(ngrid,nsoil_PEM,nslope) 60 56 real :: tsoil_tmp(ngrid,nsoil_PEM,nslope) 61 real :: alph_tmp(n soil_PEM-1)62 real :: beta_tmp(n soil_PEM-1)63 real :: co2_ads_prev(ngrid) 64 real :: ps_ave_yr1(ngrid)65 real :: ps_ave_yr2(ngrid) 57 real :: alph_tmp(ngrid,nsoil_PEM-1) 58 real :: beta_tmp(ngrid,nsoil_PEM-1) 59 real :: co2_ads_prev(ngrid) 60 real :: year_PEM_read 61 66 62 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 67 63 !!! … … 78 74 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 79 75 80 81 ! 0. Some initializations82 ps_ave_yr1(:) = sum(ps_yr1_inst(:,:),2)/timelen83 ps_ave_yr2(:) = sum(ps_inst(:,:),2)/timelen84 85 76 !1. Run 86 87 88 89 77 90 78 if (startpem_file) then 91 79 ! open pem initial state file: 92 80 call open_startphy(filename) 81 82 if(soil_pem) then 83 84 call get_var("Time",year_PEM_read,found) 85 year_PEM=INT(year_PEM_read) 86 if(.not.found) then 87 write(*,*)'PEMetat0: failed loading year_PEM; take default=0' 88 else 89 write(*,*)'year_PEM of startpem=', year_PEM 90 endif 93 91 94 92 !1. Thermal Inertia … … 103 101 104 102 do ig = 1,ngrid 105 106 103 if(TI_PEM(ig,nsoil_GCM,islope).lt.TI_breccia) then 107 104 !!! transition … … 110 107 (((delta-layer_PEM(nsoil_GCM))/(TI_PEM(ig,nsoil_GCM,islope)**2))+ & 111 108 ((layer_PEM(nsoil_GCM+1)-delta)/(TI_breccia**2)))) 112 113 do iloop=nsoil_GCM+2,n_1km 114 TI_PEM(ig,iloop,islope) = TI_breccia 115 enddo 116 else ! we keep the high ti values 117 do iloop=nsoil_GCM+1,n_1km 118 TI_PEM(ig,iloop,islope) = TI_PEM(ig,nsoil_GCM,islope) 119 enddo 120 121 endif ! TI PEM and breccia comparison 122 123 109 do iloop=nsoil_GCM+2,n_1km 110 TI_PEM(ig,iloop,islope) = TI_breccia 111 enddo 112 else ! we keep the high ti values 113 do iloop=nsoil_GCM+1,n_1km 114 TI_PEM(ig,iloop,islope) = TI_PEM(ig,nsoil_GCM,islope) 115 enddo 116 endif ! TI PEM and breccia comparison 124 117 !! transition 125 126 127 (((delta-layer_PEM(n_1km))/(TI_PEM(ig,n_1km,islope)**2))+ &128 118 delta = 1000. 119 TI_PEM(ig,n_1km+1,islope) = sqrt((layer_PEM(n_1km+1)-layer_PEM(n_1km))/ & 120 (((delta-layer_PEM(n_1km))/(TI_PEM(ig,n_1km,islope)**2))+ & 121 ((layer_PEM(n_1km+1)-delta)/(TI_bedrock**2)))) 129 122 do iloop=n_1km+2,nsoil_PEM 130 123 TI_PEM(ig,iloop,islope) = TI_bedrock 131 enddo 132 enddo 133 124 enddo 125 enddo 134 126 else 135 127 do iloop = nsoil_GCM+1,nsoil_PEM … … 141 133 print *,'PEMETAT0: THERMAL INERTIA DONE' 142 134 143 144 145 135 ! b. Special case for inertiedat, inertiedat_PEM 146 136 call get_field("inertiedat_PEM",inertiedat_PEM,found) … … 148 138 do iloop = 1,nsoil_GCM 149 139 inertiedat_PEM(:,iloop) = inertiedat(:,iloop) 150 enddo 151 152 140 enddo 153 141 !!! zone de transition 154 142 delta = 50. … … 159 147 ((layer_PEM(nsoil_GCM+1)-delta)/(TI_breccia**2)))) 160 148 161 162 149 do iloop = nsoil_GCM+2,n_1km 163 150 inertiedat_PEM(ig,iloop) = TI_breccia … … 179 166 enddo 180 167 181 182 183 168 do iloop = n_1km+2, nsoil_PEM 184 169 do ig = 1,ngrid … … 187 172 enddo 188 173 endif ! not found 189 190 174 191 175 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 221 205 222 206 tsoil_tmp_yr1(:,:,islope) = tsoil_startPEM(:,:,islope) 223 call soil_pem (ngrid,nsoil_PEM,.true.,TI_PEM(:,:,islope),timestep,tsurf_ave_yr1(:,islope),tsoil_tmp_yr1(:,:,islope),alph_tmp,beta_tmp)224 call soil_pem (ngrid,nsoil_PEM,.false.,TI_PEM(:,:,islope),timestep,tsurf_ave_yr1(:,islope),tsoil_tmp_yr1(:,:,islope),alph_tmp,beta_tmp)207 call soil_pem_routine(ngrid,nsoil_PEM,.true.,TI_PEM(:,:,islope),timestep,tsurf_ave_yr1(:,islope),tsoil_tmp_yr1(:,:,islope),alph_tmp,beta_tmp) 208 call soil_pem_routine(ngrid,nsoil_PEM,.false.,TI_PEM(:,:,islope),timestep,tsurf_ave_yr1(:,islope),tsoil_tmp_yr1(:,:,islope),alph_tmp,beta_tmp) 225 209 tsoil_tmp_yr2(:,:,islope) = tsoil_tmp_yr1(:,:,islope) 226 call soil_pem (ngrid,nsoil_PEM,.true.,TI_PEM(:,:,islope),timestep,tsurf_ave(:,islope),tsoil_tmp_yr2(:,:,islope),alph_tmp,beta_tmp)210 call soil_pem_routine(ngrid,nsoil_PEM,.true.,TI_PEM(:,:,islope),timestep,tsurf_ave(:,islope),tsoil_tmp_yr2(:,:,islope),alph_tmp,beta_tmp) 227 211 228 212 … … 237 221 enddo 238 222 enddo 239 240 241 242 223 243 224 ENDDO 225 244 226 print *,'PEMETAT0: SOIL TEMP DONE' 245 227 … … 248 230 !3. Ice Table 249 231 250 251 232 call get_field("ice_table",ice_table,found) 252 233 if(.not.found) then … … 254 235 write(*,*)'will reconstruct the values of ice table' 255 236 256 257 237 call ini_icetable(timelen,ngrid,nsoil_PEM,TI_PEM, timestep,tsurf_ave(:,islope),tsoil_PEM(:,:,islope),tsurf_inst(:,islope,:), tsoil_inst(:,:,islope,:),q_co2,q_h2o,ps_inst,ice_table(:,islope)) 258 259 238 260 239 else … … 262 241 call computeice_table(timelen,ngrid,nslope,nsoil_PEM,tsoil_inst,tsurf_inst,q_co2,q_h2o, ps_inst, ice_table) 263 242 264 265 243 endif 266 244 267 245 print *,'PEMETAT0: ICE TABLE DONE' 268 246 269 270 271 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 272 247 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 273 248 274 249 !4. CO2 Adsorption … … 299 274 print *,'PEMETAT0: CO2 adsorption done ' 300 275 301 276 endif ! soil_pem 302 277 303 278 call close_startphy 304 279 305 306 280 else !No startfi, let's build all by hand 307 281 308 282 year_PEM=0 283 284 if(soil_pem) then 309 285 310 286 !a) Thermal inertia … … 326 302 TI_PEM(ig,iloop,islope) = TI_PEM(ig,nsoil_GCM,islope) 327 303 enddo 328 329 304 endif 330 331 305 332 306 !! transition … … 339 313 enddo 340 314 enddo 341 342 315 enddo 343 344 316 345 317 do iloop = 1,nsoil_GCM … … 440 412 print *,'PEMETAT0: CO2 adsorption done ' 441 413 442 443 444 445 446 447 448 449 414 endif !soil_pem 450 415 451 416 endif ! of if (startphy_file) 452 417 453 418 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 419 420 if(soil_pem) then 421 454 422 DO ig = 1,ngrid 455 423 DO islope = 1,nslope … … 459 427 ENDDO 460 428 ENDDO 461 462 463 429 464 430 !! small test … … 474 440 ENDDO 475 441 442 endif!soil_pem 443 476 444 write(*,*) "construction ok, no nan" 477 445 -
trunk/LMDZ.COMMON/libf/evolution/pemredem.F90
r2794 r2835 8 8 day_ini,time,nslope,def_slope,subslope_dist) 9 9 ! create physics restart file and write time-independent variables 10 ! use comsoil_h, only: inertiedat, volcapa, mlayer11 10 use comsoil_h_PEM, only: mlayer_PEM,fluxgeo,inertiedat_PEM 12 11 use iostart_PEM, only : open_restartphy, close_restartphy, & … … 30 29 real, intent(in) :: def_slope(nslope+1) !boundaries for bining of the slopes 31 30 real, intent(in) :: subslope_dist(ngrid,nslope) !undermesh statistics 32 33 34 31 35 32 ! Create physics start file … … 59 56 end subroutine pemdem0 60 57 61 subroutine pemdem1(filename, time,nsoil_PEM,ngrid,nslope, &58 subroutine pemdem1(filename,year_iter,nsoil_PEM,ngrid,nslope, & 62 59 tsoil_slope_PEM,inertiesoil_slope_PEM,ice_table,m_co2_regolith) 63 60 ! write time-dependent variable to restart file … … 66 63 67 64 use comsoil_h_PEM, only: mlayer_PEM,fluxgeo,inertiedat_PEM 65 USE temps_mod_evol, ONLY: year_PEM 66 use soil_evolution_mod, only: soil_pem 68 67 69 68 implicit none … … 74 73 integer,intent(in) :: nsoil_PEM 75 74 integer,intent(in) :: ngrid 76 real,intent(in) :: time77 75 real,intent(IN) :: tsoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope 78 76 real,intent(IN) :: inertiesoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope … … 82 80 integer :: islope 83 81 CHARACTER*2 :: num 82 integer, intent(IN) :: year_iter 84 83 84 real :: year_tot 85 85 86 86 integer :: iq … … 88 88 ! indexes of water vapour & water ice tracers (if any): 89 89 90 90 year_tot=real(year_iter+year_PEM) 91 print *, "Year of simulation=", year_tot 91 92 92 93 ! Open file … … 95 96 ! First variable to write must be "Time", in order to correctly 96 97 ! set time counter in file 97 call put_var("Time"," Temps de simulation",time)98 99 98 call put_var("Time","Year of simulation",year_tot) 99 100 if(soil_pem) then 100 101 101 102 ! Multidimensionnal variables (undermesh slope statistics) … … 103 104 write(num,fmt='(i2.2)') islope 104 105 call put_field("tsoil_PEM_slope"//num,"Soil temperature by slope type", & 105 tsoil_slope_PEM(:,:,islope), time)106 tsoil_slope_PEM(:,:,islope),year_tot) 106 107 call put_field("TI_PEM_slope"//num,"Soil Thermal Inertia by slope type", & 107 inertiesoil_slope_PEM(:,:,islope), time)108 inertiesoil_slope_PEM(:,:,islope),year_tot) 108 109 109 110 call put_field("mco2_reg_ads_slope"//num, "Mass of co2 adsorbded in the regolith", & 110 m_co2_regolith(:,:,islope), time)111 m_co2_regolith(:,:,islope), year_tot) 111 112 112 113 ENDDO 113 114 114 115 call put_field("ice_table","Depth of ice table", & 115 ice_table, time)116 ice_table,year_tot) 116 117 117 118 call put_field("inertiedat_PEM","Thermal inertie of PEM ", & 118 inertiedat_PEM, time)119 inertiedat_PEM,year_tot) 119 120 121 endif !soil_pem 120 122 121 123 ! Close file -
trunk/LMDZ.COMMON/libf/evolution/read_data_GCM.F90
r2794 r2835 9 9 nf90_inquire_dimension,nf90_close 10 10 use comsoil_h, only: nsoilmx 11 USE soil_evolution_mod, ONLY: soil_pem 11 12 12 13 IMPLICIT NONE … … 23 24 ! Arguments: 24 25 CHARACTER(LEN=*), INTENT(IN) :: fichnom !--- FILE NAME 26 INTEGER, INTENT(IN) :: timelen ! number of times stored in the file 25 27 26 28 INTEGER :: iim_input,jjm_input,nlayer,nslope … … 34 36 REAL, INTENT(OUT) :: min_co2_ice_slope(iim_input+1,jjm_input+1,nslope) ! Minimum of co2_ice slope of the year 35 37 REAL, INTENT(OUT) :: min_h2o_ice_slope(iim_input+1,jjm_input+1,nslope) ! Minimum of co2_ice slope of the year 36 ! REAL, ALLOCATABLE :: vmr_co2_gcm(:,:,:) !!!!vmr_co2_phys_gcm(iim_input+1,jjm_input+1,timelen) 37 REAL, INTENT(OUT) :: vmr_co2_gcm(iim_input+1,jjm_input+1,2676) !!!!vmr_co2_phys_gcm(iim_input+1,jjm_input+1,timelen) 38 ! REAL, ALLOCATABLE :: q_h2o_GCM(:,:,:) 39 REAL, INTENT(OUT) :: q_h2o_GCM(iim_input+1,jjm_input+1,2676) 40 REAL, INTENT(OUT) :: q_co2_GCM(iim_input+1,jjm_input+1,2676) 41 ! REAL, ALLOCATABLE :: q_co2_GCM(:,:,:) 38 REAL, INTENT(OUT) :: vmr_co2_gcm(iim_input+1,jjm_input+1,timelen) !!!!vmr_co2_phys_gcm(iim_input+1,jjm_input+1,timelen) 39 REAL, INTENT(OUT) :: q_h2o_GCM(iim_input+1,jjm_input+1,timelen) 40 REAL, INTENT(OUT) :: q_co2_GCM(iim_input+1,jjm_input+1,timelen) 42 41 REAL, ALLOCATABLE :: q1_co2_GCM(:,:,:) 43 ! real, INTENT(OUT) :: vmr_co2_phys_gcm(:,:) !!!!vmr_co2_gcm(ngrid,timelen) 44 ! REAL, ALLOCATABLE :: ps_GCM(:,:,:) 45 REAL, INTENT(OUT) :: ps_GCM(iim_input+1,jjm_input+1,2676) 46 42 REAL, INTENT(OUT) :: ps_GCM(iim_input+1,jjm_input+1,timelen) 47 43 48 44 !SOIL … … 50 46 REAL, INTENT(OUT) :: tsoil_ave(iim_input+1,jjm_input+1,nsoilmx,nslope) ! Average soil temperature of the concatenated file 51 47 52 REAL ,INTENT(OUT) :: tsurf_gcm(iim_input+1,jjm_input+1,nslope, 2676) ! Surface temperature of the concatenated file53 REAL , INTENT(OUT) :: tsoil_gcm(iim_input+1,jjm_input+1,nsoilmx,nslope, 2676) ! Soil temperature of the concatenated file54 55 REAL :: TI_gcm(iim_input+1,jjm_input+1,nsoilmx,nslope, 2676) ! Thermal Inertia of the concatenated file48 REAL ,INTENT(OUT) :: tsurf_gcm(iim_input+1,jjm_input+1,nslope,timelen) ! Surface temperature of the concatenated file 49 REAL , INTENT(OUT) :: tsoil_gcm(iim_input+1,jjm_input+1,nsoilmx,nslope,timelen) ! Soil temperature of the concatenated file 50 51 REAL :: TI_gcm(iim_input+1,jjm_input+1,nsoilmx,nslope,timelen) ! Thermal Inertia of the concatenated file 56 52 REAL, INTENT(OUT) :: TI_ave(iim_input+1,jjm_input+1,nsoilmx,nslope) ! Average Thermal Inertia of the concatenated file 57 REAL, INTENT(OUT) :: co2_ice_slope(iim_input+1,jjm_input+1,nslope, 2676) ! Minimum of co2_ice slope of the year53 REAL, INTENT(OUT) :: co2_ice_slope(iim_input+1,jjm_input+1,nslope,timelen) ! Minimum of co2_ice slope of the year 58 54 !=============================================================================== 59 55 ! Local Variables … … 65 61 66 62 REAL,ALLOCATABLE :: time(:) ! times stored in start 67 INTEGER :: timelen ! number of times stored in the file68 63 INTEGER :: indextime ! index of selected time 69 64 … … 74 69 INTEGER :: islope 75 70 CHARACTER*2 :: num 76 77 71 78 72 !----------------------------------------------------------------------- … … 84 78 B=1/m_noco2 85 79 80 allocate(co2_ice_s(iim+1,jjm+1,timelen)) 81 allocate(q1_co2_GCM(iim+1,jjm+1,timelen)) 82 allocate(h2o_ice_s_slope(iim+1,jjm+1,nslope,timelen)) 83 allocate(h2o_ice_s(iim+1,jjm+1,timelen)) 84 85 print *, "Opening ", fichnom, "..." 86 86 87 ! Open initial state NetCDF file 87 88 var=fichnom 88 89 CALL err(NF90_OPEN(var,NF90_NOWRITE,fID),"open",var) 89 90 90 ierr = nf90_inq_varid (fID, "temps", vID) 91 IF (ierr .NE. nf90_noerr) THEN 92 write(*,*)"pemetat0: Le champ <temps> est absent" 93 write(*,*)"pemetat0: J essaie <Time>" 94 ierr = nf90_inq_varid (fID, "Time", vID) 95 IF (ierr .NE. nf90_noerr) THEN 96 write(*,*)"pemetat0: Le champ <Time> est absent" 97 write(*,*)trim(nf90_strerror(ierr)) 98 print *, "ICIIII0" 99 CALL ABORT_gcm("pemetat0", "", 1) 100 ENDIF 101 ! Get the length of the "Time" dimension 102 print *, "ICIIIITIME" 103 ierr = nf90_inq_dimid(fID,"Time",vID) 104 ierr = nf90_inquire_dimension(fID,vID,len=timelen) 105 ELSE 106 ! Get the length of the "temps" dimension 107 print *, "ICIIIITEMPS" 108 ierr = nf90_inq_dimid(fID,"temps",vID) 109 ierr = nf90_inquire_dimension(fID,vID,len=timelen) 110 ENDIF 111 112 print *, "ICIIII" 113 114 allocate(co2_ice_s(iim+1,jjm+1,timelen)) 115 116 print *, "ICIIIIAAAA" 117 118 ! allocate(q_co2_GCM(iim+1,jjm+1,timelen)) 119 120 print *, "ICIIIIBBBB" 121 122 ! allocate(q_h2o_GCM(iim+1,jjm+1,timelen)) 123 124 print *, "ICIIIICCCC" 125 126 allocate(q1_co2_GCM(iim+1,jjm+1,timelen)) 127 128 print *, "ICIIII2" 129 130 131 132 allocate(h2o_ice_s_slope(iim+1,jjm+1,nslope,timelen)) 133 allocate(h2o_ice_s(iim+1,jjm+1,timelen)) 134 print *, "ICIIII3" 91 print *, "Downloading data for h2oice ..." 135 92 136 93 ! Get h2o_ice_s of the concatenated file 137 94 CALL get_var3("h2o_ice_s" ,h2o_ice_s) 138 95 139 print *, "A" 96 print *, "Downloading data for h2oice done" 97 print *, "Downloading data for co2ice ..." 140 98 141 99 CALL get_var3("co2ice" ,co2_ice_s) 100 101 print *, "Downloading data for co2ice done" 102 print *, "Downloading data for vmr co2..." 103 142 104 CALL get_var3("co2_cropped" ,q_co2_GCM) 105 106 print *, "Downloading data for vmr co2 done" 107 print *, "Downloading data for vmr h20..." 108 143 109 CALL get_var3("h2o_cropped" ,q_h2o_GCM) 144 110 145 print *, "B" 111 print *, "Downloading data for vmr h2o done" 112 print *, "Downloading data for surface pressure ..." 146 113 147 114 CALL get_var3("ps" ,ps_GCM) 148 115 149 print *, "C"150 151 print *, "nslope", nslope116 print *, "Downloading data for surface pressure done" 117 print *, "nslope=", nslope 118 print *, "Downloading data for co2ice_slope ..." 152 119 153 120 DO islope=1,nslope … … 156 123 ENDDO 157 124 158 print *, "co2ice_slope" 125 print *, "Downloading data for co2ice_slope done" 126 print *, "Downloading data for h2o_ice_s_slope ..." 159 127 160 128 DO islope=1,nslope … … 163 131 ENDDO 164 132 165 print *, "h2o_ice_s_slope" 133 print *, "Downloading data for h2o_ice_s_slope done" 134 print *, "Downloading data for tsurf_slope ..." 166 135 167 136 DO islope=1,nslope … … 170 139 ENDDO 171 140 172 print *, "tsurf_slope" 141 print *, "Downloading data for tsurf_slope done" 142 143 if(soil_pem) then 144 145 print *, "Downloading data for tsoil_slope ..." 173 146 174 147 DO islope=1,nslope … … 177 150 ENDDO 178 151 179 print *, "tsoil_slope" 152 print *, "Downloading data for tsoil_slope done" 153 print *, "Downloading data for inertiesoil_slope ..." 180 154 181 155 DO islope=1,nslope … … 184 158 ENDDO 185 159 186 print *, "inertiesoil_slope" 187 188 189 190 160 print *, "Downloading data for inertiesoil_slope done" 161 162 endif 191 163 192 164 ! Compute the minimum over the year for each point 165 print *, "Computing the min of h2o_ice" 193 166 min_h2o_ice_s(:,:)=minval(h2o_ice_s,3) 167 print *, "Computing the min of co2_ice" 194 168 min_co2_ice_s(:,:)=minval(co2_ice_s,3) 195 169 170 print *, "Computing the min of h2o_ice_slope" 171 min_h2o_ice_slope(:,:,:)=minval(h2o_ice_s_slope,4) 172 print *, "Computing the min of co2_ice_slope" 196 173 min_co2_ice_slope(:,:,:)=minval(co2_ice_slope,4) 197 min_h2o_ice_slope(:,:,:)=minval(h2o_ice_s_slope,4)198 174 199 175 !Compute averages 200 176 201 ! DO i=1,timelen 177 print *, "Computing average of tsurf" 202 178 tsurf_ave(:,:,:)=SUM(tsurf_gcm(:,:,:,:),4)/timelen 179 180 if(soil_pem) then 181 print *, "Computing average of tsoil" 203 182 tsoil_ave(:,:,:,:)=SUM(tsoil_gcm(:,:,:,:,:),5)/timelen 183 print *, "Computing average of TI" 204 184 TI_ave(:,:,:,:)=SUM(TI_gcm(:,:,:,:,:),5)/timelen 205 ! ENDDO 206 207 208 185 endif 209 186 210 187 ! By definition, a density is positive, we get rid of the negative values … … 229 206 DO j = 1, jjm+1 230 207 DO t = 1, timelen 231 ! q1_co2_GCM(i,j,t)=q_co2_GCM(i,j,t)232 ! ps_GCM(i,j,t)=ps(i)233 !c Mean air molecular mass = 1/(q(ico2)/m_co2 + (1-q(ico2))/m_noco2)234 208 if (q_co2_GCM(i,j,t).LT.0) then 235 209 q_co2_GCM(i,j,t)=1E-10 … … 248 222 ENDDO 249 223 250 251 252 253 254 255 224 CONTAINS 256 225 -
trunk/LMDZ.COMMON/libf/evolution/recomp_tend_co2_slope.F90
r2794 r2835 20 20 REAL, INTENT(in) :: vmr_co2_pem(ngrid,timelen) ! physical point field : Volume mixing ratio of co2 in the first layer 21 21 REAL, intent(in) :: ps_GCM_2(ngrid,timelen) ! physical point field : Surface pressure in the GCM 22 ! REAL, INTENT(in) :: q_co2_GCM(ngrid) ! physical point field : Density of co2 in the first layer23 ! REAL, intent(in) :: ps_GCM(ngrid) ! physical point field : Density of co2 in the first layer24 22 REAL, intent(in) :: global_ave_press_GCM 25 23 REAL, intent(in) :: global_ave_press_new 26 24 REAL, intent(in) :: tendencies_co2_ice_phys_ini(ngrid,nslope) ! physical point field : Evolution of perenial ice over one year 27 25 28 29 26 ! OUTPUT 30 27 REAL, intent(inout) :: tendencies_co2_ice_phys(ngrid,nslope) ! physical point field : Evolution of perenial ice over one year 31 32 28 33 29 ! local: … … 45 41 coef=669*24*3600*eps*sigma/L 46 42 47 print *, "coef", coef48 print *, "global_ave_press_GCM", global_ave_press_GCM49 print *, "global_ave_press_new", global_ave_press_new50 51 43 ! Evolution of the water ice for each physical point 52 44 do i=1,ngrid 53 45 do islope=1,nslope 54 ave=0. 55 do t=1,timelen 56 57 ! write(*,*)'i,t=',i,t,islope, alpha,beta,ave,vmr_co2_gcm(i,t),vmr_co2_pem(i,t),ps_GCM_2(i,t),global_ave_press_GCM,global_ave_press_new 58 ave=ave+(beta/(alpha-log(vmr_co2_gcm(i,t)*ps_GCM_2(i,t)/100)))**4 & 46 ave=0. 47 do t=1,timelen 48 ave=ave+(beta/(alpha-log(vmr_co2_gcm(i,t)*ps_GCM_2(i,t)/100)))**4 & 59 49 -(beta/(alpha-log(vmr_co2_pem(i,t)*ps_GCM_2(i,t)*global_ave_press_GCM/global_ave_press_new/100)))**4 50 enddo 51 tendencies_co2_ice_phys(i,islope)=tendencies_co2_ice_phys_ini(i,islope)-coef*ave/timelen 60 52 enddo 61 ! print *, "i", i62 ! print *, "tendencies_co2_ice_phys_ini bef", tendencies_co2_ice_phys_ini(i,islope)63 ! tendencies_co2_ice_phys(i,islope)=tendencies_co2_ice_phys_ini(i,islope)+coef*ave/timelen64 tendencies_co2_ice_phys(i,islope)=tendencies_co2_ice_phys_ini(i,islope)-coef*ave/timelen65 66 ! print *, "tendencies after", tendencies_co2_ice_phys(i,islope)67 ! print *, "ave", ave68 ! print *, "timelen", timelen69 ! print *, "vmr_co2_pem(i,t)*ps_GCM_2(i,t)", vmr_co2_pem(i,t)*ps_GCM_2(i,t)70 ! print *, "-------------------"71 enddo72 53 enddo 73 54 -
trunk/LMDZ.COMMON/libf/evolution/soil_TIfeedback_PEM.F90
r2794 r2835 1 1 SUBROUTINE soil_TIfeedback_PEM(ngrid,nsoil,icecover, newtherm_i) 2 2 3 ! use tracer_mod, only: rho_ice4 3 use comsoil_h_PEM, only: layer_PEM, inertiedat_PEM 5 4 … … 24 23 ! Author: Adapted from J.-B. Madeleine Mars 2008 ( Updated November 2012) by LL, 2022 25 24 !======================================================================= 26 27 25 28 26 !Local variables … … 42 40 43 41 REAL ,INTENT(IN):: icecover(ngrid) ! tracer on the surface (kg.m-2) 44 45 ! water ice 42 46 43 !Outputs 47 44 !------- 48 45 49 46 REAL,INTENT(INOUT) :: newtherm_i(ngrid,nsoil) ! New soil thermal inertia 50 51 47 52 48 prev_thermi(:,:) = newtherm_i(:,:) -
trunk/LMDZ.COMMON/libf/evolution/soil_evolution_mod.F90
r2794 r2835 1 1 MODULE soil_evolution_mod 2 2 3 IMPLICIT NONE 3 4 4 IMPLICIT NONE5 LOGICAL soil_pem ! True by default, to run with the subsurface physic. Read in pem.def 5 6 6 7 CONTAINS 7 8 8 9 9 subroutine soil_pem_CN(ngrid,nsoil, & … … 25 25 26 26 #include "dimensions.h" 27 !#include "dimphys.h"28 29 !#include"comsoil.h"30 31 27 32 28 !----------------------------------------------------------------------- … … 44 40 real,intent(inout) :: tsoil(ngrid,nsoil) ! soil (mid-layer) temperature 45 41 46 47 48 42 ! local variables: 49 43 integer ig,ik,isoil … … 58 52 real :: Tcol(nsoil) 59 53 60 61 54 do ig = 1,ngrid 62 55 63 56 Tcol(:) = tsoil(ig,:) 64 57 !0. Build thermal properties of the ground 65 66 58 67 59 do isoil = 1,nsoil … … 87 79 beta_pem(1) = k_soil(1)*timestep/(rhoc(1)*layer_PEM(2)*layer_PEM(1)) 88 80 89 90 91 81 !1.c At the bottom: dT/dz = -Fgeo/k. 92 82 beta_pem(nsoil) = timestep*k_soil(nsoil)/(2.*rhoc(nsoil)*(layer_PEM(isoil) - layer_PEM(isoil-1))**2) … … 107 97 timestep/rhoc(nsoil)*fluxgeo/(layer_PEM(nsoil)-layer_PEM(nsoil-1)) 108 98 109 110 111 99 !2. Update by tridiagonal inversion 112 100 call tridag(d1,d2,d3,re,Tcol,nsoil) 113 114 115 116 tsoil(ig,:) = Tcol(:) 101 tsoil(ig,:) = Tcol(:) 117 102 enddo 118 103 -
trunk/LMDZ.COMMON/libf/evolution/soil_pem.F90
r2794 r2835 1 subroutine soil_pem (ngrid,nsoil,firstcall, &1 subroutine soil_pem_routine(ngrid,nsoil,firstcall, & 2 2 therm_i, & 3 3 timestep,tsurf,tsoil,alph_PEM,beta_PEM) … … 20 20 21 21 #include "dimensions.h" 22 !#include "dimphys.h"23 24 !#include"comsoil.h"25 26 22 27 23 !----------------------------------------------------------------------- … … 40 36 real,intent(inout) :: alph_PEM(ngrid,nsoil-1) 41 37 real,intent(inout) :: beta_PEM(ngrid,nsoil-1) 42 43 44 45 46 38 47 39 ! local variables: 48 integer ig,ik 49 50 51 40 integer ig,ik 52 41 53 42 ! 0. Initialisations and preprocessing step … … 57 46 do ig=1,ngrid 58 47 do ik=0,nsoil-1 59 mthermdiff_PEM(ig,ik)=therm_i(ig,ik+1)*therm_i(ig,ik+1)/volcapa 60 48 mthermdiff_PEM(ig,ik)=therm_i(ig,ik+1)*therm_i(ig,ik+1)/volcapa 61 49 enddo 62 50 enddo 63 64 51 65 52 ! 0.2 Build thermdiff(:), the "interlayer" thermal diffusivities … … 69 56 +(mlayer_PEM(ik)-layer_PEM(ik))*mthermdiff_PEM(ig,ik-1)) & 70 57 /(mlayer_PEM(ik)-mlayer_PEM(ik-1)) 71 72 58 enddo 73 59 enddo … … 100 86 enddo 101 87 102 103 88 enddo ! of do ig=1,ngrid 104 89 105 106 107 90 endif ! of if (firstcall) 108 109 110 91 111 92 IF (.not.firstcall) THEN 112 93 ! 2. Compute soil temperatures 113 94 ! First layer: 114 115 116 117 118 do ig=1,ngrid 119 tsoil(ig,1)=(tsurf(ig)+mu_PEM*beta_PEM(ig,1)* & 95 do ig=1,ngrid 96 tsoil(ig,1)=(tsurf(ig)+mu_PEM*beta_PEM(ig,1)* & 120 97 thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0))/ & 121 98 (1.+mu_PEM*(1.0-alph_PEM(ig,1))*& 122 99 thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0)) 123 124 125 126 127 100 128 101 ! Other layers: 129 do ik=1,nsoil-1 130 131 tsoil(ig,ik+1)=alph_PEM(ig,ik)*tsoil(ig,ik)+beta_PEM(ig,ik) 132 133 134 enddo 135 136 enddo 137 ENDIF 138 139 140 102 do ik=1,nsoil-1 103 tsoil(ig,ik+1)=alph_PEM(ig,ik)*tsoil(ig,ik)+beta_PEM(ig,ik) 104 enddo 105 enddo 106 ENDIF 141 107 142 108 ! 2. Compute beta_PEM coefficients (preprocessing for next time step) … … 157 123 enddo 158 124 159 160 161 125 end 162 126 -
trunk/LMDZ.COMMON/libf/evolution/soil_settings_PEM.F
r2794 r2835 56 56 real alpha,lay1 ! coefficients for building layers 57 57 real xmin,xmax ! to display min and max of a field 58 59 60 58 61 59 !====================================================================== … … 65 63 66 64 ! 1.4 Build mlayer(), if necessary 67 ! if (interpol) then68 65 ! default mlayer distribution, following a power law: 69 66 ! mlayer(k)=lay1*alpha**(k-1/2) … … 73 70 mlayer_PEM(iloop)=lay1*(alpha**(iloop-0.5)) 74 71 enddo 75 ! endif76 72 77 73 ! 1.5 Build layer(); following the same law as mlayer() … … 84 80 enddo 85 81 86 87 88 89 82 ! 2. Thermal inertia (note: it is declared in comsoil_h) 90 83 ! ------------------ 91 92 84 93 85 do ig = 1,ngrid … … 103 95 enddo 104 96 enddo 97 105 98 end subroutine soil_settings_PEM -
trunk/LMDZ.COMMON/libf/evolution/temps_mod_evol.F90
r2779 r2835 3 3 IMPLICIT NONE 4 4 5 INTEGER nyear ! nyear : Maximun number of year over which the PEM can interpolate5 INTEGER year_bp_ini ! year_bp_ini : Initial year of the simulation of the PEM (in evol.def) 6 6 INTEGER dt_pem ! dt_pem : in years, the time step used by the PEM 7 7 REAL alpha_criterion ! alpha_criterion : percentage of change before stopping the PEM 8 9 !$OMP THREADPRIVATE(nyear) 10 11 !WARNING: when adding a threadprivate variable in this module 12 ! do not forget to add it to the copyin clause when opening an OpenMP 13 ! parallel section. e.g. in gcm before call leapfrog_loc and/or 14 ! possibly in iniphysiq 8 INTEGER year_PEM ! year written in startfiPEM.nc 9 INTEGER Max_iter_pem ! Maximal number of iteration when converging to a steady state, read in evol.def 10 LOGICAL evol_orbit_pem ! True if we want to follow the orbital parameters of ob_ex_lsp.asc, read in evol.def 15 11 16 12 END MODULE temps_mod_evol -
trunk/LMDZ.COMMON/libf/evolution/update_soil.F90
r2794 r2835 1 SUBROUTINE update_soil(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,ps_new,& 2 cellarea,ice_depth,TI_PEM) 3 1 SUBROUTINE update_soil(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,p_avg_new,& 2 ice_depth,TI_PEM) 4 3 5 4 USE comsoil_h, only: inertiedat, volcapa … … 10 9 INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM 11 10 REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) 12 REAL,INTENT(IN) :: ps_new(ngrid) 13 REAL,INTENT(IN) :: cellarea(ngrid) 11 REAL,INTENT(IN) :: p_avg_new 14 12 REAL,INTENT(IN) :: co2ice(ngrid,nslope) 15 13 REAL,INTENT(IN) :: waterice(ngrid,nslope) 16 14 REAL,INTENT(in) :: ice_depth(ngrid,nslope) 17 18 15 19 16 ! Outputs: … … 44 41 REAL :: regolith_inertia(ngrid,nslope) ! TI of the regolith 45 42 REAL :: d(ngrid,nsoil_PEM,nslope) 46 REAL :: p_avg_new47 43 REAL :: Total_surface 48 44 INTEGER :: ispermanent_co2glaciers(ngrid,nslope) 49 45 INTEGER :: ispermanent_h2oglaciers(ngrid,nslope) 50 46 51 52 47 ! 0. Initialisation 53 54 55 56 57 Total_surface = sum(cellarea)58 p_avg_new = 0.59 do ig = 1,ngrid60 p_avg_new = p_avg_new + ps_new(ig)*cellarea(ig)/Total_surface61 enddo62 63 64 48 65 49 do ig = 1,ngrid … … 80 64 enddo 81 65 82 83 66 ispermanent_co2glaciers(:,:) = 0 84 67 ispermanent_h2oglaciers(:,:) = 0 85 68 86 87 69 ! 1.Ice TI feedback 88 70 89 ! do ig=1,ngrid90 ! do islope=1,nslope91 ! if ((ispermanent_co2glaciers(ig,islope).eq.1).or.(ispermanent_h2oglaciers(ig,islope).eq.1)) then92 ! do iloop = 1,n_1km93 ! TI_PEM(ig,iloop,islope) = surfaceice_inertia94 ! enddo95 ! endif96 ! enddo97 ! enddo98 71 do islope = 1,nslope 99 72 call soil_TIfeedback_PEM(ngrid,nsoil_PEM,waterice(:,islope), TI_PEM(:,:,islope)) … … 101 74 102 75 ! 2. Modification of the regolith thermal inertia. 103 104 105 76 106 77 do ig=1,ngrid … … 115 86 enddo 116 87 enddo 117 118 119 120 121 122 88 123 89 ! 3. Build new TI for the PEM … … 142 108 exit 143 109 endif 144 145 110 enddo 146 147 148 111 149 112 ! 4.2 Build the new ti … … 173 136 enddo !ig 174 137 175 176 177 178 179 180 181 138 !======================================================================= 182 139 RETURN
Note: See TracChangeset
for help on using the changeset viewer.