Ignore:
Timestamp:
Aug 21, 2015, 5:13:46 PM (9 years ago)
Author:
Ehouarn Millour
Message:

Physics/dynamics separation:

  • remove all references to dimensions.h from physics. nbp_lon (==iim) , nbp_lat (==jjm+1) and nbp_lev (==llm) from mod_grid_phy_lmdz should be used instead.
  • added module regular_lonlat_mod in phy_common to store information about the global (lon-lat) grid cell boundaries and centers.

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/regr_lat_time_coefoz_m.F90

    r1907 r2346  
    4040    ! when we regrid in pressure).
    4141
     42    use mod_grid_phy_lmdz, ONLY : nbp_lat
    4243    use regr1_step_av_m, only: regr1_step_av
    4344    use regr3_lint_m, only: regr3_lint
     
    4546         nf95_put_var, nf95_gw_var
    4647    use netcdf, only: nf90_nowrite, nf90_get_var
     48    use nrtype, only: pi
     49    use regular_lonlat_mod, only: boundslat_reg, south
    4750
    4851    ! Variables local to the procedure:
    49 
    50     include "dimensions.h"
    51     ! (for "jjm")
    52     include "paramet.h"
    53     include "comgeom2.h"
    54     ! (for "rlatv")
    55     include "comconst.h"
    56     ! (for "pi")
    5752
    5853    integer ncid_in, ncid_out ! NetCDF IDs for input and output files
     
    164159    call nf95_inq_varid(ncid_in, "latitude", varid)
    165160    call nf95_gw_var(ncid_in, varid, latitude)
    166     ! Convert from degrees to rad, because "rlatv" is in rad:
     161    ! Convert from degrees to rad, because "boundslat_reg" is in rad:
    167162    latitude = latitude / 180. * pi
    168163    n_lat = size(latitude)
     
    200195
    201196    allocate(o3_par_in(n_lat, n_plev, 12))
    202     allocate(v_regr_lat(jjm + 1, n_plev, 0:13))
    203     allocate(o3_par_out(jjm + 1, n_plev, 360))
     197    allocate(v_regr_lat(nbp_lat, n_plev, 0:13))
     198    allocate(o3_par_out(nbp_lat, n_plev, 360))
    204199
    205200    do i_v = 1, n_o3_param
     
    214209       ! We average with respect to sine of latitude, which is
    215210       ! equivalent to weighting by cosine of latitude:
    216        v_regr_lat(jjm+1:1:-1, :, 1:12) = regr1_step_av(o3_par_in, &
    217             xs=sin(lat_in_edg), xt=sin((/- pi / 2, rlatv(jjm:1:-1), pi / 2/)))
     211       v_regr_lat(nbp_lat:1:-1, :, 1:12) = regr1_step_av(o3_par_in, &
     212            xs=sin(lat_in_edg), xt=sin((/- pi / 2, boundslat_reg(nbp_lat-1:1:-1,south), pi / 2/)))
    218213       ! (invert order of indices in "v_regr_lat" because "rlatu" is
    219214       ! in descending order)
     
    229224       ! Write to file:
    230225       call nf95_put_var(ncid_out, varid_out(i_v), &
    231             o3_par_out(jjm+1:1:-1, :, :))
     226            o3_par_out(nbp_lat:1:-1, :, :))
    232227       ! (The order of "rlatu" is inverted in the output file)
    233228    end do
     
    246241    ! dimensions and variables, and writes one of the coordinate variables.
    247242
     243    use mod_grid_phy_lmdz, ONLY : nbp_lat
    248244    use assert_eq_m, only: assert_eq
    249245
     
    251247         nf95_put_att, nf95_enddef, nf95_copy_att, nf95_put_var
    252248    use netcdf, only: nf90_clobber, nf90_float, nf90_copy_att, nf90_global
     249    use nrtype, only: pi
     250    use regular_lonlat_mod, only : lat_reg
    253251
    254252    integer, intent(in):: ncid_in, varid_in(:), n_plev
     
    257255
    258256    ! Variables local to the procedure:
    259 
    260     include "dimensions.h"
    261     ! (for "jjm")
    262     include "paramet.h"
    263     include "comgeom2.h"
    264     ! (for "rlatu")
    265     include "comconst.h"
    266     ! (for "pi")
    267257
    268258    integer ncerr
     
    282272    call nf95_def_dim(ncid_out, "time", 360, dimid_time)
    283273    call nf95_def_dim(ncid_out, "plev", n_plev, dimid_plev)
    284     call nf95_def_dim(ncid_out, "rlatu", jjm + 1, dimid_rlatu)
     274    call nf95_def_dim(ncid_out, "rlatu", nbp_lat, dimid_rlatu)
    285275
    286276    ! Define coordinate variables:
     
    332322
    333323    ! Write one of the coordinate variables:
    334     call nf95_put_var(ncid_out, varid_rlatu, rlatu(jjm+1:1:-1) / pi * 180.)
     324    call nf95_put_var(ncid_out, varid_rlatu, lat_reg(nbp_lat:1:-1) / pi * 180.)
    335325    ! (convert from rad to degrees and sort in ascending order)
    336326
Note: See TracChangeset for help on using the changeset viewer.