Newer
Older

WAUTELET Philippe
committed
!MNH_LIC Copyright 1995-2021 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence

WAUTELET Philippe
committed
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------

WAUTELET Philippe
committed
! Modifications:
! P. Wautelet 17/08/2020: add Budget_preallocate subroutine
!-----------------------------------------------------------------

WAUTELET Philippe
committed
module mode_ini_budget

WAUTELET Philippe
committed
use mode_msg

WAUTELET Philippe
committed
implicit none
private

WAUTELET Philippe
committed
public :: Budget_preallocate, Ini_budget

WAUTELET Philippe
committed

WAUTELET Philippe
committed
integer, parameter :: NSOURCESMAX = 60 !Maximum number of sources in a budget

WAUTELET Philippe
committed
contains

WAUTELET Philippe
committed
subroutine Budget_preallocate()
use modd_budget, only: nbudgets, tbudgets, &
NBUDGET_U, NBUDGET_V, NBUDGET_W, NBUDGET_TH, NBUDGET_TKE, &
NBUDGET_RV, NBUDGET_RC, NBUDGET_RR, NBUDGET_RI, NBUDGET_RS, &
NBUDGET_RG, NBUDGET_RH, NBUDGET_SV1

WAUTELET Philippe
committed
use modd_nsv, only: csvnames, nsv

WAUTELET Philippe
committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
integer :: ibudget
integer :: jsv
call Print_msg( NVERB_DEBUG, 'BUD', 'Budget_preallocate', 'called' )
if ( allocated( tbudgets ) ) then
call Print_msg( NVERB_WARNING, 'BUD', 'Budget_preallocate', 'tbudgets already allocated' )
return
end if
nbudgets = NBUDGET_SV1 - 1 + nsv
allocate( tbudgets( nbudgets ) )
tbudgets(NBUDGET_U)%cname = "BU_RU"
tbudgets(NBUDGET_U)%ccomment = "Budget for U"
tbudgets(NBUDGET_U)%nid = NBUDGET_U
tbudgets(NBUDGET_V)%cname = "BU_RV"
tbudgets(NBUDGET_V)%ccomment = "Budget for V"
tbudgets(NBUDGET_V)%nid = NBUDGET_V
tbudgets(NBUDGET_W)%cname = "BU_RW"
tbudgets(NBUDGET_W)%ccomment = "Budget for W"
tbudgets(NBUDGET_W)%nid = NBUDGET_W
tbudgets(NBUDGET_TH)%cname = "BU_RTH"
tbudgets(NBUDGET_TH)%ccomment = "Budget for potential temperature"
tbudgets(NBUDGET_TH)%nid = NBUDGET_TH
tbudgets(NBUDGET_TKE)%cname = "BU_RTKE"
tbudgets(NBUDGET_TKE)%ccomment = "Budget for turbulent kinetic energy"
tbudgets(NBUDGET_TKE)%nid = NBUDGET_TKE
tbudgets(NBUDGET_RV)%cname = "BU_RRV"
tbudgets(NBUDGET_RV)%ccomment = "Budget for water vapor mixing ratio"
tbudgets(NBUDGET_RV)%nid = NBUDGET_RV
tbudgets(NBUDGET_RC)%cname = "BU_RRC"
tbudgets(NBUDGET_RC)%ccomment = "Budget for cloud water mixing ratio"
tbudgets(NBUDGET_RC)%nid = NBUDGET_RC
tbudgets(NBUDGET_RR)%cname = "BU_RRR"
tbudgets(NBUDGET_RR)%ccomment = "Budget for rain water mixing ratio"
tbudgets(NBUDGET_RR)%nid = NBUDGET_RR
tbudgets(NBUDGET_RI)%cname = "BU_RRI"
tbudgets(NBUDGET_RI)%ccomment = "Budget for cloud ice mixing ratio"
tbudgets(NBUDGET_RI)%nid = NBUDGET_RI
tbudgets(NBUDGET_RS)%cname = "BU_RRS"
tbudgets(NBUDGET_RS)%ccomment = "Budget for snow/aggregate mixing ratio"
tbudgets(NBUDGET_RS)%nid = NBUDGET_RS
tbudgets(NBUDGET_RG)%cname = "BU_RRG"
tbudgets(NBUDGET_RG)%ccomment = "Budget for graupel mixing ratio"
tbudgets(NBUDGET_RG)%nid = NBUDGET_RG
tbudgets(NBUDGET_RH)%cname = "BU_RRH"
tbudgets(NBUDGET_RH)%ccomment = "Budget for hail mixing ratio"
tbudgets(NBUDGET_RH)%nid = NBUDGET_RH
do jsv = 1, nsv
ibudget = NBUDGET_SV1 - 1 + jsv

WAUTELET Philippe
committed
tbudgets(ibudget)%cname = Trim( csvnames(jsv) )
tbudgets(ibudget)%ccomment = 'Budget for scalar variable ' // Trim( csvnames(jsv) )

