Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8bac008
Initial file (placeholders) for SU Volcanic Emissions
lholland-noaa Oct 15, 2024
84717da
Adding datetime utility
lholland-noaa Oct 18, 2024
caa0aee
modifications to comments
lholland-noaa Oct 18, 2024
5d2889e
Initial files to begin SU Volcanic Emissions
lholland-noaa Oct 22, 2024
98c33cc
Reorg of prepmetvars, initial reader placeholder
lholland-noaa Nov 5, 2024
7b349af
Added example volcanic file and updated code
lholland-noaa Nov 7, 2024
c17d3b8
Volcanic updates
lholland-noaa Nov 18, 2024
8ac6871
more updates
lholland-noaa Nov 18, 2024
55074ca
Updating emission reader
lholland-noaa Nov 21, 2024
b8c18b5
Updating module
lholland-noaa Nov 21, 2024
292343d
Merge branch 'feature/gocart_suv' of https://github.com/lholland-noaa…
lholland-noaa Nov 21, 2024
ec8eee4
added notes in comments
lholland-noaa Nov 22, 2024
f94fa2a
Updating cmake file to incl SUVolcanic
lholland-noaa Dec 20, 2024
2f4494e
compiles on hera, committing
lholland-noaa Jan 16, 2025
7d866fd
Creating directory and initial source files
lholland-noaa Jan 17, 2025
06675af
Adding CMakeLists
lholland-noaa Jan 17, 2025
fb4de14
Adding DMS to core
lholland-noaa Jan 21, 2025
fa1780e
compiles - still need to create test
lholland-noaa Jan 21, 2025
12218b0
constructing test_dms
lholland-noaa Jan 21, 2025
056431b
updating
lholland-noaa Jan 21, 2025
d2045b4
This version with test_dms compiles
lholland-noaa Jan 22, 2025
288bbd0
removing un-used datetime.F90
lholland-noaa Jan 22, 2025
0527d9a
updating
lholland-noaa Jan 22, 2025
295332e
removing unnecessary section
lholland-noaa Jan 22, 2025
9426066
removing unnecessary items
lholland-noaa Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" AND CMAKE_BUILD_TYPE MATCHES "D
6379,10448)
endif()

