init_ssrf_m.f90 Source File



This file depends on

sourcefile~~init_ssrf_m.f90~~EfferentGraph sourcefile~init_ssrf_m.f90 init_ssrf_m.f90 sourcefile~indice_sol_mod.f90 indice_sol_mod.f90 sourcefile~init_ssrf_m.f90->sourcefile~indice_sol_mod.f90 sourcefile~dimphy.f90 dimphy.f90 sourcefile~init_ssrf_m.f90->sourcefile~dimphy.f90 sourcefile~phys_state_var_mod.f90 phys_state_var_mod.F90 sourcefile~init_ssrf_m.f90->sourcefile~phys_state_var_mod.f90 sourcefile~comconst_mod.f90 comconst_mod.f90 sourcefile~init_ssrf_m.f90->sourcefile~comconst_mod.f90 sourcefile~iniprint_mod_h.f90 iniprint_mod_h.f90 sourcefile~init_ssrf_m.f90->sourcefile~iniprint_mod_h.f90 sourcefile~geometry_mod.f90 geometry_mod.f90 sourcefile~init_ssrf_m.f90->sourcefile~geometry_mod.f90 sourcefile~surface_data.f90 surface_data.f90 sourcefile~init_ssrf_m.f90->sourcefile~surface_data.f90 sourcefile~paramet_mod_h.f90 paramet_mod_h.f90 sourcefile~init_ssrf_m.f90->sourcefile~paramet_mod_h.f90 sourcefile~comgeom2_mod_h.f90 comgeom2_mod_h.f90 sourcefile~init_ssrf_m.f90->sourcefile~comgeom2_mod_h.f90 sourcefile~grid_atob_m.f90 grid_atob_m.f90 sourcefile~init_ssrf_m.f90->sourcefile~grid_atob_m.f90 sourcefile~ioipsl_getin_p_mod.f90 ioipsl_getin_p_mod.f90 sourcefile~init_ssrf_m.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~indice_sol_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~dimphy.f90 sourcefile~phys_state_var_mod.f90->sourcefile~surface_data.f90 sourcefile~aero_mod.f90 aero_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~aero_mod.f90 sourcefile~config_ocean_skin_m.f90 config_ocean_skin_m.F90 sourcefile~phys_state_var_mod.f90->sourcefile~config_ocean_skin_m.f90 sourcefile~dimsoil_mod_h.f90 dimsoil_mod_h.f90 sourcefile~phys_state_var_mod.f90->sourcefile~dimsoil_mod_h.f90 sourcefile~clesphys_mod_h.f90 clesphys_mod_h.f90 sourcefile~phys_state_var_mod.f90->sourcefile~clesphys_mod_h.f90 sourcefile~infotrac_phy.f90 infotrac_phy.F90 sourcefile~phys_state_var_mod.f90->sourcefile~infotrac_phy.f90 sourcefile~mod_grid_phy_lmdz.f90 mod_grid_phy_lmdz.f90 sourcefile~geometry_mod.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~nrtype.f90 nrtype.f90 sourcefile~geometry_mod.f90->sourcefile~nrtype.f90 sourcefile~comgeom2_mod_h.f90->sourcefile~paramet_mod_h.f90 sourcefile~assert_eq_m.f90 assert_eq_m.f90 sourcefile~grid_atob_m.f90->sourcefile~assert_eq_m.f90 sourcefile~mod_phys_lmdz_para.f90 mod_phys_lmdz_para.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~strings_mod.f90 strings_mod.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~strings_mod.f90 sourcefile~mod_phys_lmdz_transfert_para.f90 mod_phys_lmdz_transfert_para.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~mod_phys_lmdz_transfert_para.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_transfert_para.f90 sourcefile~mod_phys_lmdz_mpi_data.f90 mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~print_control_mod.f90 print_control_mod.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~print_control_mod.f90 sourcefile~mod_phys_lmdz_omp_data.f90 mod_phys_lmdz_omp_data.F90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_omp_data.f90 sourcefile~infotrac_phy.f90->sourcefile~iniprint_mod_h.f90 sourcefile~infotrac_phy.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~infotrac_phy.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~infotrac_phy.f90->sourcefile~strings_mod.f90 sourcefile~lmdz_cppkeys_wrapper.f90 lmdz_cppkeys_wrapper.F90 sourcefile~infotrac_phy.f90->sourcefile~lmdz_cppkeys_wrapper.f90 sourcefile~readtracfiles_mod.f90 readTracFiles_mod.f90 sourcefile~infotrac_phy.f90->sourcefile~readtracfiles_mod.f90 sourcefile~lmdz_reprobus_wrappers.f90 lmdz_reprobus_wrappers.F90 sourcefile~infotrac_phy.f90->sourcefile~lmdz_reprobus_wrappers.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90 mod_phys_lmdz_omp_transfert.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_omp_transfert.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90 mod_phys_lmdz_mpi_transfert.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_mpi_transfert.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90->sourcefile~mod_phys_lmdz_omp_data.f90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~lmdz_cppkeys_wrapper.f90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~print_control_mod.f90 sourcefile~lmdz_mpi.f90 lmdz_mpi.F90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~lmdz_mpi.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~lmdz_mpi.f90 sourcefile~readtracfiles_mod.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~readtracfiles_mod.f90->sourcefile~strings_mod.f90 sourcefile~lmdz_reprobus_wrappers.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~dimphy.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~print_control_mod.f90

Files dependent on this one

sourcefile~~init_ssrf_m.f90~~AfferentGraph sourcefile~init_ssrf_m.f90 init_ssrf_m.f90 sourcefile~limit_netcdf.f90 limit_netcdf.F90 sourcefile~limit_netcdf.f90->sourcefile~init_ssrf_m.f90 sourcefile~etat0phys_netcdf.f90 etat0phys_netcdf.f90 sourcefile~etat0phys_netcdf.f90->sourcefile~init_ssrf_m.f90 sourcefile~ce0l.f90 ce0l.F90 sourcefile~ce0l.f90->sourcefile~limit_netcdf.f90 sourcefile~ce0l.f90->sourcefile~etat0phys_netcdf.f90

Contents

Source Code


Source Code

MODULE init_ssrf_m
!
!*******************************************************************************

  USE iniprint_mod_h
  USE comgeom2_mod_h
  USE indice_sol_mod,     ONLY: is_ter, is_oce, is_oce, is_lic, epsfra
  USE dimphy,             ONLY: klon, zmasq
  USE phys_state_var_mod, ONLY: pctsrf
  USE geometry_mod,       ONLY : longitude_deg, latitude_deg
  USE grid_atob_m,        ONLY: grille_m
  USE ioipsl,             ONLY: flininfo, flinopen, flinget, flinclo
  USE ioipsl_getin_p_mod, ONLY: getin_p
  USE comconst_mod,       ONLY: im, pi
  USE surface_data,       ONLY: landice_opt
  USE dimensions_mod, ONLY: iim, jjm, llm, ndm
  USE paramet_mod_h

  CHARACTER(LEN=256), PARAMETER :: icefname="landiceref.nc", icevar="landice"
  PRIVATE
  PUBLIC :: start_init_subsurf

CONTAINS

!-------------------------------------------------------------------------------
!
SUBROUTINE start_init_subsurf(known_mask)
!
!-------------------------------------------------------------------------------
! Purpose: Subsurfaces initialization.
!-------------------------------------------------------------------------------
! Comment: Called by etat0phys_netcdf ; also called by limit_netcdf in case
!          no starting states are required (ok_etat0==.FALSE.).
!-------------------------------------------------------------------------------
  IMPLICIT NONE
!-------------------------------------------------------------------------------
! Arguments:
  LOGICAL, INTENT(IN) :: known_mask
!-------------------------------------------------------------------------------
! Local variables:
  INTEGER           :: iml_lic, jml_lic
  INTEGER           :: fid, llm_tmp, ttm_tmp, itaul(1), ji, j
  REAL, ALLOCATABLE :: dlon_lic(:), lon_lic(:,:), fraclic (:,:)
  REAL, ALLOCATABLE :: dlat_lic(:), lat_lic(:,:), flic_tmp(:,:), vtmp(:,:)
  REAL              :: date, lev(1), dt, deg2rad
  LOGICAL           :: no_ter_antartique   ! If true, no land points are allowed at Antartic
!-------------------------------------------------------------------------------
  deg2rad= pi/180.0

!--- Physical grid points coordinates
  DO j=2,jjm; latitude_deg((j-2)*iim+2:(j-1)*iim+1)=rlatu(j);    END DO
  DO j=2,jjm; longitude_deg((j-2)*iim+2:(j-1)*iim+1)=rlonv(1:im); END DO
  latitude_deg(1) = pi/2.; latitude_deg(klon) = - pi/2.
  latitude_deg(:)=latitude_deg(:)/deg2rad
  longitude_deg(1) = 0.0;   longitude_deg(klon) = 0.0;
  longitude_deg(:)=longitude_deg(:)/deg2rad