WAUTELET Philippe
committed
tbudgets(ibudget)%nid = ibudget
end do
end subroutine Budget_preallocate
! #################################################################
SUBROUTINE Ini_budget(KLUOUT,PTSTEP,KSV,KRR, &
ONUMDIFU,ONUMDIFTH,ONUMDIFSV, &
OHORELAX_UVWTH,OHORELAX_RV,OHORELAX_RC,OHORELAX_RR, &
OHORELAX_RI,OHORELAX_RS, OHORELAX_RG, OHORELAX_RH,OHORELAX_TKE, &
OHORELAX_SV, OVE_RELAX, ove_relax_grd, OCHTRANS, &
ONUDGING,ODRAGTREE,ODEPOTREE, &
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
! #################################################################
!
!!**** *INI_BUDGET* - routine to initialize the parameters for the budgets
!!
!! PURPOSE
!! -------
! The purpose of this routine is to set or compute the parameters used
! by the MESONH budgets. Names of files for budget recording are processed
! and storage arrays are initialized.
!
!!** METHOD
!! ------
!! The essential of information is passed by modules. The choice of budgets
!! and processes set by the user as integers is converted in "actions"
!! readable by the subroutine BUDGET under the form of string characters.
!! For each complete process composed of several elementary processes, names
!! of elementary processes are concatenated in order to have an explicit name
!! in the comment of the recording file for budget.
!!
!!
!! EXTERNAL
!! --------
!! None
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Modules MODD_*
!!
!! REFERENCE
!! ---------
!! Book2 of documentation (routine INI_BUDGET)
!!
!!
!! AUTHOR
!! ------
!! P. Hereil * Meteo France *
!!
!! MODIFICATIONS
!! -------------
!! Original 01/03/95
!! J. Stein 25/06/95 put the sources in phase with the code
!! J. Stein 20/07/95 reset to FALSE of all the switches when
!! CBUTYPE /= MASK or CART
!! J. Stein 26/06/96 add the new sources + add the increment between
!! 2 active processes
!! J.-P. Pinty 13/12/96 Allowance of multiple SVs
!! J.-P. Pinty 11/01/97 Includes deep convection ice and forcing processes
!! J.-P. Lafore 10/02/98 Allocation of the RHODJs for budget
!! V. Ducrocq 04/06/99 //
!! N. Asencio 18/06/99 // MASK case : delete KIMAX and KJMAX arguments,
!! GET_DIM_EXT_ll initializes the dimensions of the
!! extended local domain.

WAUTELET Philippe
committed
!! LBU_MASK and NBUSURF are allocated on the extended
!! local domain.
!! add 3 local variables IBUDIM1,IBUDIM2,IBUDIM3
!! to define the dimensions of the budget arrays
!! in the different cases CART and MASK
!! J.-P. Pinty 23/09/00 add budget for C2R2
!! V. Masson 18/11/02 add budget for 2way nesting
!! O.Geoffroy 03/2006 Add KHKO scheme
!! J.-P. Pinty 22/04/97 add the explicit hail processes
!! C.Lac 10/08/07 Add ADV for PPM without contribution
!! of each direction
!! C. Barthe 19/11/09 Add atmospheric electricity
!! C.Lac 01/07/11 Add vegetation drag
!! P. Peyrille, M. Tomasini : include in the forcing term the 2D forcing
!! terms in term 2DFRC search for modif PP . but Not very clean!

Gaelle Tanguy
committed
!! C .Lac 27/05/14 add negative corrections for chemical species
!! C.Lac 29/01/15 Correction for NSV_USER

ESCOBAR MUNOZ Juan
committed
!! J.Escobar 02/10/2015 modif for JPHEXT(JPVEXT) variable
!! C.Lac 04/12/15 Correction for LSUPSAT

WAUTELET Philippe
committed
! C. Lac 04/2016: negative contribution to the budget split between advection, turbulence and microphysics for KHKO/C2R2
! C. Barthe 01/2016: add budget for LIMA
! C. Lac 10/2016: add budget for droplet deposition
! S. Riette 11/2016: new budgets for ICE3/ICE4
! P. Wautelet 05/2016-04/2018: new data structures and calls for I/O
! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
! P. Wautelet 15/11/2019: remove unused CBURECORD variable
! P. Wautelet 24/02/2020: bugfix: corrected condition for budget NCDEPITH

WAUTELET Philippe
committed
! P. Wautelet 26/02/2020: bugfix: rename CEVA->REVA for budget for raindrop evaporation in C2R2 (necessary after commit 4ed805fc)

WAUTELET Philippe
committed
! P. Wautelet 26/02/2020: bugfix: add missing condition on OCOLD for NSEDIRH budget in LIMA case
! P. Wautelet 02-03/2020: use the new data structures and subroutines for budgets
! B. Vie 02/03/2020: LIMA negativity checks after turbulence, advection and microphysics budgets
! P .Wautelet 09/03/2020: add missing budgets for electricity

WAUTELET Philippe
committed
! P. Wautelet 25/03/2020: add missing ove_relax_grd
! P. Wautelet 23/04/2020: add nid in tbudgetdata datatype

WAUTELET Philippe
committed
! P. Wautelet + Benoit Vié 11/06/2020: improve removal of negative scalar variables + adapt the corresponding budgets
! P. Wautelet 30/06/2020: use NADVSV when possible

WAUTELET Philippe
committed
! P. Wautelet 30/06/2020: add NNETURSV, NNEADVSV and NNECONSV variables

WAUTELET Philippe
committed
! P. Wautelet 06/07/2020: bugfix: add condition on HTURB for NETUR sources for SV budgets

WAUTELET Philippe
committed
! P. Wautelet 08/12/2020: add nbusubwrite and nbutotwrite

WAUTELET Philippe
committed
! P. Wautelet 11/01/2021: ignore xbuwri for cartesian boxes (write at every xbulen interval)
! P. Wautelet 01/02/2021: bugfix: add missing CEDS source terms for SV budgets
! P. Wautelet 02/02/2021: budgets: add missing source terms for SV budgets in LIMA
! P. Wautelet 03/02/2021: budgets: add new source if LIMA splitting: CORR2
! P. Wautelet 10/02/2021: budgets: add missing sources for NSV_C2R2BEG+3 budget

WAUTELET Philippe
committed
! P. Wautelet 11/02/2021: budgets: add missing term SCAV for NSV_LIMA_SCAVMASS budget
! P. Wautelet 02/03/2021: budgets: add terms for blowing snow
! P. Wautelet 04/03/2021: budgets: add terms for drag due to buildings

WAUTELET Philippe
committed
! P. Wautelet 17/03/2021: choose source terms for budgets with character strings instead of multiple integer variables
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
use modd_2d_frc, only: l2d_adv_frc, l2d_rel_frc
use modd_blowsnow, only: lblowsnow
use modd_blowsnow_n, only: lsnowsubl
use modd_budget
use modd_ch_aerosol, only: lorilam
use modd_conf, only: l1d, lcartesian, lforcing, lthinshell, nmodel
use modd_dragbldg_n, only: ldragbldg
use modd_dust, only: ldust
use modd_dyn, only: lcorio, xseglen
use modd_dyn_n, only: xtstep
use modd_elec_descr, only: linductive, lrelax2fw_ion
use modd_field, only: TYPEREAL

WAUTELET Philippe
committed
use modd_nsv, only: csvnames, &
nsv_aerbeg, nsv_aerend, nsv_aerdepbeg, nsv_aerdepend, nsv_c2r2beg, nsv_c2r2end, &

WAUTELET Philippe
committed
nsv_chembeg, nsv_chemend, nsv_chicbeg, nsv_chicend, nsv_csbeg, nsv_csend, &
nsv_dstbeg, nsv_dstend, nsv_dstdepbeg, nsv_dstdepend, nsv_elecbeg, nsv_elecend, &
#ifdef MNH_FOREFIRE
nsv_ffbeg, nsv_ffend, &
#endif
nsv_lgbeg, nsv_lgend, &
nsv_lima_beg, nsv_lima_end, nsv_lima_ccn_acti, nsv_lima_ccn_free, nsv_lima_hom_haze, &
nsv_lima_ifn_free, nsv_lima_ifn_nucl, nsv_lima_imm_nucl, &
nsv_lima_nc, nsv_lima_nr, nsv_lima_ni, nsv_lima_scavmass, &

WAUTELET Philippe
committed
nsv_lnoxbeg, nsv_lnoxend, nsv_ppbeg, nsv_ppend, &
nsv_sltbeg, nsv_sltend, nsv_sltdepbeg, nsv_sltdepend, nsv_snwbeg, nsv_snwend, &
nsv_user
use modd_parameters, only: jphext
use modd_param_c2r2, only: ldepoc_c2r2 => ldepoc, lrain_c2r2 => lrain, lsedc_c2r2 => lsedc, lsupsat_c2r2 => lsupsat
use modd_param_ice, only: ladj_after, ladj_before, ldeposc_ice => ldeposc, lred, lsedic_ice => lsedic, lwarm_ice => lwarm
use modd_param_n, only: cactccn, celec

WAUTELET Philippe
committed
use modd_param_lima, only: laero_mass_lima => laero_mass, lacti_lima => lacti, lcold_lima => lcold, ldepoc_lima => ldepoc, &
lhail_lima => lhail, lhhoni_lima => lhhoni, lmeyers_lima => lmeyers, lnucl_lima => lnucl, &
lptsplit, &
lrain_lima => lrain, lscav_lima => lscav, lsedc_lima => lsedc, lsedi_lima => lsedi, &
lsnow_lima => lsnow, lwarm_lima => lwarm, &
nmod_ccn, nmod_ifn, nmod_imm
use modd_salt, only: lsalt
use modd_viscosity, only: lvisc, lvisc_r, lvisc_sv, lvisc_th, lvisc_uvw
IMPLICIT NONE
!
!* 0.1 declarations of argument
!
!
INTEGER, INTENT(IN) :: KLUOUT ! Logical unit number for prints
REAL, INTENT(IN) :: PTSTEP ! time step
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
INTEGER, INTENT(IN) :: KSV ! number of scalar variables
INTEGER, INTENT(IN) :: KRR ! number of moist variables
LOGICAL, INTENT(IN) :: ONUMDIFU ! switch to activate the numerical
! diffusion for momentum
LOGICAL, INTENT(IN) :: ONUMDIFTH ! for meteorological scalar variables
LOGICAL, INTENT(IN) :: ONUMDIFSV ! for tracer scalar variables
LOGICAL, INTENT(IN) :: OHORELAX_UVWTH ! switch for the
! horizontal relaxation for U,V,W,TH
LOGICAL, INTENT(IN) :: OHORELAX_RV ! switch for the
! horizontal relaxation for Rv
LOGICAL, INTENT(IN) :: OHORELAX_RC ! switch for the
! horizontal relaxation for Rc
LOGICAL, INTENT(IN) :: OHORELAX_RR ! switch for the
! horizontal relaxation for Rr
LOGICAL, INTENT(IN) :: OHORELAX_RI ! switch for the
! horizontal relaxation for Ri
LOGICAL, INTENT(IN) :: OHORELAX_RS ! switch for the
! horizontal relaxation for Rs
LOGICAL, INTENT(IN) :: OHORELAX_RG ! switch for the
! horizontal relaxation for Rg
LOGICAL, INTENT(IN) :: OHORELAX_RH ! switch for the
! horizontal relaxation for Rh
LOGICAL, INTENT(IN) :: OHORELAX_TKE ! switch for the
! horizontal relaxation for tke
LOGICAL,DIMENSION(:),INTENT(IN):: OHORELAX_SV ! switch for the
! horizontal relaxation for scalar variables
LOGICAL, INTENT(IN) :: OVE_RELAX ! switch to activate the vertical
logical, intent(in) :: ove_relax_grd ! switch to activate the vertical
! relaxation to the lowest verticals
LOGICAL, INTENT(IN) :: OCHTRANS ! switch to activate convective
!transport for SV
LOGICAL, INTENT(IN) :: ONUDGING ! switch to activate nudging
LOGICAL, INTENT(IN) :: ODRAGTREE ! switch to activate vegetation drag
LOGICAL, INTENT(IN) :: ODEPOTREE ! switch to activate droplet deposition on tree
CHARACTER (LEN=*), INTENT(IN) :: HRAD ! type of the radiation scheme
CHARACTER (LEN=*), INTENT(IN) :: HDCONV ! type of the deep convection scheme
CHARACTER (LEN=*), INTENT(IN) :: HSCONV ! type of the shallow convection scheme
CHARACTER (LEN=*), INTENT(IN) :: HTURB ! type of the turbulence scheme
CHARACTER (LEN=*), INTENT(IN) :: HTURBDIM! dimensionnality of the turbulence
! scheme
CHARACTER (LEN=*), INTENT(IN) :: HCLOUD ! type of microphysical scheme
!
!* 0.2 declarations of local variables
real, parameter :: ITOL = 1e-6

WAUTELET Philippe
committed
INTEGER :: JI, JJ ! loop indices
INTEGER :: IIMAX_ll, IJMAX_ll ! size of the physical global domain
INTEGER :: IIU, IJU ! size along x and y directions
! of the extended subdomain
INTEGER :: IBUDIM1 ! first dimension of the budget arrays
! = NBUIMAX in CART case
! = NBUKMAX in MASK case
INTEGER :: IBUDIM2 ! second dimension of the budget arrays
! = NBUJMAX in CART case
! = nbusubwrite in MASK case
INTEGER :: IBUDIM3 ! third dimension of the budget arrays
! = NBUKMAX in CART case
! = NBUMASK in MASK case
INTEGER :: JSV ! loop indice for the SVs
INTEGER :: IINFO_ll ! return status of the interface routine
integer :: ibudget
logical :: gtmp

WAUTELET Philippe
committed
type(tbusourcedata) :: tzsource ! Used to prepare metadate of source terms
call Print_msg( NVERB_DEBUG, 'BUD', 'Ini_budget', 'called' )
!
!* 1. COMPUTE BUDGET VARIABLES
! ------------------------
!
NBUSTEP = NINT (XBULEN / PTSTEP)
NBUTSHIFT=0
!
! common dimension for all CBUTYPE values
!
IF (LBU_KCP) THEN
NBUKMAX = 1
ELSE
NBUKMAX = NBUKH - NBUKL +1
END IF
!
if ( cbutype == 'CART' .or. cbutype == 'MASK' ) then
!Check if xbulen is a multiple of xtstep (within tolerance)
if ( Abs( Nint( xbulen / xtstep ) * xtstep - xbulen ) > ( ITOL * xtstep ) ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xbulen is not a multiple of xtstep' )

WAUTELET Philippe
committed
if ( cbutype == 'CART' ) then
!Check if xseglen is a multiple of xbulen (within tolerance)
if ( Abs( Nint( xseglen / xbulen ) * xbulen - xseglen ) > ( ITOL * xseglen ) ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xseglen is not a multiple of xbulen' )

WAUTELET Philippe
committed
!Write cartesian budgets every xbulen time period (do not take xbuwri into account)
xbuwri = xbulen
nbusubwrite = 1 !Number of budget time average periods for each write
nbutotwrite = nbusubwrite * Nint( xseglen / xbulen ) !Total number of budget time average periods

WAUTELET Philippe
committed
else if ( cbutype == 'MASK' ) then
!Check if xbuwri is a multiple of xtstep (within tolerance)
if ( Abs( Nint( xbuwri / xtstep ) * xtstep - xbuwri ) > ( ITOL * xtstep ) ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xbuwri is not a multiple of xtstep' )

WAUTELET Philippe
committed
!Check if xbuwri is a multiple of xbulen (within tolerance)
if ( Abs( Nint( xbuwri / xbulen ) * xbulen - xbuwri ) > ( ITOL * xbulen ) ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xbuwri is not a multiple of xbulen' )

WAUTELET Philippe
committed
!Check if xseglen is a multiple of xbuwri (within tolerance)
if ( Abs( Nint( xseglen / xbuwri ) * xbuwri - xseglen ) > ( ITOL * xseglen ) ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xseglen is not a multiple of xbuwri' )
nbusubwrite = Nint ( xbuwri / xbulen ) !Number of budget time average periods for each write
nbutotwrite = nbusubwrite * Nint( xseglen / xbuwri ) !Total number of budget time average periods

WAUTELET Philippe
committed
end if
end if
IF (CBUTYPE=='CART') THEN ! cartesian case only
!
IF ( NBUIH < NBUIL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUIH < NBUIL' )
IF (LBU_ICP) THEN
NBUIMAX_ll = 1
ELSE
NBUIMAX_ll = NBUIH - NBUIL +1
END IF
IF ( NBUJH < NBUJL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUJH < NBUJL' )
IF (LBU_JCP) THEN
NBUJMAX_ll = 1
ELSE
NBUJMAX_ll = NBUJH - NBUJL +1
END IF
IF ( NBUKH < NBUKL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUKH < NBUKL' )

ESCOBAR MUNOZ Juan
committed
CALL GET_INTERSECTION_ll(NBUIL+JPHEXT,NBUJL+JPHEXT,NBUIH+JPHEXT,NBUJH+JPHEXT, &
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
NBUSIL,NBUSJL,NBUSIH,NBUSJH,"PHYS",IINFO_ll)
IF ( IINFO_ll /= 1 ) THEN !
IF (LBU_ICP) THEN
NBUIMAX = 1
ELSE
NBUIMAX = NBUSIH - NBUSIL +1
END IF
IF (LBU_JCP) THEN
NBUJMAX = 1
ELSE
NBUJMAX = NBUSJH - NBUSJL +1
END IF
ELSE ! the intersection is void
CBUTYPE='SKIP' ! no budget on this processor
NBUIMAX = 0 ! in order to allocate void arrays
NBUJMAX = 0
ENDIF
! three first dimensions of budget arrays in cart and skip cases
IBUDIM1=NBUIMAX
IBUDIM2=NBUJMAX
IBUDIM3=NBUKMAX
! these variables are not be used
NBUMASK=-1
!
ELSEIF (CBUTYPE=='MASK') THEN ! mask case only
!
LBU_ENABLE=.TRUE.
! result on the FM_FILE
NBUTIME = 1
CALL GET_DIM_EXT_ll ('B', IIU,IJU)
ALLOCATE( LBU_MASK( IIU ,IJU, NBUMASK) )
LBU_MASK(:,:,:)=.FALSE.

WAUTELET Philippe
committed
ALLOCATE( NBUSURF( IIU, IJU, NBUMASK, nbusubwrite) )
NBUSURF(:,:,:,:) = 0
!
! three first dimensions of budget arrays in mask case
! the order of the dimensions are the order expected in WRITE_DIACHRO routine:
! x,y,z,time,mask,processus and in this case x and y are missing
! first dimension of the arrays : dimension along K
! second dimension of the arrays : number of the budget time period
! third dimension of the arrays : number of the budget masks zones
IBUDIM1=NBUKMAX
IBUDIM2=nbusubwrite
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
IBUDIM3=NBUMASK
! these variables are not used in this case
NBUIMAX=-1
NBUJMAX=-1
! the beginning and the end along x and y direction : global extended domain
! get dimensions of the physical global domain
CALL GET_GLOBALDIMS_ll (IIMAX_ll,IJMAX_ll)
NBUIL=1
NBUIH=IIMAX_ll + 2 * JPHEXT
NBUJL=1
NBUJH=IJMAX_ll + 2 * JPHEXT
!
ELSE ! default case
!
LBU_ENABLE=.FALSE.
NBUIMAX = -1
NBUJMAX = -1
LBU_RU = .FALSE.
LBU_RV = .FALSE.
LBU_RW = .FALSE.
LBU_RTH= .FALSE.
LBU_RTKE= .FALSE.
LBU_RRV= .FALSE.
LBU_RRC= .FALSE.
LBU_RRR= .FALSE.
LBU_RRI= .FALSE.
LBU_RRS= .FALSE.
LBU_RRG= .FALSE.
LBU_RRH= .FALSE.
LBU_RSV= .FALSE.
!
! three first dimensions of budget arrays in default case
IBUDIM1=0
IBUDIM2=0
IBUDIM3=0
!
END IF
!
!
!-------------------------------------------------------------------------------
!
!* 2. ALLOCATE MEMORY FOR BUDGET ARRAYS AND INITIALIZE
! ------------------------------------------------
!
LBU_BEG =.TRUE.
!
!-------------------------------------------------------------------------------
!
!* 3. INITALIZE VARIABLES
! -------------------
!
!Create intermediate variable to store rhodj for scalar variables
if ( lbu_rth .or. lbu_rtke .or. lbu_rrv .or. lbu_rrc .or. lbu_rrr .or. &
lbu_rri .or. lbu_rrs .or. lbu_rrg .or. lbu_rrh .or. lbu_rsv ) then
allocate( tburhodj )
tburhodj%cmnhname = 'RhodJS'
tburhodj%cstdname = ''
tburhodj%clongname = 'RhodJS'
tburhodj%cunits = 'kg'
tburhodj%ccomment = 'RhodJ for Scalars variables'
tburhodj%ngrid = 1
tburhodj%ntype = TYPEREAL
tburhodj%ndims = 3
allocate( tburhodj%xdata(ibudim1, ibudim2, ibudim3) )
tburhodj%xdata(:, :, :) = 0.
end if

WAUTELET Philippe
committed
tzsource%ntype = TYPEREAL
tzsource%ndims = 3

WAUTELET Philippe
committed
! Budget of RU
tbudgets(NBUDGET_U)%lenabled = lbu_ru
if ( lbu_ru ) then

WAUTELET Philippe
committed
allocate( tbudgets(NBUDGET_U)%trhodj )

WAUTELET Philippe
committed
tbudgets(NBUDGET_U)%trhodj%cmnhname = 'RhodJX'
tbudgets(NBUDGET_U)%trhodj%cstdname = ''
tbudgets(NBUDGET_U)%trhodj%clongname = 'RhodJX'
tbudgets(NBUDGET_U)%trhodj%cunits = 'kg'
tbudgets(NBUDGET_U)%trhodj%ccomment = 'RhodJ for momentum along X axis'
tbudgets(NBUDGET_U)%trhodj%ngrid = 2
tbudgets(NBUDGET_U)%trhodj%ntype = TYPEREAL
tbudgets(NBUDGET_U)%trhodj%ndims = 3

WAUTELET Philippe
committed
allocate( tbudgets(NBUDGET_U)%trhodj%xdata(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_U)%trhodj%xdata(:, :, :) = 0.

WAUTELET Philippe
committed
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_U)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_U)%tsources(NSOURCESMAX) )

WAUTELET Philippe
committed
allocate( tbudgets(NBUDGET_U)%xtmpstore(ibudim1, ibudim2, ibudim3) )

WAUTELET Philippe
committed
tbudgets(NBUDGET_U)%tsources(:)%ngroup = 0

WAUTELET Philippe
committed
tzsource%ccomment = 'Budget of momentum along X axis'
tzsource%ngrid = 2

WAUTELET Philippe
committed
tzsource%cunits = 'm s-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource, odonotinit = .true., ooverwrite = .false. )

WAUTELET Philippe
committed
tzsource%cunits = 'm s-2'

WAUTELET Philippe
committed
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'NUD'
tzsource%clongname = 'nudging'
tzsource%lavailable = onudging
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'CURV'
tzsource%clongname = 'curvature'
tzsource%lavailable = .not.l1d .and. .not.lcartesian
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'COR'
tzsource%clongname = 'Coriolis'
tzsource%lavailable = lcorio
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifu
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_uvwth .or. ove_relax .or. ove_relax_grd
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'DRAG'
tzsource%clongname = 'drag force'
tzsource%lavailable = odragtree
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'DRAGB'
tzsource%clongname = 'drag force due to buildings'
tzsource%lavailable = ldragbldg
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'MAFL'
tzsource%clongname = 'mass flux'
tzsource%lavailable = hsconv == 'EDKF'
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_uvw
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
tzsource%cmnhname = 'PRES'
tzsource%clongname = 'pressure'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_U), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_U) )
call Sourcelist_scan( tbudgets(NBUDGET_U), cbulist_ru )

WAUTELET Philippe
committed
end if
! Budget of RV
tbudgets(NBUDGET_V)%lenabled = lbu_rv
if ( lbu_rv ) then
allocate( tbudgets(NBUDGET_V)%trhodj )
tbudgets(NBUDGET_V)%trhodj%cmnhname = 'RhodJY'
tbudgets(NBUDGET_V)%trhodj%cstdname = ''
tbudgets(NBUDGET_V)%trhodj%clongname = 'RhodJY'
tbudgets(NBUDGET_V)%trhodj%cunits = 'kg'
tbudgets(NBUDGET_V)%trhodj%ccomment = 'RhodJ for momentum along Y axis'
tbudgets(NBUDGET_V)%trhodj%ngrid = 3
tbudgets(NBUDGET_V)%trhodj%ntype = TYPEREAL
tbudgets(NBUDGET_V)%trhodj%ndims = 3
allocate( tbudgets(NBUDGET_V)%trhodj%xdata(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_V)%trhodj%xdata(:, :, :) = 0.
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_V)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_V)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_V)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_V)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of momentum along Y axis'
tzsource%ngrid = 3
tzsource%cunits = 'm s-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 'm s-2'

WAUTELET Philippe
committed
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'NUD'
tzsource%clongname = 'nudging'
tzsource%lavailable = onudging
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'CURV'
tzsource%clongname = 'curvature'
tzsource%lavailable = .not.l1d .and. .not.lcartesian
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'COR'
tzsource%clongname = 'Coriolis'
tzsource%lavailable = lcorio
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifu
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_uvwth .or. ove_relax .or. ove_relax_grd
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'DRAG'
tzsource%clongname = 'drag force'
tzsource%lavailable = odragtree
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'DRAGB'
tzsource%clongname = 'drag force due to buildings'
tzsource%lavailable = ldragbldg
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'MAFL'
tzsource%clongname = 'mass flux'
tzsource%lavailable = hsconv == 'EDKF'
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_uvw
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
tzsource%cmnhname = 'PRES'
tzsource%clongname = 'pressure'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_V), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_V) )
call Sourcelist_scan( tbudgets(NBUDGET_V), cbulist_rv )
end if
! Budget of RW
tbudgets(NBUDGET_W)%lenabled = lbu_rw
if ( lbu_rw ) then
allocate( tbudgets(NBUDGET_W)%trhodj )
tbudgets(NBUDGET_W)%trhodj%cmnhname = 'RhodJZ'
tbudgets(NBUDGET_W)%trhodj%cstdname = ''
tbudgets(NBUDGET_W)%trhodj%clongname = 'RhodJZ'
tbudgets(NBUDGET_W)%trhodj%cunits = 'kg'
tbudgets(NBUDGET_W)%trhodj%ccomment = 'RhodJ for momentum along Y axis'
tbudgets(NBUDGET_W)%trhodj%ngrid = 4
tbudgets(NBUDGET_W)%trhodj%ntype = TYPEREAL
tbudgets(NBUDGET_W)%trhodj%ndims = 3
allocate( tbudgets(NBUDGET_W)%trhodj%xdata(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_W)%trhodj%xdata(:, :, :) = 0.
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_W)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_W)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_W)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_W)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of momentum along Z axis'
tzsource%ngrid = 4
tzsource%cunits = 'm s-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 'm s-2'