add_subdirectory(util)
add_subdirectory(src)
add_subdirectory(tests)
2 changes: 2 additions & 0 deletions src/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ target_link_libraries(${_lib} PUBLIC CATChem_process_dust)
target_link_libraries(${_lib} PUBLIC CATChem_process_seasalt)
target_link_libraries(${_lib} PUBLIC CATChem_process_plumerise)
target_link_libraries(${_lib} PUBLIC CATChem_process_drydep)
target_link_libraries(${_lib} PUBLIC CATChem_process_suvolcanic)
target_link_libraries(${_lib} PUBLIC CATChem_process_DMS)
set_target_properties(${_lib} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
target_compile_options(${_lib} PRIVATE ${_catchem_compiler_options})
10 changes: 10 additions & 0 deletions src/api/catchem.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ module CATChem
use CCPr_DryDep_mod, only: cc_drydep_init => CCPr_DryDep_Init !< DryDep Process Initialization Routine
use CCPr_DryDep_mod, only: cc_drydep_run => CCPr_DryDep_Run !< DryDep Process Run Routine
use CCPr_DryDep_mod, only: cc_drydep_finalize => CCPr_DryDep_Finalize !< DryDep Process Finalization Routine
! SUVolcanicEmissions
use CCPr_SUVolcanicEmissions_mod, only: SUVolcanicEmissionsStateType !< SUVolcanicEmissions State
use CCPr_SUVolcanicEmissions_mod, only: cc_suvolcanic_init => CCPr_SUVolcanicEmissions_Init !< SUVolcanicEmissions Process Initialization Routine
use CCPr_SUVolcanicEmissions_mod, only: cc_suvolcanic_run => CCPr_SUVolcanicEmissions_Run !< SUVolcanicEmissions Process Run Routine
use CCPr_SUVolcanicEmissions_mod, only: cc_suvolcanic_finalize => CCPr_SUVolcanicEmissions_Finalize !< SUVolcanicEmissions Process Finalization Routine
! DMS
use CCPr_DMS_mod, only: DMSStateType !< DMS State
use CCPr_DMS_mod, only: cc_dms_init => CCPr_DMS_Init !< DMS Process Initialization Routine
use CCPr_DMS_mod, only: cc_dms_run => CCPr_DMS_Run !< DMS Process Run Routine
use CCPr_DMS_mod, only: cc_dms_finalize => CCPr_DMS_Finalize !< DMS Process Finalization Routine

implicit none

Expand Down
23 changes: 22 additions & 1 deletion src/core/chemstate_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ module ChemState_Mod
!! \param nSpeciesGas: The number of gas species.
!! \param nSpeciesAero: The number of aerosol species.
!! \param nSpeciesDust: The number of dust species.
!! \param nSpeicesSeaSalt: The number of sea salt species.
!! \param nSpeciesSeaSalt: The number of sea salt species.
!! \param SpeciesIndex: An array containing the total species index.
!! \param AeroIndex: An array containing the aerosol species index.
!! \param GasIndex: An array containing the gas species index.
!! \param DustIndex: An array containing the dust species index.
!! \param DryDepIndex: An array containing the dry deposition species index.
!! \param SeaSaltIndex: An array containing the sea salt species index.
!! \param SUVolcanicIndex: An array containing the Sulfur volcanic species index.
!! \param chemSpecies: A 2-D array containing the concentration of each species.
!!
!! \ingroup core_modules
Expand All @@ -66,13 +68,15 @@ module ChemState_Mod
INTEGER :: nSpeciesTracer !< Number of Tracer Species
INTEGER :: nSpeciesDust !< Number of Dust Species
INTEGER :: nSpeciesSeaSalt !< Number of SeaSalt Species
INTEGER :: nSpeciesSUVolcanic !< Number of Volcanic Sulfur Species
INTEGER, ALLOCATABLE :: SpeciesIndex(:) !< Total Species Index
INTEGER, ALLOCATABLE :: TracerIndex(:) !< Tracer Species Index
INTEGER, ALLOCATABLE :: AeroIndex(:) !< Aerosol Species Index
INTEGER, ALLOCATABLE :: GasIndex(:) !< Gas Species Index
INTEGER, ALLOCATABLE :: DustIndex(:) !< Dust Species Index
INTEGER, ALLOCATABLE :: SeaSaltIndex(:) !< SeaSalt Species Index
INTEGER, ALLOCATABLE :: DryDepIndex(:) !< SeaSalt Species Index
INTEGER, ALLOCATABLE :: SUVolcanicIndex(:) !< Volcanic sulfur Species Index
CHARACTER(len=50), ALLOCATABLE :: SpeciesNames(:) !< Species Names

!---------------------------------------------------------------------
Expand Down Expand Up @@ -183,6 +187,7 @@ subroutine Find_Number_of_Species(ChemState, RC)
ChemState%nSpeciesGas = 0
ChemState%nSpeciesSeaSalt = 0
ChemState%nSpeciesTracer = 0
ChemState%nSpeciesSUVolcanic = 0

! Count number of species
do i = 1, ChemState%nSpecies
Expand All @@ -204,6 +209,9 @@ subroutine Find_Number_of_Species(ChemState, RC)
if (ChemState%ChemSpecies(i)%is_drydep .eqv. .true.) then
ChemState%nSpeciesAeroDryDep = ChemState%nSpeciesAeroDryDep + 1
endif
if (ChemState%ChemSpecies(i)%is_suvolcanic .eqv. .true.) then
ChemState%nSpeciesSUVolcanic = ChemState%nSpeciesSUVolcanic + 1
endif
enddo

end subroutine Find_Number_of_Species
Expand Down Expand Up @@ -238,6 +246,7 @@ subroutine Find_Index_of_Species(ChemState, RC)
integer :: seasalt_index ! Current Seas Salt Index
integer :: tracer_index ! Current Tracer Index
integer :: drydep_index ! Current DryDep Index
integer :: suvolcanic_index ! Current SUVolcanic Index


! Initialize
Expand All @@ -253,6 +262,7 @@ subroutine Find_Index_of_Species(ChemState, RC)
seasalt_index = 1
tracer_index = 1
drydep_index = 1
suvolcanic_index = 1

! Allocate index arrays
ALLOCATE(Chemstate%AeroIndex(ChemState%nSpeciesAero), STAT=RC)
Expand Down Expand Up @@ -297,6 +307,13 @@ subroutine Find_Index_of_Species(ChemState, RC)
RETURN
ENDIF

ALLOCATE(Chemstate%SUVolcanicIndex(ChemState%nSpeciesSUVolcanic), STAT=RC)
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error allocating Chemstate%SUVolcanicIndex'
call CC_Error(errMsg, RC, thisLoc)
RETURN
ENDIF

! Find indices for species groups
do n = 1, ChemState%nSpecies
if (ChemState%ChemSpecies(n)%is_aerosol .eqv. .true.) then
Expand All @@ -323,6 +340,10 @@ subroutine Find_Index_of_Species(ChemState, RC)
Chemstate%DryDepIndex(drydep_index) = n
drydep_index = drydep_index + 1
endif
if (ChemState%ChemSpecies(n)%is_suvolcanic .eqv. .true.) then
Chemstate%SUVolcanicIndex(suvolcanic_index) = n
suvolcanic_index = suvolcanic_index + 1
endif
enddo

end subroutine Find_index_of_Species
Expand Down
196 changes: 194 additions & 2 deletions src/core/config_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,24 @@ SUBROUTINE Read_Input_File( Config , GridState, EmisState, ChemState, RC, Config
RETURN
ENDIF

call Config_Process_DMS(ConfigInput, Config, RC)
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error in "Config_Process_DMS"!'
CALL CC_Error( errMsg, RC, thisLoc )
CALL QFYAML_CleanUp( ConfigInput )
CALL QFYAML_CleanUp( ConfigAnchored )
RETURN
ENDIF

call Config_Process_SUVolcanicEmissions(ConfigInput, Config, RC)
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error in "Config_Process_SUVolcanicEmissions"!'
CALL CC_Error( errMsg, RC, thisLoc )
CALL QFYAML_CleanUp( ConfigInput )
CALL QFYAML_CleanUp( ConfigAnchored )
RETURN
ENDIF


!========================================================================
! Config ChemState
Expand Down Expand Up @@ -236,7 +254,7 @@ SUBROUTINE Config_Chem_State( filename, GridState, ChemState, RC )
real :: v_real
logical :: v_logical

Character(len=17) :: tags(17)
Character(len=17) :: tags(19)

RC = CC_SUCCESS

Expand All @@ -255,6 +273,8 @@ SUBROUTINE Config_Chem_State( filename, GridState, ChemState, RC )
'is_gas ', &
'is_advected ', &
'is_photolysis ', &
'is_suvolcanic ', &
'is_dms ', &
'mw_g ', &
'viscosity ', &
'density ', &
Expand Down Expand Up @@ -403,6 +423,26 @@ SUBROUTINE Config_Chem_State( filename, GridState, ChemState, RC )
ChemState%ChemSpecies(n)%is_drydep = v_logical
write(*,*) '| is_drydep: ', ChemState%ChemSpecies(n)%is_drydep

key = TRIM(ChemState%SpeciesNames(n)) // '%' // 'is_suvolcanic'
v_logical = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM(key), v_logical, "", RC )
IF (RC /= CC_SUCCESS) then
! assume that if is_suvolcanic isn't in the species.yaml file assume false
ChemState%ChemSpecies(n)%is_suvolcanic = MISSING_BOOL
ENDIF
ChemState%ChemSpecies(n)%is_suvolcanic = v_logical
write(*,*) '| is_suvolcanic: ', ChemState%ChemSpecies(n)%is_suvolcanic

key = TRIM(ChemState%SpeciesNames(n)) // '%' // 'is_dms'
v_logical = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM(key), v_logical, "", RC )
IF (RC /= CC_SUCCESS) then
! assume that if is_dms isn't in the species.yaml file assume false
ChemState%ChemSpecies(n)%is_dms = MISSING_BOOL
ENDIF
ChemState%ChemSpecies(n)%is_dms = v_logical
write(*,*) '| is_dms: ', ChemState%ChemSpecies(n)%is_dms

