Changeset 3426 for trunk/LMDZ.COMMON


Ignore:
Timestamp:
Sep 6, 2024, 1:32:48 PM (3 months ago)
Author:
jbclement
Message:

PEM:
Modification in the way of updating the soil temperatures to improve the computation time + Small correction in the calculation of 'timestep'.
JBC

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

Legend:

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

    r3424 r3426  
    416416== 02/09/2024 == JBC
    417417Modification to the layering algorithm to make dust lag prevent further sublimation.
     418
     419== 06/09/2024 == JBC
     420Modification in the way of updating the soil temperatures to improve the computation time  + Small correction in the calculation of 'timestep'.
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3419 r3426  
    204204real, dimension(:,:),     allocatable :: tsurf_avg                          ! Physic x SLOPE field: Averaged Surface Temperature [K]
    205205real, dimension(:,:,:),   allocatable :: tsoil_avg                          ! Physic x SOIL x SLOPE field: Averaged Soil Temperature [K]
    206 real, dimension(:,:,:),   allocatable :: tsoil_anom                         ! Amplitude between instataneous and yearly average soil temperature [K]
    207206real, dimension(:,:,:),   allocatable :: tsurf_PCM_timeseries               ! ngrid x SLOPE x TIMES field: Surface Temperature in timeseries [K]
    208 real, dimension(:,:,:,:), allocatable :: tsoil_phys_PEM_timeseries          ! IG x SLOPE x TIMES field: Non averaged Soil Temperature [K]
    209 real, dimension(:,:,:,:), allocatable :: tsoil_PCM_timeseries               ! IG x SLOPE x TIMES field: Non averaged Soil Temperature [K]
     207real, dimension(:,:,:,:), allocatable :: tsoil_phys_PEM_timeseries          ! IG x SOIL x SLOPE x TIMES field: Non averaged Soil Temperature [K]
     208real, dimension(:,:,:,:), allocatable :: tsoil_anom                         ! IG x SOIL x SLOPE x TIMES field: Amplitude between instataneous and yearly average soil temperature at the beginning [K]
    210209real, dimension(:,:),     allocatable :: tsurf_avg_yr1                      ! Physic x SLOPE field: Averaged Surface Temperature of first call of the PCM [K]
    211 real, dimension(:,:),     allocatable :: TI_locslope                        ! Physic x Soil: Intermediate thermal inertia  to compute Tsoil [SI]
    212210real, dimension(:,:),     allocatable :: Tsoil_locslope                     ! Physic x Soil: Intermediate when computing Tsoil [K]
    213211real, dimension(:),       allocatable :: Tsurf_locslope                     ! Physic x Soil: Intermediate surface temperature to compute Tsoil [K]
     
    343341year_day = 669
    344342daysec = 88775.
    345 timestep = year_day*daysec/year_step
     343timestep = year_day*daysec*year_step
    346344
    347345!----------------------------- INITIALIZATION --------------------------
     
    540538allocate(tsurf_avg(ngrid,nslope))
    541539allocate(tsurf_PCM_timeseries(ngrid,nslope,timelen))
    542 allocate(tsoil_PCM_timeseries(ngrid,nsoilmx,nslope,timelen))
     540allocate(tsoil_anom(ngrid,nsoilmx,nslope,timelen))
    543541allocate(q_co2_PEM_phys(ngrid,timelen))
    544542allocate(q_h2o_PEM_phys(ngrid,timelen))
     
    557555write(*,*) "Downloading data Y1..."
    558556call read_data_PCM("data_PCM_Y1.nc",timelen,iim,jjm_value,ngrid,nslope,vmr_co2_PCM,ps_timeseries,min_co2_ice(:,:,1),min_h2o_ice(:,:,1), &
    559                    tsurf_avg_yr1,tsoil_avg,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                     &
     557                   tsurf_avg_yr1,tsoil_avg,tsurf_PCM_timeseries,tsoil_anom,q_co2_PEM_phys,q_h2o_PEM_phys,                     &
    560558                   watersurf_density_avg,watersoil_density_timeseries)
    561559write(*,*) "Downloading data Y1 done!"
     
    564562write(*,*) "Downloading data Y2..."
    565563call read_data_PCM("data_PCM_Y2.nc",timelen,iim,jjm_value,ngrid,nslope,vmr_co2_PCM,ps_timeseries,min_co2_ice(:,:,2),min_h2o_ice(:,:,2), &
    566                    tsurf_avg,tsoil_avg,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                         &
     564                   tsurf_avg,tsoil_avg,tsurf_PCM_timeseries,tsoil_anom,q_co2_PEM_phys,q_h2o_PEM_phys,                         &
    567565                   watersurf_density_avg,watersoil_density_timeseries)
    568566write(*,*) "Downloading data Y2 done!"
     
    580578
    581579if (soil_pem) then
    582     allocate(tsoil_anom(ngrid,nsoilmx,nslope))
    583     tsoil_anom = tsoil - tsoil_avg ! compute anomaly between Tsoil(t) in the startfi - <Tsoil> to recompute properly tsoil in the restart
     580    do t = 1,timelen
     581        tsoil_anom(:,:,:,t) = tsoil_anom(:,:,:,t) - tsoil_avg ! compute anomaly between Tsoil(t) in the startfi - <Tsoil> to recompute properly tsoil in the restart
     582    enddo
    584583    call soil_settings_PEM(ngrid,nslope,nsoilmx_PEM,nsoilmx,inertiesoil,TI_PEM)
    585584    tsoil_PEM(:,1:nsoilmx,:) = tsoil_avg
    586     tsoil_phys_PEM_timeseries(:,1:nsoilmx,:,:) = tsoil_PCM_timeseries
     585    tsoil_phys_PEM_timeseries(:,1:nsoilmx,:,:) = tsoil_anom
    587586    watersoil_density_PEM_timeseries(:,1:nsoilmx,:,:) = watersoil_density_timeseries
    588587    do l = nsoilmx + 1,nsoilmx_PEM
     
    592591    watersoil_density_PEM_avg = sum(watersoil_density_PEM_timeseries,4)/timelen
    593592endif !soil_pem
    594 deallocate(tsoil_avg,tsoil_PCM_timeseries)
     593deallocate(tsoil_avg)
    595594
    596595!------------------------
     
    895894
    896895! II_d.2 Update soil temperature
    897         allocate(TI_locslope(ngrid,nsoilmx_PEM))
     896        write(*,*)"Updating soil temperature"
    898897        allocate(Tsoil_locslope(ngrid,nsoilmx_PEM))
    899         allocate(Tsurf_locslope(ngrid))
    900         write(*,*)"Updating soil temperature"
    901 
    902         ! Soil averaged
    903898        do islope = 1,nslope
    904             TI_locslope = TI_PEM(:,:,islope)
     899            call compute_tsoil_pem(ngrid,nsoilmx_PEM,.true.,TI_PEM(:,:,islope),timestep,tsurf_avg(:,islope),tsoil_PEM(:,:,islope))
     900            call compute_tsoil_pem(ngrid,nsoilmx_PEM,.false.,TI_PEM(:,:,islope),timestep,tsurf_avg(:,islope),tsoil_PEM(:,:,islope))
     901
    905902            do t = 1,timelen
    906                 Tsoil_locslope = tsoil_phys_PEM_timeseries(:,:,islope,t)
    907                 Tsurf_locslope = tsurf_PCM_timeseries(:,islope,t)
    908                 call compute_tsoil_pem(ngrid,nsoilmx_PEM,.true.,TI_locslope,timestep/timelen,Tsurf_locslope,Tsoil_locslope)
    909                 call compute_tsoil_pem(ngrid,nsoilmx_PEM,.false.,TI_locslope,timestep/timelen,Tsurf_locslope,Tsoil_locslope)
    910                 tsoil_phys_PEM_timeseries(:,:,islope,t) = Tsoil_locslope
     903                Tsoil_locslope(:,1:nsoilmx) = tsoil_PEM(:,1:nsoilmx,islope) + tsoil_anom(:,:,islope,t)
     904                Tsoil_locslope(:,nsoilmx + 1:) = tsoil_PEM(:,nsoilmx + 1:,islope)
    911905                do ig = 1,ngrid
    912906                    do isoil = 1,nsoilmx_PEM
    913907                        watersoil_density_PEM_timeseries(ig,isoil,islope,t) = exp(beta_clap_h2o/Tsoil_locslope(ig,isoil) + alpha_clap_h2o)/Tsoil_locslope(ig,isoil)*mmol(igcm_h2o_vap)/(mugaz*r)
    914                         if (isnan(Tsoil_locslope(ig,isoil))) call abort_pem("PEM - Update Tsoil","NaN detected in Tsoil ",1)
     908                        if (isnan(tsoil_PEM(ig,isoil,islope))) call abort_pem("PEM - Update Tsoil","NaN detected in tsoil_PEM",1)
    915909                    enddo
    916910                enddo
    917911            enddo
    918912        enddo
    919         tsoil_PEM = sum(tsoil_phys_PEM_timeseries,4)/timelen
    920913        watersoil_density_PEM_avg = sum(watersoil_density_PEM_timeseries,4)/timelen
    921914
    922915        write(*,*) "Update of soil temperature done"
    923916
    924         deallocate(TI_locslope,Tsoil_locslope,Tsurf_locslope)
     917        deallocate(Tsoil_locslope)
    925918
    926919! II_d.3 Update the ice table
     
    10801073if (soil_pem) then
    10811074    call interpol_TI_PEM2PCM(ngrid,nslope,nsoilmx_PEM,nsoilmx,TI_PEM,inertiesoil)
    1082     tsoil = tsoil_PEM(:,1:nsoilmx,:) + tsoil_anom
    1083     deallocate(tsoil_anom)
     1075    tsoil = tsoil_PEM(:,1:nsoilmx,:) + tsoil_anom(:,:,:,timelen)
    10841076#ifndef CPP_STD
    10851077    flux_geo = fluxgeo
    10861078#endif
    10871079endif
     1080deallocate(tsoil_anom)
    10881081
    10891082! III_a.4 Pressure (for start)
Note: See TracChangeset for help on using the changeset viewer.