! Compute ground geopotential, sub-cells quantities and possibly the mask.
! Sub-surfaces initialization
!*******************************************************************************
  IF (landice_opt .LT. 2) THEN
     ! Continue with reading landice.nc file
     WRITE(lunout,*)"Read landice.nc file to attribute is_lic fraction"

     !--- Read and interpolate on model T-grid soil fraction and soil ice fraction.
     CALL flininfo(icefname, iml_lic, jml_lic, llm_tmp, ttm_tmp, fid)
     ALLOCATE(lat_lic(iml_lic,jml_lic),lon_lic(iml_lic,jml_lic))
     ALLOCATE(fraclic(iml_lic,jml_lic))
     CALL flinopen(icefname, .FALSE., iml_lic, jml_lic, llm_tmp,  &
          &               lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid)
     CALL flinget(fid, icevar, iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic)
     CALL flinclo(fid)
     WRITE(lunout,*)'landice dimensions: iml_lic, jml_lic : ',iml_lic,jml_lic
     
     ALLOCATE(dlon_lic(iml_lic),dlat_lic(jml_lic))
     dlon_lic(:)=lon_lic(:,1); IF(MAXVAL(dlon_lic)>pi) dlon_lic=dlon_lic*pi/180.
     dlat_lic(:)=lat_lic(1,:); IF(MAXVAL(dlat_lic)>pi) dlat_lic=dlat_lic*pi/180.
     DEALLOCATE(lon_lic,lat_lic); ALLOCATE(flic_tmp(iip1,jjp1))
     CALL grille_m(dlon_lic,dlat_lic,fraclic,rlonv(1:iim),rlatu,flic_tmp(1:iim,:))
     flic_tmp(iip1,:)=flic_tmp(1,:)
     
     !--- To the physical grid
     pctsrf(:,:) = 0.
     CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic))
     DEALLOCATE(flic_tmp)
     
     !--- Adequation with soil/sea mask
     WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0. 
     WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
     pctsrf(:,is_ter)=zmasq(:)
     DO ji=1,klon
        IF(zmasq(ji)>EPSFRA) THEN 
           IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
              pctsrf(ji,is_lic)=zmasq(ji)
              pctsrf(ji,is_ter)=0.
           ELSE
              pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
              IF(pctsrf(ji,is_ter)<EPSFRA) THEN
                 pctsrf(ji,is_ter)=0.
                 pctsrf(ji,is_lic)=zmasq(ji)
              END IF
           END IF
        END IF
     END DO
     
     
     !--- Option no_ter_antartique removes all land fractions souther than 60S.
     !--- Land ice is set instead of the land fractions on these latitudes.
     !--- The ocean and sea-ice fractions are not changed.
     no_ter_antartique=.FALSE.
     CALL getin_p('no_ter_antartique',no_ter_antartique)
     WRITE(lunout,*)"no_ter_antartique=",no_ter_antartique
     IF (no_ter_antartique) THEN
        ! Remove all land fractions souther than 60S and set land-ice instead
        WRITE(lunout,*) "Remove land fractions souther than 60deg south by increasing"
        WRITE(lunout,*) "the continental ice fractions. No land can now be found at Antartic."
        DO ji=1, klon
           IF (latitude_deg(ji)<-60.0) THEN
              pctsrf(ji,is_lic) = pctsrf(ji,is_lic) + pctsrf(ji,is_ter)
              pctsrf(ji,is_ter) = 0
           END IF
        END DO
     END IF
     
  ELSE
     ! landice_opt=2 and higher
     WRITE(lunout,*) 'No landice is attributed is_lic sub-surface because landice_opt=2 or higher.'
     WRITE(lunout,*) 'This means that the land model will handel land ice as well as all other land areas.'
     pctsrf(:,is_ter) = zmasq(:)
     pctsrf(:,is_lic) = 0.0
  END IF

!--- Sub-surface ocean and sea ice (sea ice set to zero for start).
  pctsrf(:,is_oce)=(1.-zmasq(:))
  WHERE(pctsrf(:,is_oce)<EPSFRA) pctsrf(:,is_oce)=0.
  IF(known_mask) pctsrf(:,is_oce)=1-zmasq(:)

!--- It is checked that the sub-surfaces sum is equal to 1.
  ji=COUNT((ABS(SUM(pctsrf(:,:),dim=2))-1.0)>EPSFRA)
  IF(ji/=0) WRITE(lunout,*) 'Sub-cell distribution problem for ',ji,' points'

END SUBROUTINE start_init_subsurf
!
!-------------------------------------------------------------------------------

END MODULE init_ssrf_m
!
!*******************************************************************************