WAUTELET Philippe
committed
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'NUD'
tzsource%clongname = 'nudging'
tzsource%lavailable = onudging
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'CURV'
tzsource%clongname = 'curvature'
tzsource%lavailable = .not.l1d .and. .not.lcartesian .and. .not.lthinshell
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'COR'
tzsource%clongname = 'Coriolis'
tzsource%lavailable = lcorio .and. .not.l1d .and. .not.lthinshell
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifu
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_uvwth .or. ove_relax .or. ove_relax_grd
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_uvw
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'GRAV'
tzsource%clongname = 'gravity'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
tzsource%cmnhname = 'PRES'
tzsource%clongname = 'pressure'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_W), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_W) )
call Sourcelist_scan( tbudgets(NBUDGET_W), cbulist_rw )
end if
! Budget of RTH
tbudgets(NBUDGET_TH)%lenabled = lbu_rth
if ( lbu_rth ) then
tbudgets(NBUDGET_TH)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_TH)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_TH)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_TH)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_TH)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of potential temperature'
tzsource%ngrid = 1
tzsource%cunits = 'K'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 'K s-1'

WAUTELET Philippe
committed
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = '2DADV'
tzsource%clongname = 'advective forcing'
tzsource%lavailable = l2d_adv_frc
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = '2DREL'
tzsource%clongname = 'relaxation forcing'
tzsource%lavailable = l2d_rel_frc
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NUD'
tzsource%clongname = 'nudging'
tzsource%lavailable = onudging
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'PREF'
tzsource%clongname = 'reference pressure'
tzsource%lavailable = krr > 0 .and. .not.l1d
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_uvwth .or. ove_relax .or. ove_relax_grd
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'RAD'
tzsource%clongname = 'radiation'
tzsource%lavailable = hrad /= 'NONE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DCONV'
tzsource%clongname = 'KAFR convection'
tzsource%lavailable = hdconv == 'KAFR' .OR. hsconv == 'KAFR'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DISSH'
tzsource%clongname = 'dissipation'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NETUR'
tzsource%clongname = 'negative correction induced by turbulence'
tzsource%lavailable = hturb == 'TKEL' .and. ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' )
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'MAFL'
tzsource%clongname = 'mass flux'
tzsource%lavailable = hsconv == 'EDKF'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'SNSUB'
tzsource%clongname = 'blowing snow sublimation'
tzsource%lavailable = lblowsnow .and. lsnowsubl
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_th
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NEADV'
tzsource%clongname = 'negative correction induced by advection'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NEGA'
tzsource%clongname = 'negative correction'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'SEDI'
tzsource%clongname = 'heat transport by hydrometeors sedimentation'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HENU'
tzsource%clongname = 'heterogeneous nucleation'
gtmp = cactccn == 'ABRK' .and. (lorilam .or. ldust .or. lsalt )