key = TRIM(ChemState%SpeciesNames(n)) // '%' // 'is_photolysis'
v_logical = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM(key), v_logical, "", RC )
Expand Down Expand Up @@ -569,6 +609,8 @@ SUBROUTINE Config_Chem_State( filename, GridState, ChemState, RC )
write(*,*) '| number of tracers: ', ChemState%nSpeciesTracer
write(*,*) '| number of dust: ', ChemState%nSpeciesDust
write(*,*) '| number of seasalt: ', ChemState%nSpeciesSeaSalt
write(*,*) '| number of volcanic: ', ChemState%nSpeciesSUVolcanic

write(*,*) '========================================================='

END SUBROUTINE Config_Chem_State
Expand Down Expand Up @@ -1179,7 +1221,7 @@ SUBROUTINE Config_Process_SeaSalt( ConfigInput, Config, RC )
RC = CC_SUCCESS
thisLoc = ' -> at Config_Process_SeaSalt (in CATChem/src/core/config_mod.F90)'
errMsg = ''

key = "process%seasalt%activate"
v_bool = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM( key ), v_bool, "", RC )
Expand Down Expand Up @@ -1373,4 +1415,154 @@ SUBROUTINE Config_Process_DryDep( ConfigInput, Config, RC )
END SUBROUTINE Config_Process_DryDep


