Skip to content
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
220487c
add megan modules
lwcugb Jul 31, 2024
fab3b42
updated Megan modules
lwcugb Jul 31, 2024
ed9c494
updates Megan modules
lwcugb Jul 31, 2024
344afb7
Merge branch 'bbakernoaa:feature/catchem_begins' into feature/catchem…
lwcugb Aug 1, 2024
90160eb
update Megan modules with EmisState
lwcugb Aug 1, 2024
05dc57e
Updates Megan modules
lwcugb Aug 1, 2024
c08aebf
Add Megan process test with bug fix
lwcugb Nov 15, 2024
052211a
change process name to bvoc
lwcugb Nov 26, 2024
caea32e
Merge branch 'feature/catchem_begins' of https://github.com/lwcugb/CA…
lwcugb Dec 16, 2024
afcbfc4
update bvoc megan2 process
lwcugb Dec 16, 2024
b31acf1
Merge branch 'develop' into feature/catchem_begins
bbakernoaa Dec 20, 2024
b7a7376
add historical effects and solve compiler warnings
lwcugb Jan 22, 2025
1bda156
Merge remote-tracking branch 'ufs/develop' into wei-begins
zmoon Jan 22, 2025
521ee44
remove some unused variables
lwcugb Jan 22, 2025
f9e7037
change test program name
lwcugb Jan 22, 2025
f6b4258
Merge branch 'develop' into feature/catchem_begins
bbakernoaa Jan 27, 2025
435dc0b
fix config bug and format
lwcugb Jan 30, 2025
82e7f4f
Merge branch 'feature/catchem_begins' of https://github.com/lwcugb/CA…
lwcugb Jan 30, 2025
e440c0c
calculate EF online for seven species
lwcugb Jan 30, 2025
6b52ab6
update default confiduration
lwcugb Feb 13, 2025
ae67395
add wesely dry dep scheme
lwcugb Feb 17, 2025
4b2fc6a
clean up
lwcugb Feb 17, 2025
1f1ffee
clean up and bug fix
lwcugb Feb 17, 2025
3ec90a3
add to do list
lwcugb Feb 18, 2025
cf07808
add more land use mapping and a function to determine sea salt bin fr…
lwcugb Feb 25, 2025
f9023f2
split to gas and aerosol scheme options
lwcugb Feb 26, 2025
e9fe25c
clean up
lwcugb Feb 28, 2025
c533311
fix typos and update references
lwcugb Feb 28, 2025
9a05046
tidy up
lwcugb Mar 6, 2025
0f5bb6e
Merge remote-tracking branch 'origin/feature/catchem_begins' into fea…
lwcugb Mar 6, 2025
8fb6042
replace some pointers
lwcugb Mar 21, 2025
173f5f6
add initializations
lwcugb Mar 21, 2025
73c3b12
Merge remote-tracking branch 'ufs/develop' into feature/catchem_begins
lwcugb Apr 3, 2025
6836cfd
add cmake flag to ci.yaml for yaml-cpp bug
lwcugb Apr 3, 2025
e75eac9
Merge branch 'feature/catchem_begins' into feature/wesely
lwcugb Apr 3, 2025
9bfa143
adress comments
lwcugb Jun 9, 2025
75e2bff
adress github building error
lwcugb Jun 9, 2025
aa0d419
Merge branch 'feature/catchem_begins' into feature/wesely
lwcugb Jun 9, 2025
be86fda
change file name
lwcugb Jun 9, 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
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[codespell]
ignore-words-list = inout,iland
ignore-words-list = inout,iland,thik
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Build
run: |
cmake -B $BUILD_DIR
cmake -B $BUILD_DIR -DCMAKE_POLICY_VERSION_MINIMUM=3.5
cmake --build $BUILD_DIR
env:
FC: ${{ matrix.compiler }}
Expand Down
1 change: 1 addition & 0 deletions src/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +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_bvoc)
target_link_libraries(${_lib} PUBLIC CATChem_process_chem)
set_target_properties(
${_lib}
Expand Down
7 changes: 7 additions & 0 deletions src/api/catchem.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ module CATChem
! Chemical mechanism solver
use CCPr_Chem_mod, only: cc_get_micm_version => get_micm_version

! BVOC emissions
use CCPr_Bvoc_Common_Mod, only: BvocStateType !< BVOC State
use CCPr_Bvoc_mod, only: cc_bvoc_init => CCPr_Bvoc_Init !< BVOC Process Initialization Routine
use CCPr_Bvoc_mod, only: cc_bvoc_run => CCPr_Bvoc_Run !< BVOC Process Run Routine
use CCPr_Bvoc_mod, only: cc_bvoc_finalize => CCPr_Bvoc_Final !< BVOC Process Finalization Routine


implicit none

public
Expand Down
126 changes: 123 additions & 3 deletions src/core/chemstate_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module ChemState_Mod
PUBLIC :: Chem_Allocate
PUBLIC :: Find_Number_of_Species
PUBLIC :: Find_Index_of_Species
PUBLIC :: Find_SeaSalt_Bin
PUBLIC :: FindSpecByName
PUBLIC :: GetSpecConc
PUBLIC :: GetSpecConcByName
Expand Down Expand Up @@ -63,16 +64,21 @@ module ChemState_Mod
INTEGER :: nSpeciesGas !< Number of Gas Species
INTEGER :: nSpeciesAero !< Number of Aerosol Species
INTEGER :: nSpeciesAeroDryDep !< Number of Aerosol Species for Dry Dep
INTEGER :: nSpeciesDryDep !< Number of all Species for Dry Dep
INTEGER :: nSpeciesTracer !< Number of Tracer Species
INTEGER :: nSpeciesDust !< Number of Dust Species
INTEGER :: nSpeciesSeaSalt !< Number of SeaSalt Species
INTEGER :: nSpeciesBin !< Number of SeaSalt Species Bin
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
real(fp),ALLOCATABLE :: SeaSaltBinLower(:) !< SeaSalt Species Bin Lower edge
real(fp),ALLOCATABLE :: SeaSaltBinUpper(:) !< SeaSalt Species Bin upper edge
INTEGER, ALLOCATABLE :: AeroDryDepIndex(:) !< Aerosol DryDep Species Index for Dry Dep
INTEGER, ALLOCATABLE :: DryDepIndex(:) !< All DryDep Species Index
CHARACTER(len=50), ALLOCATABLE :: SpeciesNames(:) !< Species Names

!---------------------------------------------------------------------
Expand Down Expand Up @@ -179,6 +185,7 @@ subroutine Find_Number_of_Species(ChemState, RC)
! Initialize to zero before counting species
ChemState%nSpeciesAero = 0
ChemState%nSpeciesAeroDryDep = 0
ChemState%nSpeciesDryDep = 0
ChemState%nSpeciesDust = 0
ChemState%nSpeciesGas = 0
ChemState%nSpeciesSeaSalt = 0
Expand All @@ -201,9 +208,13 @@ subroutine Find_Number_of_Species(ChemState, RC)
if (ChemState%ChemSpecies(i)%is_tracer .eqv. .true.) then
ChemState%nSpeciesTracer = ChemState%nSpeciesTracer + 1
endif
if (ChemState%ChemSpecies(i)%is_drydep .eqv. .true.) then
if ( (ChemState%ChemSpecies(i)%is_drydep .eqv. .true.) .and. &
(ChemState%ChemSpecies(i)%is_aerosol .eqv. .true.) ) then
ChemState%nSpeciesAeroDryDep = ChemState%nSpeciesAeroDryDep + 1
endif
if (ChemState%ChemSpecies(i)%is_drydep .eqv. .true.) then
ChemState%nSpeciesDryDep = ChemState%nSpeciesDryDep + 1
endif
enddo

end subroutine Find_Number_of_Species
Expand Down Expand Up @@ -237,6 +248,7 @@ subroutine Find_Index_of_Species(ChemState, RC)
integer :: dust_index ! Current Dust Index
integer :: seasalt_index ! Current Seas Salt Index
integer :: tracer_index ! Current Tracer Index
integer :: aero_drydep_index ! Current Aerosol DryDep Index
integer :: drydep_index ! Current DryDep Index


Expand All @@ -252,6 +264,7 @@ subroutine Find_Index_of_Species(ChemState, RC)
dust_index = 1
seasalt_index = 1
tracer_index = 1
aero_drydep_index = 1
drydep_index = 1

! Allocate index arrays
Expand Down Expand Up @@ -290,7 +303,14 @@ subroutine Find_Index_of_Species(ChemState, RC)
RETURN
ENDIF

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

ALLOCATE(Chemstate%DryDepIndex(ChemState%nSpeciesDryDep), STAT=RC)
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error allocating Chemstate%DryDepIndex'
call CC_Error(errMsg, RC, thisLoc)
Expand Down Expand Up @@ -319,6 +339,11 @@ subroutine Find_Index_of_Species(ChemState, RC)
Chemstate%TracerIndex(tracer_index) = n
tracer_index = tracer_index + 1
endif
if ( (ChemState%ChemSpecies(n)%is_drydep .eqv. .true.) .and. &
(ChemState%ChemSpecies(n)%is_aerosol .eqv. .true.) ) then
Chemstate%AeroDryDepIndex(aero_drydep_index) = n
aero_drydep_index = aero_drydep_index + 1
endif
if (ChemState%ChemSpecies(n)%is_drydep .eqv. .true.) then
Chemstate%DryDepIndex(drydep_index) = n
drydep_index = drydep_index + 1
Expand All @@ -327,6 +352,101 @@ subroutine Find_Index_of_Species(ChemState, RC)

end subroutine Find_index_of_Species

!> \brief Find the bins of sea salt species
!!
!! \param ChemState The ChemState object
!! \param RC The return code
!!
!! \ingroup core_modules
!!!>
subroutine Find_SeaSalt_Bin(ChemState, RC)
! USES
!USE Species_Mod, ONLY : SpeciesType

IMPLICIT NONE

! INOUT Params
type(ChemStateType), INTENT(INOUT) :: ChemState ! chem State object
! OUTPUT Params
INTEGER, INTENT(OUT) :: RC ! Success or failure

! Error handling
CHARACTER(LEN=255) :: ErrMsg
CHARACTER(LEN=255) :: thisLoc

! Local variables
integer :: n ! looping variable
integer :: n_bin ! number of sea salt bins
!real(fp) :: radius0 ! initial radius of sea salt bin
real(fp) :: lower_radius(10) ! lower radius of sea salt bin holder
real(fp) :: upper_radius(10) ! upper radius of sea salt bin holder
logical :: mask(10) = .FALSE. ! flag to for sorting bins by radius

! Initialize
RC = CC_SUCCESS
ErrMsg = ''
thisLoc = ' -> at Find_SeaSalt_Bin (in core/chemstate_mod.F90)'


! Initialize to zero before counting species
n_bin = 0
!radius0 = 0.0_fp

! Find possible sea salt bins
do n = 1, ChemState%nSpeciesSeaSalt
if (n == 1) then
n_bin = 1
lower_radius(n_bin) = ChemState%ChemSpecies(Chemstate%SeaSaltIndex(n))%lower_radius
upper_radius(n_bin) = ChemState%ChemSpecies(Chemstate%SeaSaltIndex(n))%upper_radius
else
if ( ALL( ABS(lower_radius(1:n_bin) - ChemState%ChemSpecies(Chemstate%SeaSaltIndex(n))%lower_radius) > 0.0_fp )) then
n_bin = n_bin + 1
lower_radius(n_bin) = ChemState%ChemSpecies(Chemstate%SeaSaltIndex(n))%lower_radius
upper_radius(n_bin) = ChemState%ChemSpecies(Chemstate%SeaSaltIndex(n))%upper_radius
endif
endif
enddo

! Allocate index arrays
ALLOCATE(Chemstate%SeaSaltBinLower(n_bin), STAT=RC)
IF ( RC /= CC_SUCCESS ) THEN
errMsg = 'Error allocating Chemstate%SeaSaltBinLower'
call CC_Error(errMsg, RC, thisLoc)
RETURN
ENDIF

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

!sort bins by radius from low to high for lower_radius
mask(1:n_bin) = .TRUE.
do n = 1, n_bin
Chemstate%SeaSaltBinLower(n) = MINVAL(lower_radius,mask)
mask(MINLOC(lower_radius,mask)) = .FALSE.
enddo

!sort bins by radius from low to high for upper_radius
mask(1:n_bin) = .TRUE.
do n = 1, n_bin
Chemstate%SeaSaltBinUpper(n) = MINVAL(upper_radius,mask)
mask(MINLOC(upper_radius,mask)) = .FALSE.
enddo

!check if the bins are continuous
do n = 1, n_bin-1
if ( .not. rae(Chemstate%SeaSaltBinUpper(n), Chemstate%SeaSaltBinLower(n+1)) ) then
errMsg = 'Sea Salt Bins are not continuous'
call CC_Error(errMsg, RC, thisLoc)
RETURN
endif
enddo

end subroutine Find_SeaSalt_Bin

!> \brief Find the species by name
!!
!! \param ChemState The ChemState object
Expand Down
Loading