WAUTELET Philippe
committed
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. lacti_lima .and. nmod_ccn >= 1 ) &
.or. hcloud(1:3) == 'ICE' &
.or. ( hcloud == 'C2R2' .and. ( gtmp .or. .not.lsupsat_c2r2 ) ) &
.or. ( hcloud == 'KHKO' .and. ( gtmp .or. .not.lsupsat_c2r2 ) )
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'REVA'
tzsource%clongname = 'rain evaporation'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( ( .not. lptsplit .and. lwarm_lima .and. lrain_lima ) .or. lptsplit ) ) &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 ) &
.or. hcloud == 'KESS'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HIND'
tzsource%clongname = 'heterogeneous nucleation by deposition'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HINC'
tzsource%clongname = 'heterogeneous nucleation by contact'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HON'
tzsource%clongname = 'homogeneous nucleation'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HONH'
tzsource%clongname = 'haze homogeneous nucleation'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima .and. lhhoni_lima .and. nmod_ccn >= 1
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HONC'
tzsource%clongname = 'droplet homogeneous freezing'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lnucl_lima ) )
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HONR'
tzsource%clongname = 'raindrop homogeneous freezing'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lnucl_lima .and. lrain_lima ) )
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'SFR'
tzsource%clongname = 'spontaneous freezing'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DEPS'
tzsource%clongname = 'deposition on snow'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lsnow_lima ) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DEPG'
tzsource%clongname = 'deposition on graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'IMLT'
tzsource%clongname = 'ice melting'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima ) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'BERFI'
tzsource%clongname = 'Bergeron-Findeisen'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima ) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'RIM'
tzsource%clongname = 'riming of cloud droplets'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'ACC'
tzsource%clongname = 'accretion of rain'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit &
.or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima .and. lrain_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'CFRZ'
tzsource%clongname = 'conversion freezing of rain'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'WETG'
tzsource%clongname = 'wet growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DRYG'
tzsource%clongname = 'dry growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'GMLT'
tzsource%clongname = 'graupel melting'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'WETH'
tzsource%clongname = 'wet growth of hail'
tzsource%lavailable = ( hcloud == 'LIMA' .and. .not.lptsplit .and. lhail_lima .and. lcold_lima &
.and. lwarm_lima .and. lsnow_lima ) &
.or. hcloud == 'ICE4'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'DRYH'
tzsource%clongname = 'dry growth of hail'
tzsource%lavailable = hcloud == 'ICE4' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'HMLT'
tzsource%clongname = 'melting of hail'
tzsource%lavailable = ( hcloud == 'LIMA' .and. .not.lptsplit .and. lhail_lima .and. lcold_lima &
.and. lwarm_lima .and. lsnow_lima ) &
.or. hcloud == 'ICE4'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'CORR'
tzsource%clongname = 'correction'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'CEDS'
tzsource%clongname = 'adjustment to saturation'
tzsource%lavailable = hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'ADJU'
tzsource%clongname = 'adjustment before'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. ladj_before .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'CDEPI'
tzsource%clongname = 'deposition on ice'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. ( .not. lred .or. ( lred .and. ladj_after ) .or. celec /= 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'COND'
tzsource%clongname = 'vapor condensation or cloud water evaporation'
tzsource%lavailable = hcloud == 'C2R2' .or. hcloud == 'KHKO' .or. hcloud == 'KESS' .or. hcloud == 'REVE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
tzsource%cmnhname = 'NECON'
tzsource%clongname = 'negative correction induced by condensation'
tzsource%lavailable = ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' ) &
.and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_TH), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_TH) )
call Sourcelist_scan( tbudgets(NBUDGET_TH), cbulist_rth )
end if
! Budget of RTKE
tbudgets(NBUDGET_TKE)%lenabled = lbu_rtke
if ( lbu_rtke ) then
tbudgets(NBUDGET_TKE)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_TKE)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_TKE)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_TKE)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_TKE)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of turbulent kinetic energy'
tzsource%ngrid = 1
tzsource%cunits = 'm2 s-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 'm2 s-3'