!> \brief Process SUVolcanicEmissions configuration
!!
!! This function processes the SUVolcanic configuration and performs the necessary actions based on the configuration.
!!
!! \param[in] ConfigInput The YAML configuration object
!! \param[inout] Config The configuration object
!! \param[out] RC The return code
!!
!! \ingroup core_modules
!!!>
SUBROUTINE Config_Process_SUVolcanicEmissions( ConfigInput, Config, RC )
USE CharPak_Mod, ONLY : StrSplit
USE Error_Mod
USE Config_Opt_Mod, ONLY : ConfigType

TYPE(QFYAML_t), INTENT(INOUT) :: ConfigInput ! YAML Config object
TYPE(ConfigType), INTENT(INOUT) :: Config ! Input options

!
! !OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure

! !LOCAL VARIABLES:
!
! Scalars
LOGICAL :: v_bool
INTEGER :: v_int

! Strings
CHARACTER(LEN=255) :: thisLoc
CHARACTER(LEN=512) :: errMsg
CHARACTER(LEN=QFYAML_StrLen) :: key

!========================================================================
! Config_Process_SUVolcanicEmissions begins here!
!========================================================================

! Initialize
RC = CC_SUCCESS
thisLoc = ' -> at Config_Process_SUVolcanicEmissions (in CATChem/src/core/config_mod.F90)'
errMsg = ''

! TODO #105 Fix reading of config file
key = "process%SUVolcanicEmissions%activate"
v_bool = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM( key ), v_bool, "", RC )
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error parsing ' // TRIM( key ) // '!'
CALL CC_Error( errMsg, RC, thisLoc )
RETURN
ENDIF
Config%drydep_activate = v_bool


key = "process%SUVolcanicEmissions%scheme_opt"
v_int = MISSING_INT
CALL QFYAML_Add_Get( ConfigInput, TRIM( key ), v_int, "", RC )
IF ( RC /= CC_SUCCESS ) THEN
errMsg = TRIM( key ) // 'Not Found, Setting Default to 1'
v_int = 1 ! default is one
RETURN
ENDIF
Config%SUVolcanicEmissions_scheme = v_int


write(*,*) "SUVolcanicEmissions Configuration"
write(*,*) '------------------------------------'
write(*,*) 'Config%SUVolcanicEmissions_activate = ', Config%SUVolcanicEmissions_activate
write(*,*) 'Config%SUVolcanicEmissions_scheme = ', Config%SUVolcanicEmissions_scheme
write(*,*) '------------------------------------'

END SUBROUTINE Config_Process_SUVolcanicEmissions


!> \brief Process DMS configuration
!!
!! This function processes the DMS configuration and performs the necessary actions based on the configuration.
!!
!! \param[in] ConfigInput The YAML configuration object
!! \param[inout] Config The configuration object
!! \param[out] RC The return code
!!
!! \ingroup core_modules
!!!>
SUBROUTINE Config_Process_DMS( ConfigInput, Config, RC )
USE CharPak_Mod, ONLY : StrSplit
USE Error_Mod
USE Config_Opt_Mod, ONLY : ConfigType

TYPE(QFYAML_t), INTENT(INOUT) :: ConfigInput ! YAML Config object
TYPE(ConfigType), INTENT(INOUT) :: Config ! Input options

!
! !OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure

! !LOCAL VARIABLES:
!
! Scalars
LOGICAL :: v_bool
INTEGER :: v_int

! Strings
CHARACTER(LEN=255) :: thisLoc
CHARACTER(LEN=512) :: errMsg
CHARACTER(LEN=QFYAML_StrLen) :: key

!========================================================================
! Config_Process_DMS begins here!
!========================================================================

! Initialize
RC = CC_SUCCESS
thisLoc = ' -> at Config_Process_DMS (in CATChem/src/core/config_mod.F90)'
errMsg = ''

! TODO #105 Fix reading of config file
key = "process%DMS%activate"
v_bool = MISSING_BOOL
CALL QFYAML_Add_Get( ConfigInput, TRIM( key ), v_bool, "", RC )
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error parsing ' // TRIM( key ) // '!'
CALL CC_Error( errMsg, RC, thisLoc )
RETURN
ENDIF
Config%DMS_activate = v_bool


key = "process%DMS%scheme_opt"
v_int = MISSING_INT
CALL QFYAML_Add_Get( ConfigInput, TRIM( key ), v_int, "", RC )
IF ( RC /= CC_SUCCESS ) THEN
errMsg = TRIM( key ) // 'Not Found, Setting Default to 1'
v_int = 1 ! default is one
RETURN
ENDIF
Config%DMS_scheme = v_int

write(*,*) "DMS Configuration"
write(*,*) '------------------------------------'
write(*,*) 'Config%DMS_activate = ', Config%DMS_activate
write(*,*) 'Config%DMS_scheme = ', Config%DMS_scheme
write(*,*) '------------------------------------'


END SUBROUTINE Config_Process_DMS


END MODULE config_mod
Loading