From 827ca243647ac9a020b6c930847f881a9bc87e84 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Thu, 1 Jul 2021 15:42:31 +0200 Subject: [PATCH] Philippe 01/07/2021: budgets: treat NMNHDIM_BUDGET_LES_PDF dimension in diachronic files --- src/MNH/mode_les_diachro.f90 | 32 ++++++++++++++++++++++++++++---- src/MNH/write_diachro.f90 | 7 +++++++ src/MNH/write_lesn.f90 | 8 ++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/MNH/mode_les_diachro.f90 b/src/MNH/mode_les_diachro.f90 index 3bef1bc24..bf7af4a95 100644 --- a/src/MNH/mode_les_diachro.f90 +++ b/src/MNH/mode_les_diachro.f90 @@ -842,8 +842,8 @@ end subroutine Les_diachro_3D subroutine Les_diachro_4D( tpdiafile, tpfield, hgroup, hgroupcomment, odoavg, odonorm, pfield, hsuffixes, hmasks ) !################################################################################################################# -use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM_BUDGET_LES_SV, & - NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_TERM, NMNHDIM_UNUSED, & +use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM_BUDGET_LES_PDF, NMNHDIM_BUDGET_LES_SV, & + NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_TERM, NMNHDIM_UNUSED, & tfield_metadata_base use modd_io, only: tfiledata @@ -880,10 +880,13 @@ if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL& call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'optional dummy argument hmasks is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Present( hsuffixes ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hsuffixes is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Size( hmasks ) /= Size( pfield, 3) ) & call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hmasks (' // Trim( tzfield%cmnhname ) // ')' ) - call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, hmasks = hmasks ) else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & .and. tzfield%ndimlist(2) == NMNHDIM_BUDGET_LES_TIME & .and. tzfield%ndimlist(3) == NMNHDIM_BUDGET_TERM & @@ -892,15 +895,36 @@ else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'optional dummy argument hsuffixes is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Present( hmasks ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hmasks is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Size( hsuffixes ) /= Size( pfield, 3) ) & call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hsuffixes (' // Trim( tzfield%cmnhname ) // ')' ) - call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, hsuffixes= hsuffixes ) +else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & + .and. tzfield%ndimlist(2) == NMNHDIM_BUDGET_LES_TIME & + .and. tzfield%ndimlist(3) == NMNHDIM_BUDGET_LES_MASK & + .and. tzfield%ndimlist(4) == NMNHDIM_BUDGET_LES_PDF ) then + if ( .not. Present( hmasks ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hmasks is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + + if ( Present( hsuffixes ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hsuffixes is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + + if ( Size( hmasks ) /= Size( pfield, 3) ) & + call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hmasks (' // Trim( tzfield%cmnhname ) // ')' ) + else call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'ndimlist configuration not yet implemented for ' // Trim( tzfield%cmnhname ) ) end if +call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, & + hsuffixes = hsuffixes, hmasks = hmasks ) + end subroutine Les_diachro_4D !##################################################################################################################### diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90 index d78c07c1d..4dfae1c2a 100644 --- a/src/MNH/write_diachro.f90 +++ b/src/MNH/write_diachro.f90 @@ -1272,6 +1272,13 @@ select case ( idims ) do ji = 1, Size( pvar, 6 ) call Diachro_one_field_write_nc4( tzfile, tpbudiachro, tpfields(ji), pvar(:,:,:,:,:,ji:ji), [ 3, 4 ], gsplit, gdistributed ) end do + else if ( tpfields(1)%ndimlist(3) == NMNHDIM_BUDGET_LES_LEVEL & + .and. ( tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_TIME & + .or. tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_AVG_TIME ) & + .and. tpfields(1)%ndimlist(5) == NMNHDIM_BUDGET_LES_PDF ) then + if ( Size( tpfields ) /= 1 ) call Print_msg( NVERB_FATAL, 'IO', 'Write_diachro_nc4', & + 'wrong size of tpfields (variable '//trim(tpfields(1)%cmnhname)//')' ) + call Diachro_one_field_write_nc4( tzfile, tpbudiachro, tpfields(1), pvar, [ 3, 4, 5 ], gsplit, gdistributed ) else if ( tpfields(1)%ndimlist(3) == NMNHDIM_BUDGET_LES_LEVEL & .and. ( tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_TIME & .or. tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_AVG_TIME ) & diff --git a/src/MNH/write_lesn.f90 b/src/MNH/write_lesn.f90 index 3ddc83537..1369cb378 100644 --- a/src/MNH/write_lesn.f90 +++ b/src/MNH/write_lesn.f90 @@ -80,6 +80,7 @@ subroutine Write_les_n( tpdiafile ) use modd_conf_n, only: luserv, luserc, luserr, luseri, lusers, luserg, luserh use modd_io, only: tfiledata use modd_field, only: NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_SV, NMNHDIM_BUDGET_LES_MASK, & + NMNHDIM_BUDGET_LES_PDF, & NMNHDIM_SPECTRA_2PTS_NI, NMNHDIM_SPECTRA_2PTS_NJ, NMNHDIM_SPECTRA_LEVEL, NMNHDIM_UNUSED, & TYPEREAL use modd_grid_n, only: xdxhat, xdyhat @@ -386,6 +387,13 @@ if ( lles_pdf ) then cgroup = 'PDF' cgroupcomment = '' + tfield%ndims = 4 + !tfield%ndimlist(1) = NMNHDIM_BUDGET_LES_LEVEL + !tfield%ndimlist(2) = NMNHDIM_BUDGET_LES_TIME + !tfield%ndimlist(3) = NMNHDIM_BUDGET_LES_MASK + tfield%ndimlist(4) = NMNHDIM_BUDGET_LES_PDF + tfield%ndimlist(5:) = NMNHDIM_UNUSED + call Les_diachro_write( tpdiafile, XLES_PDF_TH, 'PDF_TH', 'Pdf potential temperature Profiles', '1', ymasks ) call Les_diachro_write( tpdiafile, XLES_PDF_W, 'PDF_W', 'Pdf vertical velocity Profiles', '1', ymasks ) call Les_diachro_write( tpdiafile, XLES_PDF_THV, 'PDF_THV', 'Pdf virtual pot. temp. Profiles', '1', ymasks ) -- GitLab