Changeset 3078


Ignore:
Timestamp:
Oct 10, 2023, 11:41:27 AM (15 months ago)
Author:
emillour
Message:

Common physics/dynamics:
Add, for lon-lat outputs, a cell_area_for_lonlat_outputs()
field where polar mesh areas are adapted to match those
of the dynamics grid (where polar mesh points are replicated
along longitudes).

Mars PCM:
Enable outputing cell area with XIOS and make sure the polar grid point
is correctly handled (i.e. on lon-lat grid outputs polar mesh area must
be adjusted to account for the replicated polar meshes).

EM

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/dynphy_lonlat/inigeomphy_mod.F90

    r2519 r3078  
    1212                                klon_omp_end, & ! end index of local omp subgrid
    1313                                klon_mpi_begin ! start indes of columns (on local mpi grid)
    14   USE geometry_mod, ONLY : init_geometry
     14  USE geometry_mod, ONLY : init_geometry, init_geometry_cell_area_for_outputs
    1515  USE physics_distribution_mod, ONLY : init_physics_distribution
    1616  USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
     
    6161  REAL,ALLOCATABLE :: cvfi_glo(:)
    6262  REAL,ALLOCATABLE :: airefi_glo(:)
     63  REAL,ALLOCATABLE :: aire_glo(:)
    6364  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
    6465  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
     
    7071  REAL,ALLOCATABLE,SAVE :: cvfi(:)
    7172  REAL,ALLOCATABLE,SAVE :: airefi(:)
     73  REAL,ALLOCATABLE,SAVE :: airefi_for_outputs(:)
    7274  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
    7375  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
    7476  INTEGER,ALLOCATABLE,SAVE :: ind_cell_glo_fi(:)
    75 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi,ind_cell_glo_fi)
     77!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,airefi_for_outputs)
     78!$OMP THREADPRIVATE (boundslonfi,boundslatfi,ind_cell_glo_fi)
    7679
    7780  ! Initialize Physics distibution and parameters and interface with dynamics
     
    114117  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
    115118  ALLOCATE(airefi_glo(klon_glo))
     119  ALLOCATE(aire_glo(klon_glo))
    116120  ALLOCATE(boundslonfi_glo(klon_glo,4))
    117121  ALLOCATE(boundslatfi_glo(klon_glo,4))
     
    173177    airefi_glo(1)=sum(aire(1:iim,1))
    174178    airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1))
     179    ! but we also want to store mesh area with poles as on dyn grid
     180    ! (for lon-lat outputs)
     181    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,aire_glo)
    175182
    176183    ! Sanity check: do total planet area match between physics and dynamics?
     
    194201    cvfi_glo(1)=cv(1)
    195202    airefi_glo(1)=aire(1,1)
     203    aire_glo(1)=aire(1,1)
    196204    boundslonfi_glo(1,north_east)=rlonu(1)
    197205    boundslatfi_glo(1,north_east)=PI/2
     
    208216  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
    209217  ALLOCATE(airefi(klon_omp))
     218  ALLOCATE(airefi_for_outputs(klon_omp))
    210219  ALLOCATE(boundslonfi(klon_omp,4))
    211220  ALLOCATE(boundslatfi(klon_omp,4))
     
    215224  offset = klon_mpi_begin - 1
    216225  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     226  airefi_for_outputs(1:klon_omp) = &
     227                         aire_glo(offset+klon_omp_begin:offset+klon_omp_end)
    217228  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
    218229  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     
    227238                     airefi,ind_cell_glo_fi,cufi,cvfi)
    228239
     240  ! copy over lon-lat mesh area for outputs (with polar "correction")
     241  CALL init_geometry_cell_area_for_outputs(klon_omp,airefi_for_outputs)
     242
    229243  ! copy over preff , ap(), bp(), etc
    230244  CALL init_vertical_layers(nlayer,preff,scaleheight, &
  • trunk/LMDZ.COMMON/libf/phy_common/geometry_mod.F90

    r1682 r3078  
    2727!$OMP THREADPRIVATE(dy)
    2828
    29   REAL,SAVE,ALLOCATABLE :: cell_area(:)      ! area of the cell
     29  REAL,SAVE,ALLOCATABLE :: cell_area(:) ! area of the cell (m2)
    3030!$OMP THREADPRIVATE(cell_area)
     31
     32  REAL,SAVE,ALLOCATABLE :: cell_area_for_lonlat_outputs(:)
     33                           ! for lon-lat outputs only: area of the cell
     34                           ! but with polar values as in dyn grid
     35                           ! (with replicated polar grid point)
     36!$OMP THREADPRIVATE(cell_area_for_lonlat_outputs)
    3137
    3238  INTEGER,SAVE,ALLOCATABLE :: ind_cell_glo(:)      ! global index of a local cell
     
    7682
    7783
     84  SUBROUTINE init_geometry_cell_area_for_outputs(klon, &
     85                                                 cell_area_for_lonlat_outputs_)
     86  IMPLICIT NONE
     87  INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
     88  REAL,INTENT(IN) :: cell_area_for_lonlat_outputs_(klon) ! tweaked lon-lat mesh
     89                     ! cell areas where polar values are as on dyn lon-lat grid
     90                     ! for outputs
     91 
     92  ALLOCATE(cell_area_for_lonlat_outputs(klon))
     93  cell_area_for_lonlat_outputs(1:klon)=cell_area_for_lonlat_outputs_(1:klon)
     94 
     95  END SUBROUTINE init_geometry_cell_area_for_outputs
     96
    7897END MODULE geometry_mod
    7998
  • trunk/LMDZ.MARS/changelog.txt

    r3077 r3078  
    42524252Improve conctatnc's handling of XIOS output files (handle change in some
    42534253variable names, e.g. "area" or "phisfi").
     4254
     4255== 10/10/2023 == EM
     4256Enable outputing cell area with XIOS and make sure the polar grid point
     4257is correctly handled (i.e. on lon-lat grid outputs polar mesh area must
     4258be adjusted to account for the replicated polar meshes).
     4259 
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r3042 r3078  
    5050     &                     mlayer,layer ! soil mid layer depths
    5151      use geometry_mod, only: longitude, latitude, cell_area,
    52      &                        longitude_deg
     52     &                        cell_area_for_lonlat_outputs,longitude_deg
    5353      use comgeomfi_h, only: sinlon, coslon, sinlat, coslat
    5454      use surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam,
     
    110110      use wxios, only: wxios_context_init, xios_context_finalize
    111111#endif
    112       USE mod_grid_phy_lmdz, ONLY: grid_type, unstructured
     112      USE mod_grid_phy_lmdz, ONLY: grid_type, unstructured,
     113     &                             regular_lonlat
    113114      use ioipsl_getin_p_mod, only: getin_p
    114115      use comslope_mod, ONLY: nslope,def_slope,def_slope_mean,
     
    31723173         call write_output("phisfi","Surface geopotential",
    31733174     &                    "m2s-2",phisfi(:))
     3175         if (grid_type == regular_lonlat) then
     3176           call write_output("area","Mesh area","m2",
     3177     &                       cell_area_for_lonlat_outputs)
     3178         else ! unstructured grid (e.g. dynamico)
     3179           call write_output("area","Mesh area","m2",cell_area)
     3180         endif
    31743181         call write_output("tsurf","Surface temperature","K",
    31753182     &                  tsurf(:,iflat))
Note: See TracChangeset for help on using the changeset viewer.