Changeset 3591
- Timestamp:
- Jan 21, 2025, 3:53:18 PM (15 hours ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3589 r3591 547 547 == 20/01/2025 == JBC 548 548 The initialization of constants between dynamics and physics was messed up which led to uninitialized variables. 549 550 == 21/01/2025 == JBC 551 - Making allocation/deallocation systematically and more efficient in the main program. 552 - Some cleanings (variables deletion, more adapted type/dimension, etc). -
trunk/LMDZ.COMMON/libf/evolution/get_timelen_PCM_mod.F90
r3571 r3591 48 48 write(*,*)"read_data_PCM: Le champ <time_counter> est absent" 49 49 write(*,*)"read_data_PCM: J essaie <Time>" 50 ierr = nf90_inq_varid (fID, "Time",vID)50 ierr = nf90_inq_varid (fID,"Time",vID) 51 51 if (ierr /= nf90_noerr) then 52 52 write(*,*)"read_data_PCM: Le champ <Time> est absent" -
trunk/LMDZ.COMMON/libf/evolution/glaciers_mod.F90
r3571 r3591 21 21 !======================================================================= 22 22 23 SUBROUTINE flow_co2glaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,vmr_co2_PEM,ps_PCM,ps_avg_global_ini,ps_avg_global,co2ice,flag_co2flow ,flag_co2flow_mesh)23 SUBROUTINE flow_co2glaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,vmr_co2_PEM,ps_PCM,ps_avg_global_ini,ps_avg_global,co2ice,flag_co2flow) 24 24 25 25 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 35 35 implicit none 36 36 37 ! Inputs :38 !------- -37 ! Inputs 38 !------- 39 39 integer, intent(in) :: timelen, ngrid, nslope, iflat ! number of time sample, physical points, subslopes, index of the flat subslope 40 40 real, dimension(ngrid,nslope), intent(in) :: subslope_dist ! Grid points x Slopes: Distribution of the subgrid slopes … … 44 44 real, intent(in) :: ps_avg_global_ini ! Global averaged surface pressure at the beginning [Pa] 45 45 real, intent(in) :: ps_avg_global ! Global averaged surface pressure during the PEM iteration [Pa] 46 47 ! Ouputs: 48 !-------- 49 real, dimension(ngrid,nslope), intent(inout) :: co2ice ! Grid points x Slope field: co2 ice on the subgrid slopes [kg/m^2] 50 real, dimension(ngrid,nslope), intent(inout) :: flag_co2flow ! flag to see if there is flow on the subgrid slopes 51 real, dimension(ngrid), intent(inout) :: flag_co2flow_mesh ! same but within the mesh 46 ! Ouputs 47 !------- 48 real, dimension(ngrid,nslope), intent(inout) :: co2ice ! Grid points x Slope field: co2 ice on the subgrid slopes [kg/m^2] 49 integer(kind=1), dimension(ngrid,nslope), intent(out) :: flag_co2flow ! Flag to see if there is flow on the subgrid slopes 52 50 ! Local 53 51 !------ … … 58 56 call computeTcondCO2(timelen,ngrid,nslope,vmr_co2_PEM,ps_PCM,ps_avg_global_ini,ps_avg_global,Tcond) 59 57 call compute_hmaxglaciers(ngrid,nslope,iflat,def_slope_mean,Tcond,"co2",hmax) 60 call transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tcond,co2ice,flag_co2flow ,flag_co2flow_mesh)58 call transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tcond,co2ice,flag_co2flow) 61 59 62 60 END SUBROUTINE flow_co2glaciers … … 64 62 !======================================================================= 65 63 66 SUBROUTINE flow_h2oglaciers(ngrid,nslope,iflat,subslope_dist,def_slope_mean,Tice,h2oice,flag_h2oflow ,flag_h2oflow_mesh)64 SUBROUTINE flow_h2oglaciers(ngrid,nslope,iflat,subslope_dist,def_slope_mean,Tice,h2oice,flag_h2oflow) 67 65 68 66 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 81 79 ! --------- 82 80 83 ! Inputs: 81 ! Inputs 82 ! ------ 84 83 integer, intent(in) :: ngrid, nslope, iflat ! number of time sample, physical points, subslopes, index of the flat subslope 85 84 real, dimension(ngrid,nslope), intent(in) :: subslope_dist ! Grid points x Slopes : Distribution of the subgrid slopes 86 85 real, dimension(ngrid), intent(in) :: def_slope_mean ! Slopes: values of the sub grid slope angles 87 86 real, dimension(ngrid,nslope), intent(in) :: Tice ! Ice Temperature [K] 88 ! Ouputs: 89 real, dimension(ngrid,nslope), intent(inout) :: h2oice ! Grid points x Slope field: co2 ice on the subgrid slopes [kg/m^2] 90 real, dimension(ngrid,nslope), intent(inout) :: flag_h2oflow ! flag to see if there is flow on the subgrid slopes 91 real, dimension(ngrid), intent(inout) :: flag_h2oflow_mesh ! same but within the mesh 92 ! Local 87 ! Outputs 88 !-------- 89 real, dimension(ngrid,nslope), intent(inout) :: h2oice ! Grid points x Slope field: co2 ice on the subgrid slopes [kg/m^2] 90 integer(kind=1), dimension(ngrid,nslope), intent(out) :: flag_h2oflow ! Flag to see if there is flow on the subgrid slopes 91 ! Local 92 ! ----- 93 93 real, dimension(ngrid,nslope) :: hmax ! Grid points x Slope field: maximum thickness for co2 glacier before flow 94 94 95 95 write(*,*) "Flow of H2O glaciers" 96 96 call compute_hmaxglaciers(ngrid,nslope,iflat,def_slope_mean,Tice,"h2o",hmax) 97 call transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tice,h2oice,flag_h2oflow ,flag_h2oflow_mesh)97 call transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tice,h2oice,flag_h2oflow) 98 98 99 99 END SUBROUTINE flow_h2oglaciers … … 115 115 !!! Purpose: Compute the maximum thickness of CO2 and H2O glaciers given a slope angle before initating flow 116 116 !!! 117 !!! Author: LL, based on work by A.Grau Galofre (LPG) and Isaac Smith (JGR Planets 2022)117 !!! Author: LL, based on work by A.Grau Galofre (LPG) and Isaac Smith (JGR Planets 2022) 118 118 !!! 119 119 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 161 161 !======================================================================= 162 162 163 SUBROUTINE transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tice,qice,flag_flow ,flag_flowmesh)163 SUBROUTINE transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tice,qice,flag_flow) 164 164 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 165 165 !!! … … 190 190 ! Outputs 191 191 !-------- 192 real, dimension(ngrid,nslope), intent(inout) :: qice ! CO2 in the subslope [kg/m^2] 193 real, dimension(ngrid,nslope), intent(inout) :: flag_flow ! boolean to check if there is flow on a subgrid slope 194 real, dimension(ngrid), intent(inout) :: flag_flowmesh ! boolean to check if there is flow in the mesh 192 real, dimension(ngrid,nslope), intent(inout) :: qice ! CO2 in the subslope [kg/m^2] 193 integer(kind=1), dimension(ngrid,nslope), intent(out) :: flag_flow ! Flag to see if there is flow on the subgrid slopes 195 194 ! Local 196 195 !------ 197 196 integer :: ig, islope ! loop 198 197 integer :: iaval ! ice will be transfered here 198 199 flag_flow = 0 199 200 200 201 do ig = 1,ngrid … … 220 221 221 222 qice(ig,islope) = rho_ice(Tice(ig,islope),'h2o')*hmax(ig,islope)*cos(pi*def_slope_mean(islope)/180.) 222 flag_flow(ig,islope) = 1. 223 flag_flowmesh(ig) = 1. 223 flag_flow(ig,islope) = 1 224 224 endif ! co2ice > hmax 225 225 endif ! iflat -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r3589 r3591 179 179 real, dimension(:,:), allocatable :: q_h2o_PEM_phys ! Grid points x Times: h2o mass mixing ratio computed in the PEM, first value comes from PCM [kg/kg] 180 180 integer :: timelen ! # time samples 181 real, dimension(:,:), allocatable :: p ! Grid points x Atmosphere: pressure to recompute and write in restart (ngrid,llmp1)182 181 real :: extra_mass ! Intermediate variables Extra mass of a tracer if it is greater than 1 183 182 … … 200 199 201 200 ! Variables for slopes 202 real, dimension(:,:), allocatable :: flag_co2flow ! (ngrid,nslope): Flag where there is a CO2 glacier flow 203 real, dimension(:), allocatable :: flag_co2flow_mesh ! (ngrid) : Flag where there is a CO2 glacier flow 204 real, dimension(:,:), allocatable :: flag_h2oflow ! (ngrid,nslope): Flag where there is a H2O glacier flow 205 real, dimension(:), allocatable :: flag_h2oflow_mesh ! (ngrid) : Flag where there is a H2O glacier flow 201 integer(kind = 1), dimension(:,:), allocatable :: flag_co2flow ! (ngrid,nslope): Flag where there is a CO2 glacier flow 202 integer(kind = 1), dimension(:,:), allocatable :: flag_h2oflow ! (ngrid,nslope): Flag where there is a H2O glacier flow 206 203 207 204 ! Variables for surface and soil … … 218 215 real, dimension(:,:,:,:), allocatable :: watersoil_density_PEM_timeseries ! Grid points x Soil x Slope x Times: Water soil density timeseries for PEM [kg/m^3] 219 216 real, dimension(:,:,:), allocatable :: watersoil_density_PEM_avg ! Grid points x Soil x Slopes: Averaged water soil density [kg/m^3] 220 real, dimension(:,:), allocatable :: tsurf_avg_old ! Surface temperature saved from previous time step [K]221 217 real, dimension(:), allocatable :: delta_co2_adsorbed ! Physics: quantity of CO2 that is exchanged because of adsorption / desorption [kg/m^2] 222 218 real, dimension(:), allocatable :: delta_h2o_adsorbed ! Physics: quantity of H2O that is exchanged because of adsorption / desorption [kg/m^2] … … 233 229 234 230 ! Some variables for the PEM run 235 real, parameter :: year_step = 1 ! Timestep for the pem236 real :: i_myear_leg ! Number of iteration237 real :: n_myear_leg ! Maximum number of iterations before stopping238 real :: i_myear ! Global number of Martian years of the chained simulations239 real :: n_myear ! Maximum number of Martian years of the chained simulations240 real :: timestep ! Timestep [s]241 character(100) :: arg ! To read command-line arguments program was invoked242 logical :: timewall ! Flag to use the time limit stopping criterion in case of a PEM job243 integer(kind =8) :: cr ! Number of clock ticks per second (count rate)244 integer(kind =8) :: c1, c2 ! Counts of processor clock245 character(100) :: chtimelimit ! Time limit for the PEM job outputted by the SLURM command246 real :: timelimit ! Time limit for the PEM job in seconds247 real, parameter :: antetime = 1200 ! Anticipation time to prevent reaching the time limit: 1200 s = 20 min by default248 integer :: cstat, days, hours, minutes, seconds249 character(1) :: sep231 real, parameter :: year_step = 1 ! Timestep for the pem 232 real :: i_myear_leg ! Number of iteration 233 real :: n_myear_leg ! Maximum number of iterations before stopping 234 real :: i_myear ! Global number of Martian years of the chained simulations 235 real :: n_myear ! Maximum number of Martian years of the chained simulations 236 real :: timestep ! Timestep [s] 237 character(100) :: arg ! To read command-line arguments program was invoked 238 logical :: timewall ! Flag to use the time limit stopping criterion in case of a PEM job 239 integer(kind = 8) :: cr ! Number of clock ticks per second (count rate) 240 integer(kind = 8) :: c1, c2 ! Counts of processor clock 241 character(100) :: chtimelimit ! Time limit for the PEM job outputted by the SLURM command 242 real :: timelimit ! Time limit for the PEM job in seconds 243 real, parameter :: antetime = 1200 ! Anticipation time to prevent reaching the time limit: 1200 s = 20 min by default 244 integer :: cstat, days, hours, minutes, seconds 245 character(1) :: sep 250 246 251 247 #ifdef CPP_STD … … 281 277 real, dimension(nlayer + 1) :: plev 282 278 #else 283 integer, parameter :: jjm_value = jjm 284 real, dimension(:), allocatable :: ap ! Coefficient ap read in start_name and written in restart 285 real, dimension(:), allocatable :: bp ! Coefficient bp read in start_name and written in restart 279 integer, parameter :: jjm_value = jjm 280 real, dimension(:), allocatable :: ap ! Coefficient ap read in start_name and written in restart 281 real, dimension(:), allocatable :: bp ! Coefficient bp read in start_name and written in restart 282 real, dimension(:,:), allocatable :: p ! Grid points x Atmosphere: pressure to recompute and write in restart (ngrid,llmp1) 286 283 #endif 287 284 … … 346 343 347 344 ! Some constants 348 day_ini = 0 ! test349 time_phys = 0. ! test345 day_ini = 0 346 time_phys = 0. 350 347 ngrid = ngridmx 351 A = (1 /m_co2 - 1/m_noco2)352 B = 1 /m_noco2348 A = (1./m_co2 - 1./m_noco2) 349 B = 1./m_noco2 353 350 year_day = 669 354 351 daysec = 88775. … … 399 396 !------------------------ 400 397 ! I_b.1 Read "start.nc" 401 allocate(ps_start (ngrid),ps_start0(ngrid))398 allocate(ps_start0(ngrid)) 402 399 #ifndef CPP_1D 403 400 call dynetat0(start_name,vcov,ucov,teta,q,masse,ps_start_dyn,phis,time_0) 404 401 405 call gr_dyn_fi(1,iip1,jjp1,ngridmx,ps_start_dyn,ps_start )402 call gr_dyn_fi(1,iip1,jjp1,ngridmx,ps_start_dyn,ps_start0) 406 403 407 404 call iniconst ! Initialization of dynamical constants (comconst_mod) … … 417 414 status = nf90_close(ncid) 418 415 419 ! Initialization of physics constants (comcstfi_h)416 ! Initialization of physics constants and variables (comcstfi_h) 420 417 call iniphysiq(iim,jjm,llm,(jjm - 1)*iim + 2,comm_lmdz,daysec,day_ini,dtphys/nsplit_phys,rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,iflag_phys) 421 418 #else 422 ps_start (1) = ps_start_dyn(1)419 ps_start0(1) = ps_start_dyn(1) 423 420 #endif 424 425 ! Save initial surface pressure426 ps_start0 = ps_start427 421 428 422 ! In the PCM, these values are given to the physic by the dynamic. 429 423 ! Here we simply read them in the "startfi.nc" file 430 424 status = nf90_open(startfi_name,NF90_NOWRITE,ncid) 431 432 425 status = nf90_inq_varid(ncid,"longitude",lonvarid) 433 426 status = nf90_get_var(ncid,lonvarid,longitude) 434 435 427 status = nf90_inq_varid(ncid,"latitude",latvarid) 436 428 status = nf90_get_var(ncid,latvarid,latitude) 437 438 429 status = nf90_inq_varid(ncid,"area",areavarid) 439 430 status = nf90_get_var(ncid,areavarid,cell_area) 440 441 431 status = nf90_inq_varid(ncid,"soildepth",sdvarid) 442 432 status = nf90_get_var(ncid,sdvarid,mlayer) 443 444 433 status = nf90_close(ncid) 445 434 … … 465 454 allocate(qsoil_read_generic(ngrid,nsoilmx,nqsoil,nslope)) 466 455 allocate(emis_read_generic(ngrid)) 456 allocate(albedo_read_generic(ngrid,2)) 457 allocate(qsurf(ngrid,nq,1)) 467 458 allocate(tsurf(ngrid,1)) 468 allocate(qsurf(ngrid,nq,1))469 459 allocate(tsoil(ngrid,nsoilmx,1)) 470 460 allocate(emis(ngrid,1)) 471 461 allocate(watercap(ngrid,1)) 472 462 allocate(watercaptag(ngrid)) 473 allocate(albedo_read_generic(ngrid,2))474 463 allocate(albedo(ngrid,2,1)) 475 464 allocate(inertiesoil(ngrid,nsoilmx,1)) … … 503 492 qsurf(:,:,1) = qsurf_read_generic 504 493 where (qsurf < 0.) qsurf = 0. 494 495 deallocate(tsurf_read_generic,qsurf_read_generic,qsoil_read_generic,emis_read_generic) 505 496 #endif 506 497 … … 523 514 if (abs(def_slope_mean(islope)) < abs(def_slope_mean(iflat))) iflat = islope 524 515 enddo 525 526 516 write(*,*) 'Flat slope for islope = ',iflat 527 517 write(*,*) 'corresponding criterium = ',def_slope_mean(iflat) 528 518 529 allocate(flag_co2flow(ngrid,nslope))530 allocate(flag_co2flow_mesh(ngrid))531 allocate(flag_h2oflow(ngrid,nslope))532 allocate(flag_h2oflow_mesh(ngrid))533 534 flag_co2flow = 0535 flag_co2flow_mesh = 0536 flag_h2oflow = 0537 flag_h2oflow_mesh = 0538 539 519 !------------------------ 540 520 ! I Initialization … … 544 524 call get_timelen_PCM("data_PCM_Y1.nc",timelen) 545 525 546 allocate(watersoil_density_PEM_avg(ngrid,nsoilmx_PEM,nslope)) 547 allocate(vmr_co2_PCM(ngrid,timelen)) 548 allocate(ps_timeseries(ngrid,timelen),ps_avg(ngrid),ps_dev(ngrid)) 526 allocate(vmr_co2_PCM(ngrid,timelen),q_co2_PEM_phys(ngrid,timelen),q_h2o_PEM_phys(ngrid,timelen)) 527 allocate(ps_timeseries(ngrid,timelen),ps_avg(ngrid)) 549 528 allocate(min_co2_ice(ngrid,nslope,2),min_h2o_ice(ngrid,nslope,2)) 550 allocate(tsurf_avg_yr1(ngrid,nslope),tsurf_avg(ngrid,nslope),tsurf_avg_old(ngrid,nslope),tsurf_dev(ngrid,nslope)) 551 allocate(tsoil_avg(ngrid,nsoilmx,nslope),tsoil_dev(ngrid,nsoilmx,nslope)) 552 allocate(tsoil_timeseries(ngrid,nsoilmx,nslope,timelen),tsoil_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen)) 553 allocate(zshift_surf(ngrid,nslope),zlag(ngrid,nslope)) 554 allocate(q_co2_PEM_phys(ngrid,timelen),q_h2o_PEM_phys(ngrid,timelen)) 555 allocate(watersurf_density_avg(ngrid,nslope)) 556 allocate(watersoil_density_timeseries(ngrid,nsoilmx,nslope,timelen),watersoil_density_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen)) 557 allocate(delta_co2_adsorbed(ngrid)) 558 allocate(co2ice_disappeared(ngrid,nslope)) 559 allocate(icetable_thickness_old(ngrid,nslope),ice_porefilling_old(ngrid,nsoilmx_PEM,nslope)) 560 allocate(delta_h2o_icetablesublim(ngrid),delta_h2o_adsorbed(ngrid)) 561 allocate(vmr_co2_PEM_phys(ngrid,timelen)) 529 allocate(tsurf_avg_yr1(ngrid,nslope),tsurf_avg(ngrid,nslope)) 530 allocate(tsoil_avg(ngrid,nsoilmx,nslope),tsoil_timeseries(ngrid,nsoilmx,nslope,timelen),tsoil_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen)) 531 allocate(watersurf_density_avg(ngrid,nslope),watersoil_density_timeseries(ngrid,nsoilmx,nslope,timelen)) 562 532 563 533 call read_data_PCM("data_PCM_Y1.nc","data_PCM_Y2.nc",timelen,iim,jjm_value,ngrid,nslope,vmr_co2_PCM,ps_timeseries,ps_avg,tsurf_avg_yr1,tsurf_avg, & … … 565 535 566 536 ! Compute the deviation from the average 567 ps_dev = ps_start - ps_avg 537 allocate(ps_dev(ngrid),tsurf_dev(ngrid,nslope),tsoil_dev(ngrid,nsoilmx,nslope)) 538 ps_dev = ps_start0 - ps_avg 568 539 tsurf_dev = tsurf - tsurf_avg 569 540 tsoil_dev = tsoil - tsoil_avg(:,1:nsoilmx,:) … … 580 551 call ini_ice_table(ngrid,nslope,nsoilmx_PEM) 581 552 553 allocate(watersoil_density_PEM_avg(ngrid,nsoilmx_PEM,nslope),watersoil_density_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen)) 582 554 if (soil_pem) then 583 555 call soil_settings_PEM(ngrid,nslope,nsoilmx_PEM,nsoilmx,inertiesoil,TI_PEM) … … 598 570 ! I_f Compute tendencies 599 571 !------------------------ 600 allocate(d_co2ice(ngrid,nslope),d_h2oice(ngrid,nslope)) 601 allocate(d_co2ice_ini(ngrid,nslope)) 602 603 ! Compute the tendencies of the evolution of ice over the years 572 allocate(d_co2ice(ngrid,nslope),d_h2oice(ngrid,nslope),d_co2ice_ini(ngrid,nslope)) 604 573 call compute_tend(ngrid,nslope,min_co2_ice,d_co2ice) 605 574 call compute_tend(ngrid,nslope,min_h2o_ice,d_h2oice) … … 621 590 ! I_h Read the "startpem.nc" 622 591 !------------------------ 623 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope) )624 allocate( stratif(ngrid,nslope))592 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope),stratif(ngrid,nslope)) 593 allocate(delta_h2o_adsorbed(ngrid),delta_co2_adsorbed(ngrid),delta_h2o_icetablesublim(ngrid)) 625 594 if (layering_algo) then 626 595 do islope = 1,nslope … … 631 600 endif 632 601 602 delta_h2o_icetablesublim = 0. 633 603 call pemetat0("startpem.nc",ngrid,nsoilmx,nsoilmx_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,icetable_depth, & 634 604 icetable_thickness,ice_porefilling,tsurf_avg_yr1,tsurf_avg,q_co2_PEM_phys,q_h2o_PEM_phys, & … … 639 609 ! We save the places where h2o ice is sublimating 640 610 ! We compute the surface of h2o ice sublimating 641 allocate(is_co2ice_sublim_ini(ngrid,nslope),is_h2oice_sublim_ini(ngrid,nslope),is_co2ice_ini(ngrid,nslope) )611 allocate(is_co2ice_sublim_ini(ngrid,nslope),is_h2oice_sublim_ini(ngrid,nslope),is_co2ice_ini(ngrid,nslope),co2ice_disappeared(ngrid,nslope)) 642 612 co2ice_sublim_surf_ini = 0. 643 613 h2oice_ini_surf = 0. … … 662 632 write(*,*) "Total initial surface of h2o ice sublimating (slope) =", h2oice_ini_surf 663 633 664 delta_h2o_icetablesublim = 0.665 634 666 635 if (adsorption_pem) then … … 763 732 ! II.a.3. Tracers timeseries 764 733 write(*,*) "Recomputing of tracer VMR timeseries for the new pressure..." 734 allocate(vmr_co2_PEM_phys(ngrid,timelen)) 765 735 l = 1 766 736 do ig = 1,ngrid … … 795 765 ! II_b Evolution of ice 796 766 !------------------------ 767 allocate(zshift_surf(ngrid,nslope),zlag(ngrid,nslope)) 797 768 call evol_h2o_ice(ngrid,nslope,cell_area,delta_h2o_adsorbed,delta_h2o_icetablesublim,h2o_ice,d_h2oice,zshift_surf,stopPEM) 798 769 call evol_co2_ice(ngrid,nslope,co2_ice,d_co2ice,zshift_surf) … … 811 782 ! II_c Flow of glaciers 812 783 !------------------------ 784 allocate(flag_co2flow(ngrid,nslope),flag_h2oflow(ngrid,nslope)) 813 785 if (co2ice_flow .and. nslope > 1) call flow_co2glaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,vmr_co2_PEM_phys, & 814 ps_timeseries,ps_avg_global_old,ps_avg_global_new,co2_ice,flag_co2flow ,flag_co2flow_mesh)815 if (h2oice_flow .and. nslope > 1) call flow_h2oglaciers(ngrid,nslope,iflat,subslope_dist,def_slope_mean,tsurf_avg,h2o_ice,flag_h2oflow ,flag_h2oflow_mesh)786 ps_timeseries,ps_avg_global_old,ps_avg_global_new,co2_ice,flag_co2flow) 787 if (h2oice_flow .and. nslope > 1) call flow_h2oglaciers(ngrid,nslope,iflat,subslope_dist,def_slope_mean,tsurf_avg,h2o_ice,flag_h2oflow) 816 788 817 789 !------------------------ … … 854 826 ! II_d.2 Shifting soil temperature to surface 855 827 call shift_tsoil2surf(ngrid,nsoilmx_PEM,nslope,zshift_surf,zlag,tsurf_avg,tsoil_PEM) 828 deallocate(zshift_surf,zlag) 856 829 857 830 ! II_d.3 Update soil temperature … … 880 853 881 854 ! II_d.4 Update the ice table 855 allocate(icetable_thickness_old(ngrid,nslope),ice_porefilling_old(ngrid,nsoilmx_PEM,nslope)) 882 856 if (icetable_equilibrium) then 883 857 write(*,*) "Compute ice table (equilibrium method)" … … 899 873 call compute_massh2o_exchange_ssi(ngrid,nslope,nsoilmx_PEM,icetable_thickness_old,ice_porefilling_old,tsurf_avg, tsoil_PEM,delta_h2o_icetablesublim) ! Mass of H2O exchange between the ssi and the atmosphere 900 874 endif 875 deallocate(icetable_thickness_old,ice_porefilling_old) 901 876 902 877 ! II_d.5 Update the soil thermal properties … … 944 919 call writediagpem(ngrid,'d_h2oice_slope'//str2,'H2O ice tend','kg.m-2.year-1',2,d_h2oice(:,islope)) 945 920 call writediagpem(ngrid,'d_co2ice_slope'//str2,'CO2 ice tend','kg.m-2.year-1',2,d_co2ice(:,islope)) 946 call writediagpem(ngrid,'Flow_co2ice_slope'//str2,'CO2 ice flow','Boolean',2,flag_co2flow(:,islope)) 921 call writediagpem(ngrid,'Flow_co2ice_slope'//str2,'CO2 ice flow','Boolean',2,real(flag_co2flow(:,islope))) 922 call writediagpem(ngrid,'Flow_h2oice_slope'//str2,'H2O ice flow','Boolean',2,real(flag_h2oflow(:,islope))) 947 923 call writediagpem(ngrid,'tsurf_slope'//str2,'tsurf','K',2,tsurf_avg(:,islope)) 948 924 if (icetable_equilibrium) then … … 963 939 endif 964 940 enddo 941 deallocate(flag_co2flow,flag_h2oflow) 965 942 966 943 !------------------------ … … 969 946 !------------------------ 970 947 call recomp_tend_co2(ngrid,nslope,timelen,d_co2ice,d_co2ice_ini,co2_ice,emis,vmr_co2_PCM,vmr_co2_PEM_phys,ps_timeseries,ps_avg_global_old,ps_avg_global_new) 948 deallocate(vmr_co2_PEM_phys) 971 949 972 950 !------------------------ … … 1011 989 endif 1012 990 enddo ! big time iteration loop of the pem 991 deallocate(vmr_co2_PCM,q_co2_PEM_phys,q_h2o_PEM_phys,delta_co2_adsorbed) 992 deallocate(watersoil_density_PEM_avg,watersurf_density_avg,) 993 deallocate(ps_timeseries,tsoil_PEM_timeseries,watersoil_density_PEM_timeseries) 994 deallocate(co2ice_disappeared,delta_h2o_adsorbed,delta_h2o_icetablesublim) 995 deallocate(d_co2ice,d_co2ice_ini,d_h2oice) 996 deallocate(is_co2ice_ini,is_co2ice_sublim_ini,is_h2oice_sublim_ini) 997 if (layering_algo) then 998 do islope = 1,nslope 999 do i = 1,ngrid 1000 call del_layering(stratif(i,islope)) 1001 enddo 1002 enddo 1003 deallocate(new_str,new_lag1,new_lag2,current1,current2) 1004 endif 1013 1005 !------------------------------ END RUN -------------------------------- 1014 1006 … … 1048 1040 ! III.a.2. Tsurf update for start file 1049 1041 tsurf = tsurf_avg + tsurf_dev 1042 deallocate(tsurf_dev) 1050 1043 1051 1044 ! III_a.3 Tsoil update for start file … … 1061 1054 #endif 1062 1055 endif 1056 deallocate(tsurf_avg,tsoil_dev) 1063 1057 1064 1058 ! III_a.4 Pressure update for start file 1059 allocate(ps_start(ngrid)) 1065 1060 ps_start = ps_avg + ps_dev 1061 deallocate(ps_avg,ps_dev) 1066 1062 1067 1063 ! III_a.5 Tracers update for start file … … 1090 1086 endif 1091 1087 enddo 1088 deallocate(zplev_start0) 1092 1089 1093 1090 ! Conserving the tracers mass for start file … … 1105 1102 enddo 1106 1103 enddo 1107 deallocate(zplev_ start0,zplev_new)1104 deallocate(zplev_new) 1108 1105 1109 1106 ! III_a.6 Albedo update for start file … … 1155 1152 ztime_fin = time_phys 1156 1153 1157 allocate(p(ip1jmp1,nlayer + 1))1158 1154 #ifndef CPP_1D 1155 allocate(p(ip1jmp1,nlayer + 1)) 1159 1156 ! Correction on teta due to surface pressure changes 1160 1157 do l = 1,nlayer … … 1169 1166 call dynredem0("restart.nc",day_ini,phis) 1170 1167 call dynredem1("restart.nc",time_0,vcov,ucov,teta,q,masse,ps_start) 1171 write(*,*) "restart.nc has been written" 1168 write(*,*) "restart.nc has been written." 1169 deallocate(ap,bp,p) 1172 1170 #else 1173 1171 call writerestart1D('restart1D.txt',ps_start(1),tsurf(1,:),nlayer,size(tsurf,2),teta,ucov,vcov,nq,noms,qsurf(1,:,:),q) 1174 write(*,*) "restart1D.txt has been written "1172 write(*,*) "restart1D.txt has been written." 1175 1173 #endif 1174 deallocate(ps_start0,ps_start) 1176 1175 1177 1176 ! III_b.2 Write the "restartfi.nc" … … 1185 1184 wstar,watercap,perennial_co2ice) 1186 1185 #else 1186 if (allocated(noms)) deallocate(noms) 1187 deallocate(qsurf,tsurf,tsoil,emis,watercap,watercaptag,albedo,inertiesoil) 1187 1188 call physdem0("restartfi.nc",longitude,latitude,nsoilmx,ngrid, & 1188 1189 nlayer,nq,ptimestep,pday,time_phys,cell_area, & … … 1193 1194 tsea_ice,sea_ice) 1194 1195 #endif 1195 write(*,*) "restartfi.nc has been written "1196 write(*,*) "restartfi.nc has been written." 1196 1197 1197 1198 !------------------------ … … 1203 1204 call pemdem1("restartpem.nc",i_myear,nsoilmx_PEM,ngrid,nslope,tsoil_PEM,TI_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 1204 1205 co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice,stratif) 1205 write(*,*) "restartpem.nc has been written "1206 write(*,*) "restartpem.nc has been written." 1206 1207 1207 1208 call info_PEM(i_myear_leg,stopPEM,i_myear,n_myear) … … 1218 1219 enddo 1219 1220 enddo 1220 deallocate(new_str,new_lag1,new_lag2,current1,current2)1221 1221 endif 1222 deallocate(ps_start,ps_start0,ps_timeseries,ps_avg,ps_dev) 1223 deallocate(tsurf_avg,tsurf_dev,tsurf_avg_old) 1224 deallocate(tsoil_PEM,tsoil_dev,tsoil_PEM_timeseries) 1225 deallocate(vmr_co2_PCM,vmr_co2_PEM_phys,q_co2_PEM_phys,q_h2o_PEM_phys) 1226 deallocate(watersurf_density_avg,watersoil_density_PEM_timeseries,watersoil_density_PEM_avg) 1227 deallocate(delta_co2_adsorbed,delta_h2o_adsorbed,delta_h2o_icetablesublim) 1228 deallocate(icetable_thickness_old,ice_porefilling_old,zshift_surf,zlag) 1229 deallocate(is_co2ice_ini,co2ice_disappeared,is_co2ice_sublim_ini,is_h2oice_sublim_ini,stratif) 1222 deallocate(q,longitude,latitude,cell_area,tsoil_PEM) 1223 deallocate(co2_ice,h2o_ice,stratif) 1230 1224 !----------------------------- END OUTPUT ------------------------------ 1231 1225 -
trunk/LMDZ.COMMON/libf/evolution/pemredem.F90
r3571 r3591 121 121 call put_field("mco2_reg_ads_slope"//num, "Mass of CO2 adsorbed in the regolith",m_co2_regolith(:,:,islope),Year) 122 122 call put_field("mh2o_reg_ads_slope"//num, "Mass of H2O adsorbed in the regolith",m_h2o_regolith(:,:,islope),Year) 123 call put_field("ice_porefilling"//num,"Subsurface ice pore filling",ice_porefilling(:,:,islope),Year) 123 124 enddo 124 125 call put_field("icetable_depth","Depth of ice table",icetable_depth,Year) 125 126 call put_field("icetable_thickness","Depth of ice table",icetable_thickness,Year) 126 call put_field("ice_porefilling","Subsurface ice pore filling",ice_porefilling,Year)127 127 call put_field("inertiedat_PEM","Thermal inertie of PEM ",inertiedat_PEM,Year) 128 128 endif ! soil_pem -
trunk/LMDZ.COMMON/libf/evolution/read_data_PCM_mod.F90
r3571 r3591 84 84 if (nslope == 1) then ! There is no slope 85 85 call get_var3("co2ice",co2_ice_slope_dyn(:,:,1,:)) 86 write(*,*) "Data for co2_ice downloaded !"86 write(*,*) "Data for co2_ice downloaded." 87 87 88 88 call get_var3("h2o_ice_s",h2o_ice_s_dyn(:,:,1,:)) 89 write(*,*) "Data for h2o_ice_s downloaded !"89 write(*,*) "Data for h2o_ice_s downloaded." 90 90 91 91 call get_var3("tsurf",tsurf_dyn(:,:,1,:)) 92 write(*,*) "Data for tsurf downloaded !"92 write(*,*) "Data for tsurf downloaded." 93 93 94 94 #ifndef CPP_STD 95 95 call get_var3("watercap",watercap(:,:,1,:)) 96 write(*,*) "Data for watercap downloaded !"96 write(*,*) "Data for watercap downloaded." 97 97 98 98 call get_var3("perennial_co2ice",perennial_co2ice(:,:,1,:)) 99 write(*,*) "Data for perennial_co2ice downloaded !"99 write(*,*) "Data for perennial_co2ice downloaded." 100 100 #endif 101 101 else ! We use slopes … … 104 104 call get_var3("co2ice_slope"//num,co2_ice_slope_dyn(:,:,islope,:)) 105 105 enddo 106 write(*,*) "Data for co2_ice downloaded !"106 write(*,*) "Data for co2_ice downloaded." 107 107 108 108 do islope = 1,nslope … … 110 110 call get_var3("h2o_ice_s_slope"//num,h2o_ice_s_dyn(:,:,islope,:)) 111 111 enddo 112 write(*,*) "Data for h2o_ice_s downloaded !"112 write(*,*) "Data for h2o_ice_s downloaded." 113 113 114 114 do islope = 1,nslope … … 116 116 call get_var3("tsurf_slope"//num,tsurf_dyn(:,:,islope,:)) 117 117 enddo 118 write(*,*) "Data for tsurf downloaded !"118 write(*,*) "Data for tsurf downloaded." 119 119 120 120 #ifndef CPP_STD … … 123 123 call get_var3("watercap_slope"//num,watercap(:,:,islope,:)) 124 124 enddo 125 write(*,*) "Data for watercap downloaded !"125 write(*,*) "Data for watercap downloaded." 126 126 127 127 do islope = 1,nslope … … 129 129 call get_var3("perennial_co2ice_slope"//num,perennial_co2ice(:,:,islope,:)) 130 130 enddo 131 write(*,*) "Data for perennial_co2ice downloaded !"131 write(*,*) "Data for perennial_co2ice downloaded." 132 132 #endif 133 133 endif … … 170 170 ! Download the data from the file 171 171 call get_var3("ps",ps_dyn) 172 write(*,*) "Data for surface pressure downloaded !"172 write(*,*) "Data for surface pressure downloaded." 173 173 174 174 call get_var3("co2_layer1",q_co2_dyn) 175 write(*,*) "Data for vmr co2 downloaded !"175 write(*,*) "Data for vmr co2 downloaded." 176 176 177 177 call get_var3("h2o_layer1",q_h2o_dyn) 178 write(*,*) "Data for vmr h2o downloaded !"178 write(*,*) "Data for vmr h2o downloaded." 179 179 180 180 if (nslope == 1) then ! There is no slope 181 181 call get_var3("co2ice",co2_ice_slope_dyn(:,:,1,:)) 182 write(*,*) "Data for co2_ice downloaded !"182 write(*,*) "Data for co2_ice downloaded." 183 183 184 184 call get_var3("h2o_ice_s",h2o_ice_s_dyn(:,:,1,:)) 185 write(*,*) "Data for h2o_ice_s downloaded !"185 write(*,*) "Data for h2o_ice_s downloaded." 186 186 187 187 call get_var3("tsurf",tsurf_dyn(:,:,1,:)) 188 write(*,*) "Data for tsurf downloaded !"188 write(*,*) "Data for tsurf downloaded." 189 189 190 190 #ifndef CPP_STD 191 191 call get_var3("watercap",watercap(:,:,1,:)) 192 write(*,*) "Data for watercap downloaded !"192 write(*,*) "Data for watercap downloaded." 193 193 194 194 call get_var3("perennial_co2ice",perennial_co2ice(:,:,1,:)) 195 write(*,*) "Data for perennial_co2ice downloaded !"195 write(*,*) "Data for perennial_co2ice downloaded." 196 196 197 197 if (soil_pem) then 198 198 call get_var4("soiltemp",tsoil_dyn(:,:,:,1,:)) 199 write(*,*) "Data for soiltemp downloaded !"199 write(*,*) "Data for soiltemp downloaded." 200 200 201 201 call get_var4("waterdensity_soil",watersoil_density_dyn(:,:,:,1,:)) 202 write(*,*) "Data for waterdensity_soil downloaded !"202 write(*,*) "Data for waterdensity_soil downloaded." 203 203 204 204 call get_var3("waterdensity_surface",watersurf_density_dyn(:,:,1,:)) 205 write(*,*) "Data for waterdensity_surface downloaded !"205 write(*,*) "Data for waterdensity_surface downloaded." 206 206 endif !soil_pem 207 207 #endif … … 211 211 call get_var3("co2ice_slope"//num,co2_ice_slope_dyn(:,:,islope,:)) 212 212 enddo 213 write(*,*) "Data for co2_ice downloaded !"213 write(*,*) "Data for co2_ice downloaded." 214 214 215 215 do islope = 1,nslope … … 217 217 call get_var3("h2o_ice_s_slope"//num,h2o_ice_s_dyn(:,:,islope,:)) 218 218 enddo 219 write(*,*) "Data for h2o_ice_s downloaded !"219 write(*,*) "Data for h2o_ice_s downloaded." 220 220 221 221 do islope = 1,nslope … … 223 223 call get_var3("tsurf_slope"//num,tsurf_dyn(:,:,islope,:)) 224 224 enddo 225 write(*,*) "Data for tsurf downloaded !"225 write(*,*) "Data for tsurf downloaded." 226 226 227 227 #ifndef CPP_STD … … 230 230 call get_var3("watercap_slope"//num,watercap(:,:,islope,:)) 231 231 enddo 232 write(*,*) "Data for watercap downloaded !"232 write(*,*) "Data for watercap downloaded." 233 233 234 234 do islope = 1,nslope … … 236 236 call get_var3("perennial_co2ice_slope"//num,perennial_co2ice(:,:,islope,:)) 237 237 enddo 238 write(*,*) "Data for perennial_co2ice downloaded !"238 write(*,*) "Data for perennial_co2ice downloaded." 239 239 240 240 if (soil_pem) then … … 243 243 call get_var4("soiltemp_slope"//num,tsoil_dyn(:,:,:,islope,:)) 244 244 enddo 245 write(*,*) "Data for soiltemp downloaded !"245 write(*,*) "Data for soiltemp downloaded." 246 246 247 247 do islope = 1,nslope … … 249 249 call get_var4("waterdensity_soil_slope"//num,watersoil_density_dyn(:,:,:,islope,:)) 250 250 enddo 251 write(*,*) "Data for waterdensity_soil downloaded !"251 write(*,*) "Data for waterdensity_soil downloaded." 252 252 253 253 do islope = 1,nslope … … 255 255 call get_var3("waterdensity_surface"//num,watersurf_density_dyn(:,:,islope,:)) 256 256 enddo 257 write(*,*) "Data for waterdensity_surface downloaded !"257 write(*,*) "Data for waterdensity_surface downloaded." 258 258 endif !soil_pem 259 259 #endif
Note: See TracChangeset
for help on using the changeset viewer.