From 2c89ca0e7d69247e6498b9b04043ea5a3acaf4b3 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Wed, 26 May 2021 16:43:36 +0200 Subject: [PATCH] Philippe 26/05/2021: budgets: rename cname of budgets + use them in write_budget --- src/MNH/ini_budget.f90 | 24 +++++++++--------- src/MNH/write_budget.f90 | 54 +++++----------------------------------- 2 files changed, 18 insertions(+), 60 deletions(-) diff --git a/src/MNH/ini_budget.f90 b/src/MNH/ini_budget.f90 index ad5270b72..0c22dd667 100644 --- a/src/MNH/ini_budget.f90 +++ b/src/MNH/ini_budget.f90 @@ -41,51 +41,51 @@ end if nbudgets = NBUDGET_SV1 - 1 + nsv allocate( tbudgets( nbudgets ) ) -tbudgets(NBUDGET_U)%cname = "BU_RU" +tbudgets(NBUDGET_U)%cname = "UU" tbudgets(NBUDGET_U)%ccomment = "Budget for U" tbudgets(NBUDGET_U)%nid = NBUDGET_U -tbudgets(NBUDGET_V)%cname = "BU_RV" +tbudgets(NBUDGET_V)%cname = "VV" tbudgets(NBUDGET_V)%ccomment = "Budget for V" tbudgets(NBUDGET_V)%nid = NBUDGET_V -tbudgets(NBUDGET_W)%cname = "BU_RW" +tbudgets(NBUDGET_W)%cname = "WW" tbudgets(NBUDGET_W)%ccomment = "Budget for W" tbudgets(NBUDGET_W)%nid = NBUDGET_W -tbudgets(NBUDGET_TH)%cname = "BU_RTH" +tbudgets(NBUDGET_TH)%cname = "TH" tbudgets(NBUDGET_TH)%ccomment = "Budget for potential temperature" tbudgets(NBUDGET_TH)%nid = NBUDGET_TH -tbudgets(NBUDGET_TKE)%cname = "BU_RTKE" +tbudgets(NBUDGET_TKE)%cname = "TK" tbudgets(NBUDGET_TKE)%ccomment = "Budget for turbulent kinetic energy" tbudgets(NBUDGET_TKE)%nid = NBUDGET_TKE -tbudgets(NBUDGET_RV)%cname = "BU_RRV" +tbudgets(NBUDGET_RV)%cname = "RV" 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)%cname = "RC" 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)%cname = "RR" 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)%cname = "RI" 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)%cname = "RS" 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)%cname = "RG" tbudgets(NBUDGET_RG)%ccomment = "Budget for graupel mixing ratio" tbudgets(NBUDGET_RG)%nid = NBUDGET_RG -tbudgets(NBUDGET_RH)%cname = "BU_RRH" +tbudgets(NBUDGET_RH)%cname = "RH" tbudgets(NBUDGET_RH)%ccomment = "Budget for hail mixing ratio" tbudgets(NBUDGET_RH)%nid = NBUDGET_RH diff --git a/src/MNH/write_budget.f90 b/src/MNH/write_budget.f90 index e761b21c9..ea29bf5a9 100644 --- a/src/MNH/write_budget.f90 +++ b/src/MNH/write_budget.f90 @@ -641,7 +641,6 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress, real, intent(in) :: ptstep ! time step character(len=4) :: ybutype - character(len=:), allocatable :: ygroup_name integer :: igroups integer :: jproc integer :: jsv @@ -704,52 +703,6 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress, deallocate(zconvert) - jsv = -1 - select case( tpbudget%nid ) - case ( NBUDGET_U ) - ygroup_name = 'UU' - - case ( NBUDGET_V ) - ygroup_name = 'VV' - - case ( NBUDGET_W ) - ygroup_name = 'WW' - - case ( NBUDGET_TH ) - ygroup_name = 'TH' - - case ( NBUDGET_TKE ) - ygroup_name = 'TK' - - case ( NBUDGET_RV ) - ygroup_name = 'RV' - - case ( NBUDGET_RC ) - ygroup_name = 'RC' - - case ( NBUDGET_RR ) - ygroup_name = 'RR' - - case ( NBUDGET_RI ) - ygroup_name = 'RI' - - case ( NBUDGET_RS ) - ygroup_name = 'RS' - - case ( NBUDGET_RG ) - ygroup_name = 'RG' - - case ( NBUDGET_RH ) - ygroup_name = 'RH' - - case ( NBUDGET_SV1 : ) - jsv = tpbudget%nid - NBUDGET_SV1 + 1 - ygroup_name = csvnames(jsv) - - case default - call Print_msg( NVERB_ERROR, 'BUD', 'Store_one_budget', 'unknown budget type' ) - end select - allocate( tzfields( igroups ) ) !Copy all fields from tpbudget%tgroups @@ -839,7 +792,7 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress, tzbudiachro%ccomments(NLVL_SUBCATEGORY) = '' tzbudiachro%lleveluse(NLVL_GROUP) = .true. - tzbudiachro%clevels (NLVL_GROUP) = ygroup_name + tzbudiachro%clevels (NLVL_GROUP) = Trim( tpbudget%cname ) tzbudiachro%ccomments(NLVL_GROUP) = Trim( tpbudget%ccomment ) tzbudiachro%lleveluse(NLVL_SHAPE) = .false. @@ -890,6 +843,11 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress, tzbudiachro%njh = nbujh tzbudiachro%nkl = nbukl tzbudiachro%nkh = nbukh + if ( tpbudget%nid > NBUDGET_SV1 ) then + jsv = tpbudget%nid - NBUDGET_SV1 + 1 + else + jsv = -1 + end if tzbudiachro%nsv = jsv call Write_diachro( tpdiafile, tzbudiachro, tzfields, tpdates, zworkt, osplit = .true. ) -- GitLab