WAUTELET Philippe
committed
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_tke
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'DRAG'
tzsource%clongname = 'drag force'
tzsource%lavailable = odragtree
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'DRAGB'
tzsource%clongname = 'drag force due to buildings'
tzsource%lavailable = ldragbldg
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'DP'
tzsource%clongname = 'dynamic production'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'TP'
tzsource%clongname = 'thermal production'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'DISS'
tzsource%clongname = 'dissipation of TKE'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'TR'
tzsource%clongname = 'turbulent transport'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_TKE), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_TKE) )
call Sourcelist_scan( tbudgets(NBUDGET_TKE), cbulist_rtke )
end if
! Budget of RRV
tbudgets(NBUDGET_RV)%lenabled = lbu_rrv .and. krr >= 1
if ( tbudgets(NBUDGET_RV)%lenabled ) then
tbudgets(NBUDGET_RV)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_RV)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_RV)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_RV)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_RV)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of water vapor mixing ratio'
tzsource%ngrid = 1
tzsource%cunits = 'kg kg-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 's-1'

WAUTELET Philippe
committed
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = '2DADV'
tzsource%clongname = 'advective forcing'
tzsource%lavailable = l2d_adv_frc
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = '2DREL'
tzsource%clongname = 'relaxation forcing'
tzsource%lavailable = l2d_rel_frc
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NUD'
tzsource%clongname = 'nudging'
tzsource%lavailable = onudging
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_rv .or. ove_relax
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'DCONV'
tzsource%clongname = 'KAFR convection'
tzsource%lavailable = hdconv == 'KAFR' .OR. hsconv == 'KAFR'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NETUR'
tzsource%clongname = 'negative correction induced by turbulence'
tzsource%lavailable = hturb == 'TKEL' .and. ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' )
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'MAFL'
tzsource%clongname = 'mass flux'
tzsource%lavailable = hsconv == 'EDKF'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'SNSUB'
tzsource%clongname = 'blowing snow sublimation'
tzsource%lavailable = lblowsnow .and. lsnowsubl
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_r
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NEADV'
tzsource%clongname = 'negative correction induced by advection'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NEGA'
tzsource%clongname = 'negative correction'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'HENU'
tzsource%clongname = 'heterogeneous nucleation'
gtmp = cactccn == 'ABRK' .and. (lorilam .or. ldust .or. lsalt )

