Changeset 3603


Ignore:
Timestamp:
Jan 28, 2025, 5:16:15 PM (37 hours ago)
Author:
jbclement
Message:

PEM:

  • Bug correction about the pressure/teta reconstruction for the PCM (mismatch between the physical and dynamical grid).
  • Improvement of messages giving info about the PEM workflow in the terminal.

JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3602 r3603  
    562562- In case of very low surface shifting, checking if the index is inside the bounds of 'tsoil' and 'mlayer' and replace them by the value at surface if necessary.
    563563- Few cleanings.
     564
     565== 28/01/2025 == JBC
     566- Bug correction about the pressure/teta reconstruction for the PCM (mismatch between the physical and dynamical grid).
     567- Improvement of messages giving info about the PEM workflow in the terminal.
  • trunk/LMDZ.COMMON/libf/evolution/evol_ice_mod.F90

    r3571 r3603  
    3434!=======================================================================
    3535! Evolution of CO2 ice for each physical point
    36 write(*,*) 'Evolution of co2 ice'
     36write(*,*) '> Evolution of CO2 ice'
    3737
    3838co2_ice_old = co2_ice
     
    8888real, dimension(ngrid,nslope) :: new_tend                                            ! Tendencies computed in order to conserve h2o ice on the surface, only exchange between surface are done
    8989!=======================================================================
     90write(*,*) '> Evolution of H2O ice'
    9091if (ngrid /= 1) then ! Not in 1D
    9192    ! We compute the amount of condensing and sublimating h2o ice
  • trunk/LMDZ.COMMON/libf/evolution/glaciers_mod.F90

    r3591 r3603  
    5353real, dimension(ngrid,nslope) :: hmax  ! Grid points x Slope field: maximum thickness for co2  glacier before flow
    5454
    55 write(*,*) "Flow of CO2 glaciers"
     55write(*,*) "> Flow of CO2 glaciers"
    5656call computeTcondCO2(timelen,ngrid,nslope,vmr_co2_PEM,ps_PCM,ps_avg_global_ini,ps_avg_global,Tcond)
    5757call compute_hmaxglaciers(ngrid,nslope,iflat,def_slope_mean,Tcond,"co2",hmax)
     
    9393real, dimension(ngrid,nslope) :: hmax ! Grid points x Slope field: maximum thickness for co2  glacier before flow
    9494
    95 write(*,*) "Flow of H2O glaciers"
     95write(*,*) "> Flow of H2O glaciers"
    9696call compute_hmaxglaciers(ngrid,nslope,iflat,def_slope_mean,Tice,"h2o",hmax)
    9797call transfer_ice_duringflow(ngrid,nslope,iflat,subslope_dist,def_slope_mean,hmax,Tice,h2oice,flag_h2oflow)
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3602 r3603  
    139139real, dimension(ip1jmp1,llm)        :: teta          ! Potential temperature
    140140real, dimension(:,:,:), allocatable :: q             ! champs advectes
    141 real, dimension(ip1jmp1)            :: ps_start_dyn  ! surface pressure in the start file (dynamic grid)
     141real, dimension(:),     allocatable :: pdyn          ! pressure for the dynamic grid
    142142real, dimension(:),     allocatable :: ps_start      ! surface pressure in the start file
    143143real, dimension(:),     allocatable :: ps_start0     ! surface pressure in the start file at the beginning
     
    286286integer :: i, l, ig, nnq, t, islope, ig_loop, islope_loop, isoil, icap
    287287logical :: num_str
     288
     289write(*,*) '  *    .          .   +     .    *        .. +      .    .       .      '
     290write(*,*) '           +         _______  ________  ____    ____      *           + '
     291write(*,*) ' +   .        *     |_   __ \|_   __  ||_   \  /   _|          .       *'
     292write(*,*) '          .     .     | |__) | | |_ \_|  |   \/   |  *        *      .  '
     293write(*,*) '       .              |  ___/  |  _| _   | |\  /| |      .        .     '
     294write(*,*) '.  *          *      _| |_    _| |__/ | _| |_\/_| |_                  * '
     295write(*,*) '                    |_____|  |________||_____||_____|   +     .         '
     296write(*,*) '  .      *          .   *      ..   +       *          .        +      .'
    288297
    289298! Elapsed time with system clock
     
    371380!    I_a Read the "run.def"
    372381!------------------------
     382write(*,*) '> Reading "run.def" (PEM)'
    373383#ifndef CPP_1D
    374384    dtphys = daysec/48. ! Dummy value (overwritten in phyetat0)
     
    379389    allocate(longitude(ngrid),latitude(ngrid),cell_area(ngrid))
    380390#else
    381     allocate(q(1,llm,nqtot))
     391    allocate(q(1,llm,nqtot),pdyn(1))
    382392    allocate(longitude(1),latitude(1),cell_area(1))
    383393
     
    395405    endif
    396406
    397     call init_testphys1d('start1D.txt','startfi.nc',therestart1D,therestartfi,ngrid,nlayer,610.,nq,q,                 &
    398                          time_0,ps_start_dyn(1),ucov,vcov,teta,ndt,ptif,pks,dtphys,zqsat,dq,dqdyn,day0,day,gru,grv,w, &
     407    write(*,*) '> Reading "start1D.txt" and "startfi.nc"'
     408    call init_testphys1d('start1D.txt','startfi.nc',therestart1D,therestartfi,ngrid,nlayer,610.,nq,q,      &
     409                         time_0,pdyn,ucov,vcov,teta,ndt,ptif,pks,dtphys,zqsat,dq,dqdyn,day0,day,gru,grv,w, &
    399410                         play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
    400     ps_start_dyn(2) = ps_start_dyn(1)
    401411    nsplit_phys = 1
    402412    day_step = steps_per_sol
     
    410420!------------------------
    411421! I_b.1 Read "start.nc"
     422write(*,*) '> Reading "start.nc"'
    412423allocate(ps_start0(ngrid))
    413424#ifndef CPP_1D
    414     call dynetat0(start_name,vcov,ucov,teta,q,masse,ps_start_dyn,phis,time_0)
    415 
    416     call gr_dyn_fi(1,iip1,jjp1,ngridmx,ps_start_dyn,ps_start0)
     425    allocate(pdyn(ip1jmp1))
     426    call dynetat0(start_name,vcov,ucov,teta,q,masse,pdyn,phis,time_0)
     427
     428    call gr_dyn_fi(1,iip1,jjp1,ngridmx,pdyn,ps_start0)
    417429
    418430    call iniconst ! Initialization of dynamical constants (comconst_mod)
     
    431443    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)
    432444#else
    433     ps_start0(1) = ps_start_dyn(1)
     445    ps_start0 = pdyn
    434446#endif
     447deallocate(pdyn)
    435448
    436449! In the PCM, these values are given to the physic by the dynamic.
     
    450463! First we read the initial state (starfi.nc)
    451464#ifndef CPP_STD
     465    write(*,*) '> Reading "startfi.nc"'
    452466    call phyetat0(startfi_name,0,0,nsoilmx,ngrid,nlayer,nq,nqsoil,day_ini,time_phys,tsurf, &
    453467                  tsoil,albedo,emis,q2,qsurf,qsoil,tauscaling,totcloudfrac,wstar,          &
     
    510524#endif
    511525
    512 do nnq = 1,nqtot  ! Why not using ini_tracer ?
     526do nnq = 1,nqtot  ! Why not using ini_tracer?
    513527    if (noms(nnq) == "h2o_ice") igcm_h2o_ice = nnq
    514528    if (noms(nnq) == "h2o_vap") then
     
    529543enddo
    530544write(*,*) 'Flat slope for islope = ',iflat
    531 write(*,*) 'corresponding criterium = ',def_slope_mean(iflat)
     545write(*,*) 'Corresponding criterium = ',def_slope_mean(iflat)
    532546
    533547!------------------------
     
    597611ps_avg_global_ini = sum(cell_area*ps_avg)/total_surface
    598612ps_avg_global_new = ps_avg_global_ini
    599 write(*,*) "Total surface of the planet =", total_surface
     613write(*,*) "Total surface of the planet      =", total_surface
    600614write(*,*) "Initial global averaged pressure =", ps_avg_global_ini
    601615
     
    604618!    I_h Read the "startpem.nc"
    605619!------------------------
     620write(*,*) '> Reading "startpem.nc"'
    606621allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope),stratif(ngrid,nslope))
    607622allocate(delta_h2o_adsorbed(ngrid),delta_co2_adsorbed(ngrid),delta_h2o_icetablesublim(ngrid))
     
    642657    enddo
    643658enddo
    644 write(*,*) "Total initial surface of co2 ice sublimating (slope) =", co2ice_sublim_surf_ini
    645 write(*,*) "Total initial surface of h2o ice sublimating (slope) =", h2oice_ini_surf
    646 
     659write(*,*) "Total initial surface of CO2 ice sublimating =", co2ice_sublim_surf_ini
     660write(*,*) "Total initial surface of H2O ice sublimating =", h2oice_ini_surf
    647661
    648662if (adsorption_pem) then
     
    707721do while (i_myear_leg < n_myear_leg .and. i_myear < n_myear)
    708722! II.a.1. Compute updated global pressure
    709     write(*,*) "Recomputing the new pressure..."
     723    write(*,*) "> Updating the surface pressure"
    710724    ps_avg_global_old = ps_avg_global_new
    711725    do i = 1,ngrid
     
    720734        enddo
    721735    endif
    722     write(*,*) 'Global average pressure old time step',ps_avg_global_old
    723     write(*,*) 'Global average pressure new time step',ps_avg_global_new
     736    write(*,*) 'Global average pressure old time step:',ps_avg_global_old
     737    write(*,*) 'Global average pressure new time step:',ps_avg_global_new
    724738
    725739! II.a.2. Pressure timeseries (the values are deleted when unused because of big memory consumption)
     740    write(*,*) "> Updating the surface pressure timeseries for the new pressure"
    726741    allocate(zplev_timeseries_old(ngrid,nlayer + 1,timelen))
    727     write(*,*) "Recomputing the pressure levels timeseries adapted to the old pressure..."
    728742    do l = 1,nlayer + 1
    729743        do ig = 1,ngrid
     
    731745        enddo
    732746    enddo
    733     write(*,*) "Recomputing the surface pressure timeseries adapted to the new pressure..."
    734747    do ig = 1,ngrid
    735748        ps_timeseries(ig,:) = ps_timeseries(ig,:)*ps_avg_global_new/ps_avg_global_old
    736749    enddo
    737     write(*,*) "Recomputing the pressure levels timeseries adapted to the new pressure..."
     750    write(*,*) "> Updating the pressure levels timeseries for the new pressure"
    738751    allocate(zplev_timeseries_new(ngrid,nlayer + 1,timelen))
    739752    do l = 1,nlayer + 1
     
    744757
    745758! II.a.3. Tracers timeseries
    746     write(*,*) "Recomputing of tracer VMR timeseries for the new pressure..."
     759    write(*,*) "> Updating the tracer VMR timeseries for the new pressure"
    747760    allocate(vmr_co2_PEM_phys(ngrid,timelen))
    748761    l = 1
     
    805818!------------------------
    806819! II_d.1 Update Tsurf
    807     write(*,*) "Updating the new Tsurf"
     820    write(*,*) "> Updating surface temperature"
    808821    do ig = 1,ngrid
    809822        do islope = 1,nslope
     
    811824            if (is_co2ice_ini(ig,islope) .and. co2_ice(ig,islope) < 1.e-10 .and. .not. co2ice_disappeared(ig,islope)) then
    812825                co2ice_disappeared(ig,islope) = .true.
    813                 if (latitude_deg(ig) > 0) then
     826                if (latitude_deg(ig) > 0.) then
    814827                    outer1: do ig_loop = ig,ngrid
    815828                        do islope_loop = islope,iflat,-1
     
    838851    if (soil_pem) then
    839852! II_d.2 Shifting soil temperature to surface
     853        write(*,*) "> Shifting soil temperature profile to match surface evolution"
    840854        call shift_tsoil2surf(ngrid,nsoilmx_PEM,nslope,zshift_surf,zlag,tsurf_avg,tsoil_PEM)
    841855        deallocate(zshift_surf,zlag)
    842856
    843857! II_d.3 Update soil temperature
    844         write(*,*)"Updating soil temperature"
     858        write(*,*)"> Updating soil temperature profile"
    845859        allocate(tsoil_avg_old(ngrid,nsoilmx_PEM))
    846860        do islope = 1,nslope
     
    863877        watersoil_density_PEM_avg = sum(watersoil_density_PEM_timeseries,4)/timelen
    864878        deallocate(tsoil_avg_old)
    865         write(*,*) "Update of soil temperature done"
    866879
    867880! II_d.4 Update the ice table
    868881        allocate(icetable_thickness_old(ngrid,nslope),ice_porefilling_old(ngrid,nsoilmx_PEM,nslope))
    869882        if (icetable_equilibrium) then
    870             write(*,*) "Compute ice table (equilibrium method)"
     883            write(*,*) "> Updating ice table (equilibrium method)"
    871884            icetable_thickness_old = icetable_thickness
    872885            call computeice_table_equilibrium(ngrid,nslope,nsoilmx_PEM,watercaptag,watersurf_density_avg,watersoil_density_PEM_avg,TI_PEM(:,1,:),icetable_depth,icetable_thickness)
    873886            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
    874887        else if (icetable_dynamic) then
    875             write(*,*) "Compute ice table (dynamic method)"
     888            write(*,*) "> Updating ice table (dynamic method)"
    876889            ice_porefilling_old = ice_porefilling
    877890            allocate(porefill(nsoilmx_PEM))
     
    916929                enddo
    917930            enddo
    918             write(*,*) "Tot mass of CO2 in the regolith=", totmassco2_adsorbed
    919             write(*,*) "Tot mass of H2O in the regolith=", totmassh2o_adsorbed
     931            write(*,*) "Total mass of CO2 in the regolith =", totmassco2_adsorbed
     932            write(*,*) "Total mass of H2O in the regolith =", totmassh2o_adsorbed
    920933        endif
    921934    endif !soil_pem
     
    965978!    II_g Checking the stopping criterion
    966979!------------------------
    967     write(*,*) "Checking the stopping criteria..."
     980    write(*,*) "> Checking the stopping criteria"
    968981    call stopping_crit_h2o_ice(cell_area,h2oice_ini_surf,is_h2oice_sublim_ini,h2o_ice,stopPEM,ngrid)
    969982    call stopping_crit_co2(cell_area,co2ice_sublim_surf_ini,is_co2ice_sublim_ini,co2_ice,stopPEM,ngrid,ps_avg_global_ini,ps_avg_global_new,nslope)
     
    9981011    else
    9991012        write(*,*) "The PEM can continue!"
    1000         write(*,*) "Number of iterations of the PEM: i_myear_leg =", i_myear_leg
    1001         write(*,*) "Number of simulated Martian years: i_myear =", i_myear
     1013        write(*,*) "Number of iterations of the PEM  : i_myear_leg =", i_myear_leg
     1014        write(*,*) "Number of simulated Martian years: i_myear     =", i_myear
    10021015    endif
    10031016enddo ! big time iteration loop of the pem
     
    10241037!------------------------
    10251038! III_a.1 Ice update for start file
     1039write(*,*) '> Reconstructing perennial ice and frost for the PCM'
    10261040watercap = 0.
    10271041perennial_co2ice = co2_ice
     
    10521066
    10531067! III.a.2. Tsurf update for start file
     1068write(*,*) '> Reconstructing the surface temperature for the PCM'
    10541069tsurf = tsurf_avg + tsurf_dev
    10551070deallocate(tsurf_dev)
     
    10571072! III_a.3 Tsoil update for start file
    10581073if (soil_pem) then
     1074    write(*,*) '> Reconstructing the soil temperature profile for the PCM'
    10591075    inertiesoil = TI_PEM(:,:nsoilmx,:)
    10601076    ! Tsurf has evolved and so the soil temperature profile needs to be adapted to match this new value
     
    10701086
    10711087! III_a.4 Pressure update for start file
     1088write(*,*) '> Reconstructing the pressure for the PCM'
    10721089allocate(ps_start(ngrid))
    10731090ps_start = ps_avg + ps_dev
     
    10751092
    10761093! III_a.5 Tracers update for start file
     1094write(*,*) '> Reconstructing the tracer VMR for the PCM'
    10771095allocate(zplev_start0(ngrid,nlayer + 1),zplev_new(ngrid,nlayer + 1))
    10781096do l = 1,nlayer + 1
     
    11181136
    11191137! III_a.6 Albedo update for start file
     1138write(*,*) '> Reconstructing the albedo for the PCM'
    11201139do ig = 1,ngrid
    11211140    if (latitude(ig) < 0.) then
     
    11241143        icap = 1 ! Northern hemisphere
    11251144    endif
    1126     do islope = 1,ngrid
     1145    do islope = 1,nslope
    11271146        ! Bare ground
    11281147        albedo(ig,:,islope) = albedodat(ig)
     
    11541173
    11551174! III_a.7 Orbital parameters update for start file
     1175write(*,*) '> Setting the new orbital parameters'
    11561176if (evol_orbit_pem) call recomp_orb_param(i_myear,i_myear_leg)
    11571177
     
    11641184pday = day_ini
    11651185ztime_fin = time_phys
    1166 
    11671186#ifndef CPP_1D
     1187    write(*,*) '> Writing "restart.nc"'
     1188    ! Correction on teta due to surface pressure changes
     1189    allocate(pdyn(ip1jmp1))
     1190    call gr_fi_dyn(1,ngrid,iip1,jjp1,ps_start0/ps_start,pdyn)
     1191    do i = 1,ip1jmp1
     1192        teta(i,:) = teta(i,:)*pdyn(i)**kappa
     1193    enddo
     1194    ! Correction on atmospheric pressure
    11681195    allocate(p(ip1jmp1,nlayer + 1))
    1169     ! Correction on teta due to surface pressure changes
    1170     do l = 1,nlayer
    1171         do i = 1,ip1jmp1
    1172             teta(i,l)= teta(i,l)*(ps_start0(i)/ps_start(i))**kappa
    1173         enddo
    1174     enddo
    1175     ! Correction on atmospheric pressure
    1176     call pression(ip1jmp1,ap,bp,ps_start,p)
     1196    call gr_fi_dyn(1,ngrid,iip1,jjp1,ps_start,pdyn)
     1197    call pression(ip1jmp1,ap,bp,pdyn,p)
    11771198    ! Correction on the mass of atmosphere
    11781199    call massdair(p,masse)
    11791200    call dynredem0("restart.nc",day_ini,phis)
    11801201    call dynredem1("restart.nc",time_0,vcov,ucov,teta,q,masse,ps_start)
    1181     write(*,*) "restart.nc has been written."
    1182     deallocate(ap,bp,p)
     1202    deallocate(ap,bp,p,pdyn)
    11831203#else
     1204    write(*,*) '> Writing "restart1D.txt"'
    11841205    call writerestart1D('restart1D.txt',ps_start(1),tsurf(1,:),nlayer,size(tsurf,2),teta,ucov,vcov,nq,noms,qsurf(1,:,:),q)
    1185     write(*,*) "restart1D.txt has been written."
    11861206#endif
    11871207deallocate(ps_start0,ps_start)
    11881208
    11891209! III_b.2 Write the "restartfi.nc"
     1210write(*,*) '> Writing "restartfi.nc"'
    11901211#ifndef CPP_STD
    11911212    call physdem0("restartfi.nc",longitude,latitude,nsoilmx,ngrid, &
     
    12071228                  tsea_ice,sea_ice)
    12081229#endif
    1209 write(*,*) "restartfi.nc has been written."
    12101230
    12111231!------------------------
     
    12131233!    III_c Write the "restartpem.nc"
    12141234!------------------------
     1235write(*,*) '> Writing "restartpem.nc"'
    12151236if (layering_algo) nb_str_max = get_nb_str_max(stratif,ngrid,nslope) ! Get the maximum number of "stratum" in the stratification (layerings)
    12161237call pemdem0("restartpem.nc",longitude,latitude,cell_area,ngrid,nslope,def_slope,subslope_dist)
    12171238call pemdem1("restartpem.nc",i_myear,nsoilmx_PEM,ngrid,nslope,tsoil_PEM,TI_PEM,icetable_depth,icetable_thickness,ice_porefilling, &
    12181239             co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice,stratif)
    1219 write(*,*) "restartpem.nc has been written."
    12201240
    12211241call info_PEM(i_myear_leg,stopPEM,i_myear,n_myear)
    12221242
    1223 write(*,*) "The PEM has run for", i_myear_leg, "Martian years."
    1224 write(*,*) "The chained simulation has run for", i_myear, "Martian years =", i_myear*convert_years, "Earth years."
    1225 write(*,*) "The reached date is now", (year_bp_ini + i_myear)*convert_years, "Earth years."
    1226 write(*,*) "PEM: so far, so good!"
     1243write(*,*) ">> The PEM has run for", i_myear_leg, "Martian years."
     1244write(*,*) ">> The chained simulation has run for", i_myear, "Martian years =", i_myear*convert_years, "Earth years."
     1245write(*,*) ">> The reached date is now", (year_bp_ini + i_myear)*convert_years, "Earth years."
     1246write(*,*) ">> PEM: so far, so good!"
    12271247
    12281248if (layering_algo) then
  • trunk/LMDZ.COMMON/libf/evolution/read_data_PCM_mod.F90

    r3602 r3603  
    181181! Close the NetCDF file
    182182call error_msg(nf90_close(fID),"close",filename1)
    183 write(*,*) '"'//filename1//'" processed!'
     183write(*,*) '> "'//filename1//'" processed!'
    184184
    185185!------------------------------- Year 2 --------------------------------
     
    445445! Close the NetCDF file
    446446call error_msg(nf90_close(fID),"close",filename2)
    447 write(*,*) '"'//filename2//'" processed!'
     447write(*,*) '"> '//filename2//'" processed!'
    448448
    449449END SUBROUTINE read_data_PCM
  • trunk/LMDZ.COMMON/libf/evolution/recomp_tend_co2_mod.F90

    r3584 r3603  
    4040real    :: coef, avg
    4141
    42 write(*,*) "Update of the CO2 tendency from the current pressure"
     42write(*,*) "> Updating the CO2 ice tendency for the new pressure"
    4343
    4444! Evolution of the water ice for each physical point
  • trunk/LMDZ.COMMON/libf/evolution/writediagpem.F90

    r3532 r3603  
    824824    ierr=NF_INQ_DIMID(nid,"time",id(4))
    825825    ! Tell the world about it
    826     write(*,*) "====================="
    827     write(*,*) "writediagsoilpem: creating variable "//trim(name)
     826    write(*,*) "==========================="
     827    write(*,*) "DIAGSOILPEM: creating variable "//trim(name)
    828828    call def_var(nid,name,title,units,4,id,varid,ierr)
    829829  endif ! of if (ierr.ne.NF_NOERR)
     
    908908    ierr=NF_INQ_DIMID(nid,"time",id(3))
    909909    ! Tell the world about it
    910     write(*,*) "====================="
    911     write(*,*) "writediagsoilpem: creating variable "//trim(name)
     910    write(*,*) "==========================="
     911    write(*,*) "DIAGSOILPEM: creating variable "//trim(name)
    912912    call def_var(nid,name,title,units,3,id,varid,ierr)
    913913  endif ! of if (ierr.ne.NF_NOERR)
     
    959959    ierr=NF_INQ_DIMID(nid,"time",id(1))
    960960    ! Tell the world about it
    961     write(*,*) "====================="
    962     write(*,*) "writediagsoilpem: creating variable "//trim(name)
     961    write(*,*) "==========================="
     962    write(*,*) "DIAGSOILPEM: creating variable "//trim(name)
    963963    call def_var(nid,name,title,units,1,id,varid,ierr)
    964964  endif ! of if (ierr.ne.NF_NOERR)
Note: See TracChangeset for help on using the changeset viewer.