diff --git a/src/ARCH_SRC/CPL_WAVE/MNH/ini_modeln.f90 b/src/ARCH_SRC/CPL_WAVE/MNH/ini_modeln.f90 index 97237ff59a9e42a6937ec6cd347452fa9bc4a38a..6acaeaeaa60cf48de14007e48440459cf980ca04 100644 --- a/src/ARCH_SRC/CPL_WAVE/MNH/ini_modeln.f90 +++ b/src/ARCH_SRC/CPL_WAVE/MNH/ini_modeln.f90 @@ -271,7 +271,11 @@ END MODULE MODI_INI_MODEL_n !! M.Leriche 2016 Chemistry !! 10/2016 M.Mazoyer New KHKO output fields !! 10/2016 (C.Lac) Add max values -!! F. Brosse Oct. 2016 add prod/loss terms computation for chemistry +!! F. Brosse Oct. 2016 add prod/loss terms computation for chemistry +!! M.Leriche 2016 Chemistry +!! M.Leriche 10/02/17 prevent negative values in LBX(Y)SVS +!! M.Leriche 01/07/2017 Add DIAG chimical surface fluxes +!! 09/2017 Q.Rodier add LTEND_UV_FRC !--------------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -332,6 +336,7 @@ USE MODD_CH_MNHC_n, ONLY : LUSECHEM, LUSECHAQ, LUSECHIC, LCH_INIT_FIELD, & USE MODD_CH_PH_n USE MODD_CH_AEROSOL, ONLY : LORILAM USE MODD_CH_AERO_n, ONLY : XSOLORG,XMI +USE MODD_CH_FLX_n, ONLY : XCHFLX USE MODD_PARAM_KAFR_n USE MODD_PARAM_MFSHALL_n USE MODD_DEEP_CONVECTION_n @@ -454,7 +459,7 @@ CHARACTER(LEN=2) :: YDIR ! Type of the data field in LFIFM file INTEGER :: IGRID ! C-grid indicator in LFIFM file INTEGER :: ILENCH ! Length of comment string in LFIFM file CHARACTER (LEN=100) :: YCOMMENT!comment string in LFIFM file -CHARACTER (LEN=16) :: YRECFM ! Name of the desired field in LFIFM file +CHARACTER (LEN=LEN_HREC) :: YRECFM ! Name of the desired field in LFIFM file INTEGER :: IIU ! Upper dimension in x direction (local) INTEGER :: IJU ! Upper dimension in y direction (local) INTEGER :: IIU_ll ! Upper dimension in x direction (global) @@ -708,6 +713,16 @@ IF (LMEAN_FIELD) THEN ALLOCATE(XTEMP2_MEAN(IIU,IJU,IKU)) ; XTEMP2_MEAN = 0.0 ALLOCATE(XPABS2_MEAN(IIU,IJU,IKU)) ; XPABS2_MEAN = 0.0 ! + ALLOCATE(XUM_MAX(IIU,IJU,IKU)) ; XUM_MAX = -1.E20 + ALLOCATE(XVM_MAX(IIU,IJU,IKU)) ; XVM_MAX = -1.E20 + ALLOCATE(XWM_MAX(IIU,IJU,IKU)) ; XWM_MAX = -1.E20 + ALLOCATE(XTHM_MAX(IIU,IJU,IKU)) ; XTHM_MAX = 0.0 + ALLOCATE(XTEMPM_MAX(IIU,IJU,IKU)) ; XTEMPM_MAX = 0.0 + IF (CTURB/='NONE') THEN + ALLOCATE(XTKEM_MAX(IIU,IJU,IKU)) + XTKEM_MAX = 0.0 + END IF + ALLOCATE(XPABSM_MAX(IIU,IJU,IKU)) ; XPABSM_MAX = 0.0 END IF ! IF ((CUVW_ADV_SCHEME(1:3)=='CEN') .AND. (CTEMP_SCHEME == 'LEFR') ) THEN @@ -1386,6 +1401,8 @@ IF (KMI == 1) THEN ALLOCATE(XGXTHFRC(IKU,NFRC)) ALLOCATE(XGYTHFRC(IKU,NFRC)) ALLOCATE(XPGROUNDFRC(NFRC)) + ALLOCATE(XTENDUFRC(IKU,NFRC)) + ALLOCATE(XTENDVFRC(IKU,NFRC)) ELSE ALLOCATE(TDTFRC(0)) ALLOCATE(XUFRC(0,0)) @@ -1398,6 +1415,8 @@ IF (KMI == 1) THEN ALLOCATE(XGXTHFRC(0,0)) ALLOCATE(XGYTHFRC(0,0)) ALLOCATE(XPGROUNDFRC(0)) + ALLOCATE(XTENDUFRC(0,0)) + ALLOCATE(XTENDVFRC(0,0)) END IF IF ( LFORCING ) THEN ALLOCATE(XWTFRC(IIU,IJU,IKU)) @@ -1499,6 +1518,10 @@ IF (LUSECHAQ.AND.(CPROGRAM == 'DIAG '.OR.CPROGRAM == 'MESONH')) THEN XACPRAQ(:,:,:) = 0. ENDIF ENDIF +IF ((LUSECHEM).AND.(CPROGRAM == 'DIAG ')) THEN + ALLOCATE(XCHFLX(IIU,IJU,NSV_CHEM)) + XCHFLX(:,:,:) = 0. +END IF ! !------------------------------------------------------------------------------- ! @@ -1604,6 +1627,7 @@ CALL READ_FIELD(HINIFILE,HLUOUT,IMASDEV, IIU,IJU,IKU,XTSTEP, & NFRC,TDTFRC,XUFRC,XVFRC,XWFRC,XTHFRC,XRVFRC, & XTENDTHFRC,XTENDRVFRC,XGXTHFRC,XGYTHFRC, & XPGROUNDFRC, XATC, & + XTENDUFRC, XTENDVFRC, & NADVFRC,TDTADVFRC,XDTHFRC,XDRVFRC, & NRELFRC,TDTRELFRC,XTHREL,XRVREL, & XVTH_FLUX_M,XWTH_FLUX_M,XVU_FLUX_M, & @@ -1705,6 +1729,59 @@ IF ((KMI==1).AND.(.NOT. LSTEADYLS)) THEN XLBXUS,XLBXVS,XLBXWS,XLBXTHS,XLBXTKES,XLBXRS,XLBXSVS, & XLBYUS,XLBYVS,XLBYWS,XLBYTHS,XLBYTKES,XLBYRS,XLBYSVS ) CALL MPPDB_CHECK3D(XUT,"INI_MODEL_N-after ini_cpl::XUT",PRECISION) +! + DO JSV=NSV_CHEMBEG,NSV_CHEMEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_LNOXBEG,NSV_LNOXEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_AERBEG,NSV_AEREND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_DSTBEG,NSV_DSTEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_DSTDEPBEG,NSV_DSTDEPEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_SLTBEG,NSV_SLTEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_SLTDEPBEG,NSV_SLTDEPEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! + DO JSV=NSV_PPBEG,NSV_PPEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! +#ifdef MNH_FOREFIRE + DO JSV=NSV_FFBEG,NSV_FFEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO + ! +#endif + DO JSV=NSV_CSBEG,NSV_CSEND + XLBXSVS(:,:,:,JSV)=MAX(XLBXSVS(:,:,:,JSV),0.) + XLBYSVS(:,:,:,JSV)=MAX(XLBYSVS(:,:,:,JSV),0.) + ENDDO +! END IF ! IF ( KMI > 1) THEN @@ -2192,7 +2269,7 @@ END IF ! !* 30. Total production/Loss for chemical species ! -IF (LUSECHEM.OR.LCHEMDIAG) THEN +IF (LCHEMDIAG) THEN CALL CH_INIT_PRODLOSSTOT_n(ILUOUT) IF (NEQ_PLT>0) THEN ALLOCATE(XPROD(IIU,IJU,IKU,NEQ_PLT)) @@ -2212,7 +2289,7 @@ END IF ! !* 31. Extended production/loss terms for chemical species ! -IF (LUSECHEM.OR.LCHEMDIAG) THEN +IF (LCHEMDIAG) THEN CALL CH_INIT_BUDGET_n(ILUOUT) IF (NEQ_BUDGET>0) THEN ALLOCATE(IINDEX(2,NNONZEROTERMS))