From 335044d1fc0a3c59b2bca1b6d72d597c54b5810b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 20 Jun 2024 14:33:10 -0400 Subject: [PATCH 1/5] Add CLOUDJ_STANDALONE as cpp switch This update removes the requirement of using MODEL_GEOSCHEM if passing vertical grid from parent model. Signed-off-by: Lizzie Lundgren --- CMakeLists.txt | 2 +- src/Core/cldj_cmn_mod.F90 | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28974ec..09b9400 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,7 +215,7 @@ if(NOT CLOUDJ_EXTERNAL_CONFIG) # Set Cloud-J compile flag to standalone target_compile_definitions(CloudJBuildProperties - INTERFACE "CloudJ_Standalone" + INTERFACE CLOUDJ_STANDALONE ) # Set CMAKE_BUILD_TYPE to Release by default diff --git a/src/Core/cldj_cmn_mod.F90 b/src/Core/cldj_cmn_mod.F90 index 081c652..26b8708 100644 --- a/src/Core/cldj_cmn_mod.F90 +++ b/src/Core/cldj_cmn_mod.F90 @@ -23,14 +23,14 @@ MODULE CLDJ_CMN_MOD ! Can be changed as needed. Must be exact atmospheric dimensions. -#ifdef MODEL_GEOSCHEM - integer :: L_ ! # of CTM layers, set at run-time - integer :: L1_ ! L_+1 = # of CTM layer edges (radii) - integer :: L2_ ! L_+2 = total # of layer edges counting top (TAU=0) +#ifdef CLOUDJ_STANDALONE + integer, parameter :: L_ = 57 ! # of CTM layers, set at build-time + integer, parameter :: L1_ = L_+1 ! L_+1 = # of CTM layer edges (radii) + integer, parameter :: L2_ = L_+2 ! L_+2 = total # of layer edges counting top (TAU=0)# #else - integer, parameter :: L_ = 57 ! # of CTM layers, set at build-time - integer, parameter :: L1_ = L_+1 ! L_+1 = # of CTM layer edges (radii) - integer, parameter :: L2_ = L_+2 ! L_+2 = total # of layer edges counting top (TAU=0) + integer :: L_ ! # of CTM layers, set at run-time + integer :: L1_ ! L_+1 = # of CTM layer edges (radii) + integer :: L2_ ! L_+2 = total # of layer edges counting top (TAU=0) #endif ! # layers that have clouds (LWEPAR < L_) @@ -46,14 +46,14 @@ MODULE CLDJ_CMN_MOD ! JVN_ : max # of J-values #ifdef MODEL_GEOSCHEM integer, parameter :: JVN_ = 166 -#else +#elif CLOUDJ_STANDALONE integer, parameter :: JVN_ = 101 #endif ! mAN_ : max # FJX aerosols in layer (needs NDX for each) #ifdef MODEL_GEOSCHEM integer, parameter :: AN_=37 -#else +#elif CLOUDJ_STANDALONE integer, parameter :: AN_=25 #endif @@ -94,7 +94,7 @@ MODULE CLDJ_CMN_MOD ! X_ = dim = max no. of X-section data sets (input data) #ifdef MODEL_GEOSCHEM integer, parameter :: X_=123 -#else +#elif CLOUDJ_STANDALONE integer, parameter :: X_=72 #endif @@ -102,7 +102,7 @@ MODULE CLDJ_CMN_MOD ! clouds and SSA #ifdef MODEL_GEOSCHEM integer, parameter :: A_=56 -#else +#elif CLOUDJ_STANDALONE integer, parameter :: A_=40 #endif From a3e5a66be3d45e1fbea63bcf2b0d6d6dc7c77290 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 20 Jun 2024 14:34:00 -0400 Subject: [PATCH 2/5] Pass LWEPAR from parent model if not using Cloud-J standalone # levels with cloud is now passed as an argument in Init_Cldj. Signed-off-by: Lizzie Lundgren --- src/Core/cldj_cmn_mod.F90 | 5 ++--- src/Core/cldj_init_mod.F90 | 7 +++++-- src/Interfaces/Standalone/CJ77.F90 | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Core/cldj_cmn_mod.F90 b/src/Core/cldj_cmn_mod.F90 index 26b8708..b6f6726 100644 --- a/src/Core/cldj_cmn_mod.F90 +++ b/src/Core/cldj_cmn_mod.F90 @@ -27,15 +27,14 @@ MODULE CLDJ_CMN_MOD integer, parameter :: L_ = 57 ! # of CTM layers, set at build-time integer, parameter :: L1_ = L_+1 ! L_+1 = # of CTM layer edges (radii) integer, parameter :: L2_ = L_+2 ! L_+2 = total # of layer edges counting top (TAU=0)# + integer, parameter :: LWEPAR = 34 ! # layers that have clouds (LWEPAR < L_) #else integer :: L_ ! # of CTM layers, set at run-time integer :: L1_ ! L_+1 = # of CTM layer edges (radii) integer :: L2_ ! L_+2 = total # of layer edges counting top (TAU=0) + integer :: LWEPAR ! # layers that have clouds (LWEPAR < L_) #endif - ! # layers that have clouds (LWEPAR < L_) - integer, parameter :: LWEPAR = 34 - !------------------------------------------------------------------------------ ! Additional parameters !------------------------------------------------------------------------------ diff --git a/src/Core/cldj_init_mod.F90 b/src/Core/cldj_init_mod.F90 index adc1020..a85f3a7 100644 --- a/src/Core/cldj_init_mod.F90 +++ b/src/Core/cldj_init_mod.F90 @@ -28,13 +28,15 @@ MODULE CLDJ_INIT_MOD CONTAINS !----------------------------------------------------------------------- - subroutine INIT_CLDJ (AMIROOT,DATADIR,NLEVELS,TITLEJXX,NJXU,NJXX) + subroutine INIT_CLDJ (AMIROOT,DATADIR,NLEVELS,NLEVELS_WITH_CLOUD, & + TITLEJXX,NJXU,NJXX) !----------------------------------------------------------------------- implicit none logical, intent(in) :: AMIROOT character(LEN=*), intent(in) :: DATADIR integer, intent(in) :: NLEVELS + integer, intent(in) :: NLEVELS_WITH_CLOUD integer, intent(in) :: NJXU integer, intent(out) :: NJXX character*6, intent(out), dimension(NJXU) :: TITLEJXX @@ -44,11 +46,12 @@ subroutine INIT_CLDJ (AMIROOT,DATADIR,NLEVELS,TITLEJXX,NJXU,NJXX) if (AMIROOT) write(6,*) ' Solar/Cloud-J ver-7.7 initialization' -#if defined ( MODEL_GEOSCHEM ) +#ifndef CLOUDJ_STANDALONE ) ! Set cldj_cmn_mod variables based on input numbers of levels L_ = NLEVELS L1_ = L_ + 1 L2_ = L_ + 2 + LWEPAR= NLEVELS_WITH_CLOUD #endif JVL_ = L_ diff --git a/src/Interfaces/Standalone/CJ77.F90 b/src/Interfaces/Standalone/CJ77.F90 index b6a8c61..f01fc4f 100644 --- a/src/Interfaces/Standalone/CJ77.F90 +++ b/src/Interfaces/Standalone/CJ77.F90 @@ -67,7 +67,7 @@ program standalone amIRoot = .true. !---read in & store all fast-JX data: single call at set up !----------------------------------------------------------------------- - call INIT_CLDJ (amIRoot,'./tables/',NLEVELS,TITLJXX,JVNU,NJXX) + call INIT_CLDJ (amIRoot,'./tables/',NLEVELS,LWEPAR,TITLJXX,JVNU,NJXX) !----------------------------------------------------------------------- !--P, T, Cld & Aersl profiles, simple test input case From 4bad0b7a722f70c01e7314aacf32eec5596ca068 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 20 Jun 2024 16:28:43 -0400 Subject: [PATCH 3/5] Updated changelog Signed-off-by: Lizzie Lundgren --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a07713..8ba3eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ This file documents all notable changes to the Cloud-J repository since the init The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.7.2] - TBD +### Changed +- Changed hard-coding LWEPAR in cldj_cmn_mod to be passed from parent model unless using standalone + +### Added +- Added CLOUDJ_STANDALONE c-proprocessor switch to generalize code to use instead within a parent model + ## [7.7.1] - 2024-04-02 ### Changed - Changed arguments of Init_Cldj to include root thread logical and LUT data directory From d716dddc1173bfbd07cfc3d8e50fae7bd162584e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 8 Jul 2024 18:04:12 -0400 Subject: [PATCH 4/5] Add error trap for neither MODEL_GEOSCHEM or CLOUDJ_STANDALONE Signed-off-by: Lizzie Lundgren --- src/Core/cldj_cmn_mod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Core/cldj_cmn_mod.F90 b/src/Core/cldj_cmn_mod.F90 index b6f6726..5b13337 100644 --- a/src/Core/cldj_cmn_mod.F90 +++ b/src/Core/cldj_cmn_mod.F90 @@ -47,6 +47,8 @@ MODULE CLDJ_CMN_MOD integer, parameter :: JVN_ = 166 #elif CLOUDJ_STANDALONE integer, parameter :: JVN_ = 101 +#else +#error "Invalid model selection: parameters only defined for CLOUDJ_STANDALONE and MODEL_GEOSCHEM. Add parameters for additional models in cldj_cmn_mod.F90." #endif ! mAN_ : max # FJX aerosols in layer (needs NDX for each) From d7617d995d649f7bb92ce4631d4ddb7c25d35f6d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 8 Jul 2024 18:04:26 -0400 Subject: [PATCH 5/5] Minor no-diff fixes Signed-off-by: Lizzie Lundgren --- src/Core/cldj_cmn_mod.F90 | 2 +- src/Core/cldj_init_mod.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/cldj_cmn_mod.F90 b/src/Core/cldj_cmn_mod.F90 index 5b13337..8755324 100644 --- a/src/Core/cldj_cmn_mod.F90 +++ b/src/Core/cldj_cmn_mod.F90 @@ -51,7 +51,7 @@ MODULE CLDJ_CMN_MOD #error "Invalid model selection: parameters only defined for CLOUDJ_STANDALONE and MODEL_GEOSCHEM. Add parameters for additional models in cldj_cmn_mod.F90." #endif - ! mAN_ : max # FJX aerosols in layer (needs NDX for each) + ! AN_ : max # FJX aerosols in layer (needs NDX for each) #ifdef MODEL_GEOSCHEM integer, parameter :: AN_=37 #elif CLOUDJ_STANDALONE diff --git a/src/Core/cldj_init_mod.F90 b/src/Core/cldj_init_mod.F90 index a85f3a7..c639fdc 100644 --- a/src/Core/cldj_init_mod.F90 +++ b/src/Core/cldj_init_mod.F90 @@ -46,7 +46,7 @@ subroutine INIT_CLDJ (AMIROOT,DATADIR,NLEVELS,NLEVELS_WITH_CLOUD, & if (AMIROOT) write(6,*) ' Solar/Cloud-J ver-7.7 initialization' -#ifndef CLOUDJ_STANDALONE ) +#ifndef CLOUDJ_STANDALONE ! Set cldj_cmn_mod variables based on input numbers of levels L_ = NLEVELS L1_ = L_ + 1