Skip to content

Commit

Permalink
Merge pull request #17 from geoschem/feature/set_levels_with_cloud_fr…
Browse files Browse the repository at this point in the history
…om_parent_model

Set levels with cloud from parent model
  • Loading branch information
lizziel authored Jul 9, 2024
2 parents 8a3b925 + d7617d9 commit 2d75997
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 16 additions & 15 deletions src/Core/cldj_cmn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ 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)#
integer, parameter :: LWEPAR = 34 ! # layers that have clouds (LWEPAR < L_)
#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)
integer :: LWEPAR ! # layers that have clouds (LWEPAR < L_)
#endif

! # layers that have clouds (LWEPAR < L_)
integer, parameter :: LWEPAR = 34

!------------------------------------------------------------------------------
! Additional parameters
!------------------------------------------------------------------------------
Expand All @@ -46,14 +45,16 @@ MODULE CLDJ_CMN_MOD
! JVN_ : max # of J-values
#ifdef MODEL_GEOSCHEM
integer, parameter :: JVN_ = 166
#else
#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)
! AN_ : 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

Expand Down Expand Up @@ -94,15 +95,15 @@ 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

! A_ = dim = max no. of Aerosol Mie sets (input data) not including
! clouds and SSA
#ifdef MODEL_GEOSCHEM
integer, parameter :: A_=56
#else
#elif CLOUDJ_STANDALONE
integer, parameter :: A_=40
#endif

Expand Down
7 changes: 5 additions & 2 deletions src/Core/cldj_init_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/Standalone/CJ77.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d75997

Please sign in to comment.