WAUTELET Philippe
committed
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. lacti_lima .and. nmod_ccn >= 1 ) &
.or. hcloud(1:3) == 'ICE' &
.or. ( hcloud == 'C2R2' .and. ( gtmp .or. .not.lsupsat_c2r2 ) ) &
.or. ( hcloud == 'KHKO' .and. ( gtmp .or. .not.lsupsat_c2r2 ) )
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'REVA'
tzsource%clongname = 'rain evaporation'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( ( .not. lptsplit .and. lwarm_lima .and. lrain_lima ) &
.or. lptsplit ) ) &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 ) &
.or. hcloud == 'KESS'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'HIND'
tzsource%clongname = 'heterogeneous nucleation by deposition'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'HONH'
tzsource%clongname = 'haze homogeneous nucleation'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima .and. lhhoni_lima .and. nmod_ccn >= 1
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'DEPS'
tzsource%clongname = 'deposition on snow'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lsnow_lima ) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'DEPG'
tzsource%clongname = 'deposition on graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'CEDS'
tzsource%clongname = 'adjustment to saturation'
tzsource%lavailable = hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'ADJU'
tzsource%clongname = 'adjustment before'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. ladj_before .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'COND'
tzsource%clongname = 'vapor condensation or cloud water evaporation'
tzsource%lavailable = hcloud == 'C2R2' .or. hcloud == 'KHKO' .or. hcloud == 'KESS' .or. hcloud == 'REVE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'CORR'
tzsource%clongname = 'correction'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'CDEPI'
tzsource%clongname = 'deposition on ice'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. ( .not. lred .or. ( lred .and. ladj_after ) .or. celec /= 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'CORR2'
tzsource%clongname = 'supplementary correction inside LIMA splitting'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
tzsource%cmnhname = 'NECON'
tzsource%clongname = 'negative correction induced by condensation'
tzsource%lavailable = ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' ) &
.and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RV), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_RV) )
call Sourcelist_scan( tbudgets(NBUDGET_RV), cbulist_rrv )
end if
! Budget of RRC
tbudgets(NBUDGET_RC)%lenabled = lbu_rrc .and. krr >= 2
if ( tbudgets(NBUDGET_RC)%lenabled ) then
if ( hcloud(1:3) == 'ICE' .and. lred .and. lsedic_ice .and. ldeposc_ice ) &
call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'lred=T + lsedic=T + ldeposc=T:'// &
'DEPO and SEDI source terms are mixed and stored in SEDI' )
tbudgets(NBUDGET_RC)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_RC)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_RC)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_RC)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_RC)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of cloud water mixing ratio'
tzsource%ngrid = 1
tzsource%cunits = 'kg kg-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 's-1'

