Changeset 3336 for trunk/LMDZ.MARS


Ignore:
Timestamp:
May 21, 2024, 1:32:02 PM (6 months ago)
Author:
jbclement
Message:

Mars PCM:
Addition of the paleoclimate variables in the change the number of slopes by "newtart.F" + some simplifications of the way it is done.
JBC

Location:
trunk/LMDZ.MARS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r3333 r3336  
    46344634Fixing a bug in vdif_cd: a "residual", used as criterion to enter an iterative loop, was wrongly initialized. Hence, for some points, the algorithm does not go into the loop, and a wrong value of Cd, Ch was computed.
    46354635Also some cleaning/small fixing with save variables with OMP.
     4636
     4637== 21/05/2024 == JBC
     4638Addition of the paleoclimate variables in the change the number of slopes by "newtart.F" + some simplifications of the way it is done.
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F

    r3316 r3336  
    5858      use comslope_mod, ONLY: nslope,def_slope,def_slope_mean,
    5959     &             subslope_dist,end_comslope_h,ini_comslope_h
    60       USE subslope_mola_mod, ONLY: subslope_mola
     60      use paleoclimate_mod, only: h2o_ice_depth, lag_co2_ice, d_coef,
     61     &             ini_paleoclimate_h, end_paleoclimate_h
     62      use subslope_mola_mod, ONLY: subslope_mola
    6163     
    6264      implicit none
     
    192194! sub-grid cloud fraction
    193195      real :: totcloudfrac(ngridmx)
    194 !Variable to change the number of subslope
    195       REAL, ALLOCATABLE :: default_def_slope(:)
    196       REAL,ALLOCATABLE :: tsurf_old_slope(:,:)   ! Surface temperature (K)
    197       REAL,ALLOCATABLE :: emis_old_slope(:,:)    ! Thermal IR surface emissivity
    198       REAL,ALLOCATABLE :: qsurf_old_slope(:,:,:) ! tracer on surface (e.g. kg.m-2)
    199       REAL,ALLOCATABLE :: watercap_old_slope(:,:) ! Surface water ice (kg.m-2)
    200       REAL,ALLOCATABLE :: perennial_co2_old_slope(:,:) ! Surface water ice (kg.m-2)
    201       REAL,ALLOCATABLE :: tsoil_old_slope(:,:,:)
    202       REAL,ALLOCATABLE :: inertiesoil_old_slope(:,:,:)
    203       REAL,ALLOCATABLE :: albedo_old_slope(:,:,:) ! Surface albedo in each solar band
    204       REAL,ALLOCATABLE :: flux_geo_old_slope(:,:)
    205       integer :: iflat
    206       integer :: nslope_old, nslope_new
     196! Variables to change the number of subslope
     197      real, allocatable, dimension(:)     :: default_def_slope
     198      real, allocatable, dimension(:,:)   :: tsurf_old_slope         ! Surface temperature (K)
     199      real, allocatable, dimension(:,:)   :: emis_old_slope          ! Thermal IR surface emissivity
     200      real, allocatable, dimension(:,:,:) :: qsurf_old_slope         ! tracer on surface (e.g. kg.m-2)
     201      real, allocatable, dimension(:,:)   :: watercap_old_slope      ! Surface water ice (kg.m-2)
     202      real, allocatable, dimension(:,:)   :: perennial_co2_old_slope ! Surface water ice (kg.m-2)
     203      real, allocatable, dimension(:,:,:) :: tsoil_old_slope
     204      real, allocatable, dimension(:,:,:) :: inertiesoil_old_slope
     205      real, allocatable, dimension(:,:,:) :: albedo_old_slope        ! Surface albedo in each solar band
     206      real, allocatable, dimension(:,:)   :: flux_geo_old_slope
     207      real, allocatable, dimension(:,:)   :: h2o_ice_depth_old_slope
     208      real, allocatable, dimension(:,:)   :: lag_co2_ice_old_slope
     209      real, allocatable, dimension(:,:)   :: d_coef_old_slope
     210      integer :: iflat, nslope_old, nslope_new
    207211
    208212
     
    17351739          write(*,*) 'set a new number of subgrid scale slopes'
    17361740          write(*,*) 'Current value=', nslope
    1737           write(*,*) 'Enter value for nslope (ex: 1,5,7)?'
     1741          write(*,*) 'Enter value for nslope (ex: 1,3,5,7)?'
    17381742          ierr=1
    17391743          do while (ierr.ne.0)
     
    17441748       write(*,*) 'You can go grab a coffee and relax a bit'
    17451749
    1746       if(nslope.eq.nslope_new) then
     1750      if (nslope == nslope_new) then
    17471751        write(*,*) 'The number of subslope you entered is the same'
    17481752        write(*,*) 'as the number written in startfi.nc. '
     
    17981802
    17991803       iflat = 1
    1800        DO islope=2,nslope_new
    1801          IF(abs(def_slope_mean(islope)).lt.
    1802      &      abs(def_slope_mean(iflat)))THEN
     1804       do islope = 2,nslope_new
     1805         if (abs(def_slope_mean(islope)) <
     1806     &      abs(def_slope_mean(iflat))) then
    18031807           iflat = islope
    1804          ENDIF
    1805        ENDDO
     1808         endif
     1809       enddo
    18061810
    18071811       if (ngridmx /= 1) then
     
    18151819        allocate(watercap_old_slope(ngridmx,nslope_old))
    18161820        allocate(perennial_co2_old_slope(ngridmx,nslope_old))
    1817 
    18181821        tsurf_old_slope(:,:)=tsurf(:,:)
    18191822        qsurf_old_slope(:,:,:)=qsurf(:,:,:)
     
    18281831        allocate(inertiesoil_old_slope(ngridmx,nsoilmx,nslope_old))
    18291832        allocate(flux_geo_old_slope(ngridmx,nslope_old))
    1830 
    18311833        inertiesoil_old_slope(:,:,:)=inertiesoil(:,:,:)
    18321834        tsoil_old_slope(:,:,:)=tsoil(:,:,:)
    18331835        flux_geo_old_slope(:,:)=flux_geo(:,:)
    1834 
    18351836        call end_comsoil_h_slope_var
    18361837        call ini_comsoil_h_slope_var(ngridmx,nslope_new)
     
    18391840        allocate(albedo_old_slope(ngridmx,2,nslope_old))
    18401841        albedo_old_slope(:,:,:)=albedo(:,:,:)
    1841 
    18421842        call end_dimradmars_mod_slope_var
    18431843        call ini_dimradmars_mod_slope_var(ngridmx,nslope_new)
    18441844
    1845         if(nslope_old.eq.1 .and. nslope_new.gt.1) then
    1846           do islope=1,nslope_new
    1847              tsurf(:,islope)=tsurf_old_slope(:,1)
    1848              qsurf(:,:,islope)=qsurf_old_slope(:,:,1)
    1849              emis(:,islope)=emis_old_slope(:,1)
    1850              watercap(:,islope)=watercap_old_slope(:,1)
    1851              perennial_co2ice(:,islope)= perennial_co2_old_slope(:,1)
    1852              tsoil(:,:,islope)=tsoil_old_slope(:,:,1)
    1853              albedo(:,:,islope)=albedo_old_slope(:,:,1)
    1854              inertiesoil(:,:,islope)=inertiesoil_old_slope(:,:,1)
    1855              flux_geo(:,islope)=flux_geo_old_slope(:,1)
    1856           enddo
    1857         elseif(nslope_new.eq.1) then
    1858              tsurf(:,1)=tsurf_old_slope(:,iflat)
    1859              qsurf(:,:,1)=qsurf_old_slope(:,:,iflat)
    1860              emis(:,1)=emis_old_slope(:,iflat)
    1861              watercap(:,1)=watercap_old_slope(:,iflat)
    1862              perennial_co2ice(:,islope)=
    1863      &                 perennial_co2_old_slope(:,iflat)
    1864              tsoil(:,:,1)=tsoil_old_slope(:,:,iflat)
    1865              albedo(:,:,1)=albedo_old_slope(:,:,iflat)
    1866              inertiesoil(:,:,1)=inertiesoil_old_slope(:,:,iflat)
    1867              flux_geo(:,1)=flux_geo_old_slope(:,iflat)
    1868         elseif(nslope_old.eq.5 .and. nslope_new.eq.7) then
    1869           do islope=1,nslope_new
    1870              tsurf(:,islope)=tsurf_old_slope(:,iflat)
    1871              qsurf(:,:,islope)=qsurf_old_slope(:,:,iflat)
    1872              emis(:,islope)=emis_old_slope(:,iflat)
    1873              watercap(:,islope)=watercap_old_slope(:,iflat)
    1874              perennial_co2ice(:,islope)=
    1875      &                 perennial_co2_old_slope(:,iflat)
    1876              tsoil(:,:,islope)=tsoil_old_slope(:,:,iflat)
    1877              albedo(:,:,islope)=albedo_old_slope(:,:,iflat)
    1878              inertiesoil(:,:,islope)=inertiesoil_old_slope(:,:,iflat)
    1879              flux_geo(:,islope)=flux_geo_old_slope(:,iflat)
    1880           enddo
    1881         elseif(nslope_old.eq.7 .and. nslope_new.eq.5) then
    1882           do islope=1,nslope_new
    1883              tsurf(:,islope)=tsurf_old_slope(:,iflat)
    1884              qsurf(:,:,islope)=qsurf_old_slope(:,:,iflat)
    1885              emis(:,islope)=emis_old_slope(:,iflat)
    1886              watercap(:,islope)=watercap_old_slope(:,iflat)
    1887              perennial_co2ice(:,islope)=
    1888      &                 perennial_co2_old_slope(:,iflat)
    1889              tsoil(:,:,islope)=tsoil_old_slope(:,:,iflat)
    1890              albedo(:,:,islope)=albedo_old_slope(:,:,iflat)
    1891              inertiesoil(:,:,islope)=inertiesoil_old_slope(:,:,iflat)
    1892              flux_geo(:,islope)=flux_geo_old_slope(:,iflat)
     1845! Paleoclimate related stuff
     1846        allocate(h2o_ice_depth_old_slope(ngridmx,nslope_old))
     1847        allocate(lag_co2_ice_old_slope(ngridmx,nslope_old))
     1848        allocate(d_coef_old_slope(ngridmx,nslope_old))
     1849        h2o_ice_depth_old_slope = h2o_ice_depth
     1850        lag_co2_ice_old_slope = lag_co2_ice
     1851        d_coef_old_slope = d_coef
     1852        call end_paleoclimate_h
     1853        call ini_paleoclimate_h(ngridmx,nslope_new)
     1854
     1855! Update of the variables with the new "slopes" situation according to the old one
     1856        if (nslope_old == 1) then
     1857          do islope = 1,nslope_new
     1858             tsurf(:,islope) = tsurf_old_slope(:,1)
     1859             qsurf(:,:,islope) = qsurf_old_slope(:,:,1)
     1860             emis(:,islope) = emis_old_slope(:,1)
     1861             watercap(:,islope) = watercap_old_slope(:,1)
     1862             perennial_co2ice(:,islope) =
     1863     &                                     perennial_co2_old_slope(:,1)
     1864             tsoil(:,:,islope) = tsoil_old_slope(:,:,1)
     1865             albedo(:,:,islope) = albedo_old_slope(:,:,1)
     1866             inertiesoil(:,:,islope) = inertiesoil_old_slope(:,:,1)
     1867             flux_geo(:,islope) = flux_geo_old_slope(:,1)
     1868             h2o_ice_depth(:,islope) = h2o_ice_depth_old_slope(:,1)
     1869             lag_co2_ice(:,islope) = lag_co2_ice_old_slope(:,1)
     1870             d_coef(:,islope) = d_coef_old_slope(:,1)
    18931871          enddo
    18941872        else
    1895           write(*,*)' Problem choice of nslope'
    1896           write(*,*)' Value not taken into account'
    1897           CALL ABORT
     1873          do islope = 1,nslope_new
     1874             tsurf(:,islope) = tsurf_old_slope(:,iflat)
     1875             qsurf(:,:,islope) = qsurf_old_slope(:,:,iflat)
     1876             emis(:,islope) = emis_old_slope(:,iflat)
     1877             watercap(:,islope) = watercap_old_slope(:,iflat)
     1878             perennial_co2ice(:,islope) =
     1879     &                                 perennial_co2_old_slope(:,iflat)
     1880             tsoil(:,:,islope) = tsoil_old_slope(:,:,iflat)
     1881             albedo(:,:,islope) = albedo_old_slope(:,:,iflat)
     1882             inertiesoil(:,:,islope) = inertiesoil_old_slope(:,:,iflat)
     1883             flux_geo(:,islope) = flux_geo_old_slope(:,iflat)
     1884             h2o_ice_depth(:,islope) = h2o_ice_depth_old_slope(:,iflat)
     1885             lag_co2_ice(:,islope) = lag_co2_ice_old_slope(:,iflat)
     1886             d_coef(:,islope) = d_coef_old_slope(:,iflat)
     1887          enddo
    18981888        endif
     1889
     1890        deallocate(default_def_slope,tsurf_old_slope,qsurf_old_slope)
     1891        deallocate(emis_old_slope,watercap_old_slope)
     1892        deallocate(perennial_co2_old_slope,tsoil_old_slope)
     1893        deallocate(inertiesoil_old_slope,flux_geo_old_slope)
     1894        deallocate(albedo_old_slope,h2o_ice_depth_old_slope)
     1895        deallocate(lag_co2_ice_old_slope,d_coef_old_slope)
    18991896
    19001897        endif !nslope=nslope_new
     
    19021899        else
    19031900          write(*,*) '       Unknown (misspelled?) option!!!'
    1904         end if ! of if (trim(modif) .eq. '...') elseif ...
     1901        end if ! of if (trim(modif) == '...') elseif ...
    19051902       
    19061903       enddo ! of do ! infinite loop on liste of changes
  • trunk/LMDZ.MARS/libf/phymars/paleoclimate_mod.F90

    r3333 r3336  
    1515
    1616!$OMP THREADPRIVATE(paleoclimate)
    17     real,    save, allocatable, dimension(:,:) :: h2o_ice_depth           ! Thickness of the lag before H2O ice [m]
    18     real,    save, allocatable, dimension(:,:) :: lag_co2_ice             ! Thickness of the lag before CO2 ice [m]
    19     real,    save, allocatable, dimension(:,:) :: d_coef                  ! Diffusion coeficent
    20     real,    save                              :: albedo_perennialco2     ! Albedo for perennial co2 ice [1]
    21     logical, save                              :: lag_layer               ! Does lag layer is present?
    22     logical, save                              :: include_waterbuoyancy   ! Include the effect of water buoyancy when computing the sublimation of water ice ?
     17    real,    save, allocatable, dimension(:,:) :: h2o_ice_depth         ! Thickness of the lag before H2O ice [m]
     18    real,    save, allocatable, dimension(:,:) :: lag_co2_ice           ! Thickness of the lag before CO2 ice [m]
     19    real,    save, allocatable, dimension(:,:) :: d_coef                ! Diffusion coefficent
     20    real,    save                              :: albedo_perennialco2   ! Albedo for perennial co2 ice [1]
     21    logical, save                              :: lag_layer             ! Does lag layer is present?
     22    logical, save                              :: include_waterbuoyancy ! Include the effect of water buoyancy when computing the sublimation of water ice ?
    2323!$OMP THREADPRIVATE(h2o_ice_depth,lag_co2_ice,d_coef,albedo_perennialco2,lag_layer,include_waterbuoyancy)
    2424
Note: See TracChangeset for help on using the changeset viewer.