Skip to content
Snippets Groups Projects
Commit d426b6f3 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 03/09/2024: CBULIST_*: deallocate them when not enabled

parent b076faf6
No related branches found
No related tags found
No related merge requests found
!MNH_LIC Copyright 1995-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC Copyright 1995-2024 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1. !MNH_LIC for details. version 1.
...@@ -4521,19 +4521,19 @@ end do SV_BUDGETS ...@@ -4521,19 +4521,19 @@ end do SV_BUDGETS
call Ini_budget_groups( tbudgets, ibudim1, ibudim2, ibudim3 ) call Ini_budget_groups( tbudgets, ibudim1, ibudim2, ibudim3 )
if ( tbudgets(NBUDGET_U) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_U), cbulist_ru ) call Sourcelist_nml_compact( tbudgets(NBUDGET_U), cbulist_ru )
if ( tbudgets(NBUDGET_V) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_V), cbulist_rv ) call Sourcelist_nml_compact( tbudgets(NBUDGET_V), cbulist_rv )
if ( tbudgets(NBUDGET_W) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_W), cbulist_rw ) call Sourcelist_nml_compact( tbudgets(NBUDGET_W), cbulist_rw )
if ( tbudgets(NBUDGET_TH) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_TH), cbulist_rth ) call Sourcelist_nml_compact( tbudgets(NBUDGET_TH), cbulist_rth )
if ( tbudgets(NBUDGET_TKE)%lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_TKE), cbulist_rtke ) call Sourcelist_nml_compact( tbudgets(NBUDGET_TKE), cbulist_rtke )
if ( tbudgets(NBUDGET_RV) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RV), cbulist_rrv ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RV), cbulist_rrv )
if ( tbudgets(NBUDGET_RC) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RC), cbulist_rrc ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RC), cbulist_rrc )
if ( tbudgets(NBUDGET_RR) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RR), cbulist_rrr ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RR), cbulist_rrr )
if ( tbudgets(NBUDGET_RI) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RI), cbulist_rri ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RI), cbulist_rri )
if ( tbudgets(NBUDGET_RS) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RS), cbulist_rrs ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RS), cbulist_rrs )
if ( tbudgets(NBUDGET_RG) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RG), cbulist_rrg ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RG), cbulist_rrg )
if ( tbudgets(NBUDGET_RH) %lenabled ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RH), cbulist_rrh ) call Sourcelist_nml_compact( tbudgets(NBUDGET_RH), cbulist_rrh )
if ( lbu_rsv ) call Sourcelist_sv_nml_compact( cbulist_rsv ) call Sourcelist_sv_nml_compact( lbu_rsv, cbulist_rsv )
end subroutine Ini_budget end subroutine Ini_budget
...@@ -5031,6 +5031,8 @@ subroutine Sourcelist_nml_compact( tpbudget, hbulist ) ...@@ -5031,6 +5031,8 @@ subroutine Sourcelist_nml_compact( tpbudget, hbulist )
if ( Allocated( hbulist ) ) Deallocate( hbulist ) if ( Allocated( hbulist ) ) Deallocate( hbulist )
if ( .not. tpbudget%lenabled ) return
if ( tpbudget%ngroups < 3 ) then if ( tpbudget%ngroups < 3 ) then
call Print_msg( NVERB_ERROR, 'BUD', 'Sourcelist_nml_compact', 'ngroups is too small' ) call Print_msg( NVERB_ERROR, 'BUD', 'Sourcelist_nml_compact', 'ngroups is too small' )
return return
...@@ -5066,18 +5068,24 @@ subroutine Sourcelist_nml_compact( tpbudget, hbulist ) ...@@ -5066,18 +5068,24 @@ subroutine Sourcelist_nml_compact( tpbudget, hbulist )
end subroutine Sourcelist_nml_compact end subroutine Sourcelist_nml_compact
subroutine Sourcelist_sv_nml_compact( hbulist ) subroutine Sourcelist_sv_nml_compact( oenabled, hbulist )
!This subroutine reduce the size of the hbulist !This subroutine reduce the size of the hbulist
!For SV variables the reduction is simpler than for other variables !For SV variables the reduction is simpler than for other variables
!because it is too complex to do this cleanly (the enabled source terms are different for each scalar variable) !because it is too complex to do this cleanly (the enabled source terms are different for each scalar variable)
use modd_budget, only: NBULISTMAXLEN, tbudgetdata use modd_budget, only: NBULISTMAXLEN, tbudgetdata
logical, intent(in) :: oenabled
character(len=*), dimension(:), allocatable, intent(inout) :: hbulist character(len=*), dimension(:), allocatable, intent(inout) :: hbulist
character(len=NBULISTMAXLEN), dimension(:), allocatable :: ybulist_new character(len=NBULISTMAXLEN), dimension(:), allocatable :: ybulist_new
integer :: ilines integer :: ilines
integer :: ji integer :: ji
if ( .not. oenabled ) then
if ( allocated( hbulist ) ) deallocate( hbulist )
return
end if
ilines = 0 ilines = 0
do ji = 1, Size( hbulist ) do ji = 1, Size( hbulist )
if ( Len_trim(hbulist(ji)) > 0 ) ilines = ilines + 1 if ( Len_trim(hbulist(ji)) > 0 ) ilines = ilines + 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment