From 986dc7f8d7e7edda469fbd0feb03836c2037d781 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Wed, 17 Feb 2021 16:18:21 +0100 Subject: [PATCH] Philippe 17/02/2021: budgets: several forgotten bugfixes --- src/MNH/ini_budget.f90 | 2 +- src/MNH/lima_meyers.f90 | 10 ++++++---- src/MNH/rain_ice_fast_rg.f90 | 1 + src/MNH/relaxation.f90 | 7 +++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/MNH/ini_budget.f90 b/src/MNH/ini_budget.f90 index fc7d602d6..48388d034 100644 --- a/src/MNH/ini_budget.f90 +++ b/src/MNH/ini_budget.f90 @@ -2773,7 +2773,7 @@ SV_BUDGETS: do jsv = 1, ksv tzsource%clongname = 'numerical diffusion' call Budget_source_add( tbudgets(ibudget), tzsource, gcond, ndifsv ) - gcond = ohorelax_sv( jsv ) .or. ( celec /= 'none' .and. lrelax2fw_ion .and. (jsv == nsv_elecbeg .or. jsv == nsv_elecend ) ) + gcond = ohorelax_sv( jsv ) .or. ( celec /= 'NONE' .and. lrelax2fw_ion .and. (jsv == nsv_elecbeg .or. jsv == nsv_elecend ) ) tzsource%cmnhname = 'REL' tzsource%clongname = 'relaxation' call Budget_source_add( tbudgets(ibudget), tzsource, gcond, nrelsv ) diff --git a/src/MNH/lima_meyers.f90 b/src/MNH/lima_meyers.f90 index 94f19c64c..7e55e1ab7 100644 --- a/src/MNH/lima_meyers.f90 +++ b/src/MNH/lima_meyers.f90 @@ -322,7 +322,7 @@ IF( INEGT >= 1 ) THEN if ( lbudget_rv ) call Budget_store_init( tbudgets(NBUDGET_RV), 'HIND', prvs(:, :, :) * prhodj(:, :, :) ) if ( lbudget_ri ) call Budget_store_init( tbudgets(NBUDGET_RI), 'HIND', pris(:, :, :) * prhodj(:, :, :) ) if ( lbudget_sv ) call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'HIND', pcis(:, :, :) * prhodj(:, :, :) ) - if ( lbudget_sv ) & + if ( lbudget_sv .and. nmod_ifn > 0) & call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HIND', pins(:, :, :, 1) * prhodj(:, :, :) ) end if @@ -357,7 +357,7 @@ IF( INEGT >= 1 ) THEN Unpack ( zris(:), mask = gnegt(:, :, :), field = pris(:, :, :) ) * prhodj(:, :, :) ) if ( lbudget_sv ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'HIND', & Unpack ( zcis(:), mask = gnegt(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) ) - if ( lbudget_sv ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HIND', & + if ( lbudget_sv .and. nmod_ifn > 0 ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HIND', & Unpack ( zins(:, 1), mask = gnegt(:, :, :), field = pins(:, :, :, 1) ) * prhodj(:, :, :) ) end if ! @@ -373,7 +373,8 @@ IF( INEGT >= 1 ) THEN call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_nc), 'HINC', pccs(:, :, :) * prhodj(:, :, :) ) call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'HINC', & Unpack ( zcis(:), mask = gnegt(:, :, :), field = pcis(:, :, :) ) * prhodj(:, :, :) ) - call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HINC', & + if ( nmod_ifn > 0 ) & + call Budget_store_init( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HINC', & Unpack ( zins(:, 1), mask = gnegt(:, :, :), field = pins(:, :, :, 1) ) * prhodj(:, :, :) ) end if end if @@ -422,7 +423,8 @@ IF( INEGT >= 1 ) THEN if ( lbudget_sv ) then call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_nc), 'HINC', pccs(:, :, :) * prhodj(:, :, :) ) call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ni), 'HINC', pcis(:, :, :) * prhodj(:, :, :) ) - call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HINC', pins(:, :, :, 1) * prhodj(:, :, :) ) + if ( nmod_ifn > 0 ) & + call Budget_store_end( tbudgets(NBUDGET_SV1 - 1 + nsv_lima_ifn_nucl), 'HINC', pins(:, :, :, 1) * prhodj(:, :, :) ) end if end if diff --git a/src/MNH/rain_ice_fast_rg.f90 b/src/MNH/rain_ice_fast_rg.f90 index a2d9689cf..c3366b66a 100644 --- a/src/MNH/rain_ice_fast_rg.f90 +++ b/src/MNH/rain_ice_fast_rg.f90 @@ -424,6 +424,7 @@ REAL, DIMENSION(size(PRHODREF),7) :: ZZW1 ! Work arrays ! !* 6.5 Melting of the graupeln ! + zzw(:) = 0. !initialization necessary (for budgets) WHERE( PRGT(:)>XRTMIN(6) .AND. PRGS(:)>0.0 .AND. PZT(:)>XTT ) ZZW(:) = PRVT(:)*PPRES(:)/((XMV/XMD)+PRVT(:)) ! Vapor pressure ZZW(:) = PKA(:)*(XTT-PZT(:)) + & diff --git a/src/MNH/relaxation.f90 b/src/MNH/relaxation.f90 index 7105d043d..7202c8ea1 100644 --- a/src/MNH/relaxation.f90 +++ b/src/MNH/relaxation.f90 @@ -462,7 +462,9 @@ if ( lbudget_rg .and. ohorelax_rg ) call Budget_store_init( tbudgets(NBUDGET_R if ( lbudget_rh .and. ohorelax_rh ) call Budget_store_init( tbudgets(NBUDGET_RH ), 'REL', prrs (:, :, :, 7) ) if ( lbudget_sv ) then do jsv = 1, ksv - if ( ohorelax_sv( jsv ) ) call Budget_store_init( tbudgets(jsv + NBUDGET_SV1 - 1), 'REL', prsvs(:, :, :, jsv) ) + if ( .not. lrelax2fw_ion .or. ( jsv /= nsv_elecbeg .and. jsv /= nsv_elecend ) ) then + if ( ohorelax_sv( jsv ) ) call Budget_store_init( tbudgets(jsv + NBUDGET_SV1 - 1), 'REL', prsvs(:, :, :, jsv) ) + end if end do end if @@ -747,8 +749,9 @@ if ( lbudget_rg .and. ohorelax_rg ) call Budget_store_end( tbudgets(NBUDGET_RG if ( lbudget_rh .and. ohorelax_rh ) call Budget_store_end( tbudgets(NBUDGET_RH ), 'REL', prrs (:, :, :, 7) ) if ( lbudget_sv ) then do jsv = 1, ksv - if ( .not. lrelax2fw_ion .or. ( jsv /= nsv_elecbeg .and. jsv /= nsv_elecend ) ) & + if ( .not. lrelax2fw_ion .or. ( jsv /= nsv_elecbeg .and. jsv /= nsv_elecend ) ) then if ( ohorelax_sv( jsv ) ) call Budget_store_end( tbudgets(jsv + NBUDGET_SV1 - 1), 'REL', prsvs(:, :, :, jsv) ) + end if end do end if -- GitLab