WAUTELET Philippe
committed
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_rc
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DCONV'
tzsource%clongname = 'KAFR convection'
tzsource%lavailable = hdconv == 'KAFR' .OR. hsconv == 'KAFR'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DEPOTR'
tzsource%clongname = 'tree droplet deposition'
tzsource%lavailable = odragtree .and. odepotree
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'NETUR'
tzsource%clongname = 'negative correction induced by turbulence'
tzsource%lavailable = hturb == 'TKEL' .and. ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_r
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'NEADV'
tzsource%clongname = 'negative correction induced by advection'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'NEGA'
tzsource%clongname = 'negative correction'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CORR'
tzsource%clongname = 'correction'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lptsplit .and. lwarm_lima .and. lrain_lima ) &
.or. ( hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'SEDI'
tzsource%clongname = 'sedimentation of cloud'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. lsedc_lima ) &
.or. ( hcloud(1:3) == 'ICE' .and. lsedic_ice ) &
.or. ( hcloud == 'C2R2' .and. lsedc_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lsedc_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DEPO'
tzsource%clongname = 'surface droplet deposition'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. ldepoc_lima ) &
.or. ( hcloud == 'C2R2' .and. ldepoc_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. ldepoc_c2r2 ) &
.or. ( hcloud(1:3) == 'ICE' .and. ldeposc_ice .and. celec == 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'R2C1'
tzsource%clongname = 'rain to cloud change after sedimentation'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit .and. lwarm_lima .and. lrain_lima
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'HENU'
tzsource%clongname = 'CCN activation'
gtmp = cactccn == 'ABRK' .and. (lorilam .or. ldust .or. lsalt )

WAUTELET Philippe
committed
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. lacti_lima .and. nmod_ccn >= 1 ) &
.or. ( hcloud == 'C2R2' .and. ( gtmp .or. .not.lsupsat_c2r2 ) ) &
.or. ( hcloud == 'KHKO' .and. ( gtmp .or. .not.lsupsat_c2r2 ) )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'HINC'
tzsource%clongname = 'heterogeneous nucleation by contact'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'ADJU'
tzsource%clongname = 'adjustment to saturation'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. ladj_before .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'HON'
tzsource%clongname = 'homogeneous nucleation'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'AUTO'
tzsource%clongname = 'autoconversion into rain'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) ) ) &
.or. hcloud == 'KESS' &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'ACCR'
tzsource%clongname = 'accretion'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) ) ) &
.or. hcloud == 'KESS' &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'REVA'
tzsource%clongname = 'rain evaporation'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'HONC'
tzsource%clongname = 'droplet homogeneous freezing'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lnucl_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'IMLT'
tzsource%clongname = 'ice melting'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima ) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'BERFI'
tzsource%clongname = 'Bergeron-Findeisen'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima) ) ) .or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'RIM'
tzsource%clongname = 'riming of cloud water'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lsnow_lima ) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CMEL'
tzsource%clongname = 'collection by snow and conversion into rain with T>XTT on ice'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'WETG'
tzsource%clongname = 'wet growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DRYG'
tzsource%clongname = 'dry growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CVRC'
tzsource%clongname = 'rain to cloud change after other microphysical processes'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'WETH'
tzsource%clongname = 'wet growth of hail'
tzsource%lavailable = ( hcloud == 'LIMA' .and. .not.lptsplit .and. lhail_lima .and. lcold_lima &
.and. lwarm_lima .and. lsnow_lima ) &
.or. hcloud == 'ICE4'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'DRYH'
tzsource%clongname = 'dry growth of hail'
tzsource%lavailable = hcloud == 'ICE4' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CEDS'
tzsource%clongname = 'adjustment to saturation'
tzsource%lavailable = hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CDEPI'
tzsource%clongname = 'condensation/deposition on ice'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. ( .not. lred .or. ( lred .and. ladj_after ) .or. celec /= 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'COND'
tzsource%clongname = 'vapor condensation or cloud water evaporation'
tzsource%lavailable = hcloud == 'C2R2' .or. hcloud == 'KHKO' .or. hcloud == 'KESS' .or. hcloud == 'REVE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'CORR2'
tzsource%clongname = 'supplementary correction inside LIMA splitting'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
tzsource%cmnhname = 'NECON'
tzsource%clongname = 'negative correction induced by condensation'
tzsource%lavailable = ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' ) &
.and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RC), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_RC) )
call Sourcelist_scan( tbudgets(NBUDGET_RC), cbulist_rrc )
end if
! Budget of RRR
tbudgets(NBUDGET_RR)%lenabled = lbu_rrr .and. krr >= 3
if ( tbudgets(NBUDGET_RR)%lenabled ) then
tbudgets(NBUDGET_RR)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_RR)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_RR)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_RR)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_RR)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of rain water mixing ratio'
tzsource%ngrid = 1
tzsource%cunits = 'kg kg-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 's-1'

