Skip to content

feat: Add standalone driver for offline simulation#169

Open
lwcugb wants to merge 193 commits into
ufs-community:developfrom
lwcugb:feature/standalone
Open

feat: Add standalone driver for offline simulation#169
lwcugb wants to merge 193 commits into
ufs-community:developfrom
lwcugb:feature/standalone

Conversation

@lwcugb

@lwcugb lwcugb commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

This is to add a CATChem app and driver to the standalone folder so that it can run offline, driven by reanalysis meteorological fields.

MET fields are still read in through the emission module together with other input files. Additional configuration files were also created in the default folder. An initial test driven by MERRA2 and GFS was working fine.

@lwcugb lwcugb changed the title Add standalone driver for offline simulation feat: Add standalone driver for offline simulation Jul 20, 2026
@lwcugb lwcugb added the enhancement New feature or request label Jul 20, 2026

@benkozi benkozi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very useful feature for research and testing CATChem.

@@ -62,6 +62,11 @@
elif in_type and 'end type' in line.lower():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lwcugb - Would you like this in main for WM integration? If not, we may want to merge to develop after in case changes are required during the WM PR review.

Comment on lines +302 to +304
call ESMF_LogWrite(trim(pName)//': could not derive DELP (surface pressure '// &
'PS may be unavailable); kg/m2/s emission unit conversion may be invalid', &
ESMF_LOGMSG_WARNING, rc=localrc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this is not an error?

Comment on lines +351 to +353
if (.not. associated(config_manager)) return
if (.not. config_manager%config_data%emission_mapping%is_loaded) return
if (icat < 1 .or. icat > config_manager%config_data%emission_mapping%n_categories) return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the early returns? MPI-related?

if (.not. config_manager%config_data%emission_mapping%is_loaded) return
if (icat < 1 .or. icat > config_manager%config_data%emission_mapping%n_categories) return

associate (cat => config_manager%config_data%emission_mapping%categories(icat))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my benefit, why is the introspection necessary as opposed to an explicit met field mapping? Seems a little brittle

end subroutine catchem_emis_vinterp_field

!> \brief Lowercase an in-place string (ASCII)
subroutine to_lower_str(s)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be used in tandem with some string comparisons (time', Time`)


type(StateManagerType), pointer :: state_mgr
type(ConfigManagerType), pointer :: config_mgr
character(len=64) :: tgt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use string len constant here

type(ESMF_VM) :: vm
type(ESMF_GridComp) :: driver
integer :: localPet
character(len=512) :: driver_cfg_file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String constant

character(len=*), parameter :: u_FILE_u = __FILE__

!> Path to the driver ESMF configure file (set by the main application)
character(len=512), save :: g_driver_cfg_file = "catchem_standalone.configure"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String constant police (last time)

line=__LINE__, file=__FILE__, rcToReturn=rc)
return
end select
if (rc /= ESMF_SUCCESS) return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log? Error?

Comment thread tests/test_MetState.f90
@@ -170,11 +170,22 @@ program test_MetState

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of new code with no automated testing. What would you recommend? Manual testing is challenging if we need to make changes in the future


in_type = False
fields = [] # List of (name, type_name, rank, dims, is_edge)
for line in lines:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to add documentation on how to run standalone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants