! ! $Id: iniphysiq_mod.F90 2601 2016-07-24 09:51:55Z jyg $ ! MODULE iniphysiq_mod CONTAINS SUBROUTINE iniphysiq(ii,jj,nlayer, & nbp, communicator, & punjours, pdayref,ptimestep, & rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & prad,pg,pr,pcpp,iflag_phys) USE dimphy, ONLY: init_dimphy USE comvert_mod, ONLY: preff, ap, bp, presnivs, scaleheight, pseudoalt USE inigeomphy_mod, ONLY: inigeomphy USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns (on full grid) USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) USE vertical_layers_mod, ONLY : init_vertical_layers USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,& niadv,conv_flg,pbl_flg,solsym,& nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,& ok_isotopes,ok_iso_verif,ok_isotrac,& ok_init_iso,niso_possibles,tnat,& alpha_ideal,use_iso,iqiso,iso_num,& iso_indnum,zone_num,phase_num,& indnum_fn_num,index_trac,& niso,ntraceurs_zone,ntraciso #ifdef REPROBUS USE CHEM_REP, ONLY : Init_chem_rep_phys #endif USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq USE inifis_mod, ONLY: inifis USE time_phylmdz_mod, ONLY: init_time USE temps_mod, ONLY: annee_ref, day_ini, day_ref, start_time USE infotrac_phy, ONLY: init_infotrac_phy USE phystokenc_mod, ONLY: init_phystokenc USE phyaqua_mod, ONLY: iniaqua #ifdef INCA USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic #ifdef CPP_PARA USE parallel_lmdz, ONLY : mpi_size, mpi_rank USE bands, ONLY : distrib_phys #endif USE mod_phys_lmdz_omp_data, ONLY: klon_omp #endif IMPLICIT NONE ! ======================================================================= ! Initialisation of the physical constants and some positional and ! geometrical arrays for the physics ! ======================================================================= include "dimensions.h" include "iniprint.h" include "tracstoke.h" REAL, INTENT (IN) :: prad ! radius of the planet (m) REAL, INTENT (IN) :: pg ! gravitational acceleration (m/s2) REAL, INTENT (IN) :: pr ! ! reduced gas constant R/mu REAL, INTENT (IN) :: pcpp ! specific heat Cp REAL, INTENT (IN) :: punjours ! length (in s) of a standard day INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process INTEGER, INTENT(IN) :: communicator ! MPI communicator REAL, INTENT (IN) :: rlatu(jj+1) ! latitudes of the physics grid REAL, INTENT (IN) :: rlatv(jj) ! latitude boundaries of the physics grid REAL, INTENT (IN) :: rlonv(ii+1) ! longitudes of the physics grid REAL, INTENT (IN) :: rlonu(ii+1) ! longitude boundaries of the physics grid REAL, INTENT (IN) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2) REAL, INTENT (IN) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) REAL, INTENT (IN) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation REAL, INTENT (IN) :: ptimestep !physics time step (s) INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called INTEGER :: ibegin, iend, offset INTEGER :: i,j,k CHARACTER (LEN=20) :: modname = 'iniphysiq' CHARACTER (LEN=80) :: abort_message #ifndef CPP_PARA INTEGER,PARAMETER :: mpi_rank=0 INTEGER, PARAMETER :: mpi_size = 1 INTEGER :: distrib_phys(mpi_rank:mpi_rank)=(jjm-1)*iim+2 #endif ! --> initialize physics distribution, global fields and geometry ! (i.e. things in phy_common or dynphy_lonlat) CALL inigeomphy(ii,jj,nlayer, & nbp, communicator, & rlatu,rlatv, & rlonu,rlonv, & aire,cu,cv) ! --> now initialize things specific to the phylmd physics package !!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) !$OMP PARALLEL DEFAULT(SHARED) & ! Copy all threadprivate variables in temps_mod !$OMP COPYIN(annee_ref, day_ini, day_ref, start_time) ! copy over preff , ap(), bp(), etc CALL init_vertical_layers(nlayer,preff,scaleheight, & ap,bp,presnivs,pseudoalt) ! Initialize physical constants in physics: CALL inifis(punjours,prad,pg,pr,pcpp) CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep) ! Initialize dimphy module (unless in 1D where it has already been done) IF (klon_glo>1) CALL Init_dimphy(klon_omp,nlayer) ! Copy over "offline" settings CALL init_phystokenc(offline,istphy) ! Initialize tracer names, numbers, etc. for physics CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,& niadv,conv_flg,pbl_flg,solsym,& nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,& ok_isotopes,ok_iso_verif,ok_isotrac,& ok_init_iso,niso_possibles,tnat,& alpha_ideal,use_iso,iqiso,iso_num,& iso_indnum,zone_num,phase_num,& indnum_fn_num,index_trac,& niso,ntraceurs_zone,ntraciso) ! Initializations for Reprobus IF (type_trac == 'repr') THEN #ifdef REPROBUS CALL Init_chem_rep_phys(klon_omp,nlayer) #endif ENDIF !$OMP END PARALLEL IF (type_trac == 'inca') THEN #ifdef INCA call init_const_lmdz( & anneeref,dayref, iphysiq,day_step,nday, & nbsrf, is_oce,is_sic, is_ter,is_lic, calend) call init_inca_para( & nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, & distrib_phys,communicator) #endif END IF !!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) !$OMP PARALLEL DEFAULT(SHARED) ! Additional initializations for aquaplanets IF (iflag_phys>=100) THEN CALL iniaqua(klon_omp,iflag_phys) END IF IF (type_trac == 'inca') THEN #ifdef INCA CALL init_inca_dim(klon_omp,nbp_lev,nbp_lon,nbp_lat - 1, & rlonu,rlatu,rlonv,rlatv) #endif END IF !$OMP END PARALLEL END SUBROUTINE iniphysiq END MODULE iniphysiq_mod