WAUTELET Philippe
committed
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_rr
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'NETUR'
tzsource%clongname = 'negative correction induced by turbulence'
tzsource%lavailable = hturb == 'TKEL' .and. ( hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_r
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'NEADV'
tzsource%clongname = 'negative correction induced by advection'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'NEGA'
tzsource%clongname = 'negative correction'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'CORR'
tzsource%clongname = 'correction'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lptsplit .and. lwarm_lima .and. lrain_lima ) &
.or. ( hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'SEDI'
tzsource%clongname = 'sedimentation of rain drops'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lwarm_lima .and. lrain_lima ) &
.or. hcloud == 'KESS' &
.or. hcloud(1:3) == 'ICE' &
.or. hcloud == 'C2R2' &
.or. hcloud == 'KHKO'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'R2C1'
tzsource%clongname = 'rain to cloud after sedimentation'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit .and. lwarm_lima .and. lrain_lima
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'AUTO'
tzsource%clongname = 'autoconversion into rain drops'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) ) ) &
.or. hcloud == 'KESS' &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'ACCR'
tzsource%clongname = 'accretion of cloud droplets'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) ) ) &
.or. hcloud == 'KESS' &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'REVA'
tzsource%clongname = 'rain evaporation'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lwarm_lima .and. lrain_lima ) ) ) &
.or. hcloud == 'KESS' &
.or. ( hcloud(1:3) == 'ICE' .and. lwarm_ice ) &
.or. ( hcloud == 'C2R2' .and. lrain_c2r2 ) &
.or. ( hcloud == 'KHKO' .and. lrain_c2r2 )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'HONR'
tzsource%clongname = 'rain homogeneous freezing'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lnucl_lima .and. lrain_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'ACC'
tzsource%clongname = 'accretion of rain water on aggregates'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima &
.and. lsnow_lima .and. lrain_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'CMEL'
tzsource%clongname = 'collection of droplets by snow and conversion into rain'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'CFRZ'
tzsource%clongname = 'conversion freezing of rain drops'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'WETG'
tzsource%clongname = 'wet growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'DRYG'
tzsource%clongname = 'dry growth of graupel'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'GMLT'
tzsource%clongname = 'graupel melting'
tzsource%lavailable = ( hcloud == 'LIMA' .and. ( lptsplit .or. (lcold_lima .and. lwarm_lima .and. lsnow_lima) ) ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'CVRC'
tzsource%clongname = 'rain to cloud change after other microphysical processes'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'WETH'
tzsource%clongname = 'wet growth of hail'
tzsource%lavailable = ( hcloud == 'LIMA' .and. .not.lptsplit .and. lhail_lima .and. lcold_lima &
.and. lwarm_lima .and. lsnow_lima ) &
.or. hcloud == 'ICE4'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'DRYH'
tzsource%clongname = 'dry growth of hail'
tzsource%lavailable = hcloud == 'ICE4' .and. lred .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'HMLT'
tzsource%clongname = 'melting of hail'
tzsource%lavailable = ( hcloud == 'LIMA' .and. .not.lptsplit .and. lhail_lima .and. lcold_lima &
.and. lwarm_lima .and. lsnow_lima ) &
.or. hcloud == 'ICE4'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'SFR'
tzsource%clongname = 'spontaneous freezing'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
!PW: a documenter
tzsource%cmnhname = 'CORR2'
tzsource%clongname = 'supplementary correction inside LIMA splitting'
tzsource%lavailable = hcloud == 'LIMA' .and. lptsplit
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
tzsource%cmnhname = 'NECON'
tzsource%clongname = 'negative correction induced by condensation'
tzsource%lavailable = ( hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA' ) &
.and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RR), tzsource )
call Sourcelist_sort_compact( tbudgets(NBUDGET_RR) )
call Sourcelist_scan( tbudgets(NBUDGET_RR), cbulist_rrr )
end if
! Budget of RRI
tbudgets(NBUDGET_RI)%lenabled = lbu_rri .and. krr >= 4
if ( tbudgets(NBUDGET_RI)%lenabled ) then
tbudgets(NBUDGET_RI)%trhodj => tburhodj
!Allocate all basic source terms (used or not)
!The size should be large enough (bigger than necessary is OK)

WAUTELET Philippe
committed
tbudgets(NBUDGET_RI)%nsourcesmax = NSOURCESMAX
allocate( tbudgets(NBUDGET_RI)%tsources(NSOURCESMAX) )
allocate( tbudgets(NBUDGET_RI)%xtmpstore(ibudim1, ibudim2, ibudim3) )
tbudgets(NBUDGET_RI)%tsources(:)%ngroup = 0
tzsource%ccomment = 'Budget of cloud ice mixing ratio'
tzsource%ngrid = 1
tzsource%cunits = 'kg kg-1'

WAUTELET Philippe
committed
tzsource%cmnhname = 'INIF'
tzsource%clongname = 'initial state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'ENDF'
tzsource%clongname = 'final state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource, odonotinit = .true., ooverwrite = .true. )

WAUTELET Philippe
committed
tzsource%cmnhname = 'AVEF'
tzsource%clongname = 'averaged state'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource, odonotinit = .true., ooverwrite = .false. )
tzsource%cunits = 's-1'

WAUTELET Philippe
committed
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
tzsource%cmnhname = 'ASSE'
tzsource%clongname = 'time filter (Asselin)'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'NEST'
tzsource%clongname = 'nesting'
tzsource%lavailable = nmodel > 1
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'FRC'
tzsource%clongname = 'forcing'
tzsource%lavailable = lforcing
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'DIF'
tzsource%clongname = 'numerical diffusion'
tzsource%lavailable = onumdifth
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'REL'
tzsource%clongname = 'relaxation'
tzsource%lavailable = ohorelax_ri
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'DCONV'
tzsource%clongname = 'KAFR convection'
tzsource%lavailable = hdconv == 'KAFR' .OR. hsconv == 'KAFR'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'VTURB'
tzsource%clongname = 'vertical turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HTURB'
tzsource%clongname = 'horizontal turbulent diffusion'
tzsource%lavailable = hturb == 'TKEL' .and. HTURBDIM == '3DIM'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'NETUR'
tzsource%clongname = 'negative correction induced by turbulence'
tzsource%lavailable = hturb == 'TKEL' .and. ( hcloud == 'ICE3' .or. hcloud == 'ICE4' .or. hcloud == 'LIMA' )
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'VISC'
tzsource%clongname = 'viscosity'
tzsource%lavailable = lvisc .and. lvisc_r
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'ADV'
tzsource%clongname = 'total advection'
tzsource%lavailable = .true.
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'NEADV'
tzsource%clongname = 'negative correction induced by advection'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'NEGA'
tzsource%clongname = 'negative correction'
tzsource%lavailable = hcloud == 'KESS' .or. hcloud == 'ICE3' .or. hcloud == 'ICE4' &
.or. hcloud == 'KHKO' .or. hcloud == 'C2R2' .or. hcloud == 'LIMA'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'CORR'
tzsource%clongname = 'correction'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lptsplit .and. lcold_lima .and. lsnow_lima ) &
.or. ( hcloud(1:3) == 'ICE' .and. lred .and. celec == 'NONE' )
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'ADJU'
tzsource%clongname = 'adjustment before on ice'
tzsource%lavailable = hcloud(1:3) == 'ICE' .and. lred .and. ladj_before .and. celec == 'NONE'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'SEDI'
tzsource%clongname = 'sedimentation of rain drops'
tzsource%lavailable = ( hcloud == 'LIMA' .and. lcold_lima .and. lsedi_lima ) &
.or. hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HENU'
tzsource%clongname = 'heterogeneous nucleation'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HIND'
tzsource%clongname = 'heterogeneous nucleation by deposition'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HINC'
tzsource%clongname = 'heterogeneous nucleation by contact'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HON'
tzsource%clongname = 'homogeneous nucleation'
tzsource%lavailable = hcloud(1:3) == 'ICE'
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HONH'
tzsource%clongname = 'haze homogeneous nucleation'
tzsource%lavailable = hcloud == 'LIMA' .and. lcold_lima .and. lnucl_lima .and. lhhoni_lima .and. nmod_ccn >= 1
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'HONC'
tzsource%clongname = 'droplet homogeneous nucleation'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lwarm_lima .and. lnucl_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'CNVI'
tzsource%clongname = 'conversion of snow to cloud ice'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lsnow_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
tzsource%cmnhname = 'CNVS'
tzsource%clongname = 'conversion of pristine ice to snow'
tzsource%lavailable = hcloud == 'LIMA' .and. ( lptsplit .or. ( lcold_lima .and. lsnow_lima ) )
call Budget_source_add( tbudgets(NBUDGET_RI), tzsource )
Loading
Loading full blame...