feat: Add standalone driver for offline simulation#169
Conversation
…a/CATChem into feature/cc_restructure
…a/CATChem into feature/cc_restructure
…o feature/gcafs
benkozi
left a comment
There was a problem hiding this comment.
A very useful feature for research and testing CATChem.
| @@ -62,6 +62,11 @@ | |||
| elif in_type and 'end type' in line.lower(): | |||
There was a problem hiding this comment.
@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.
| 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) |
There was a problem hiding this comment.
Curious why this is not an error?
| 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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Could use string len constant here
| type(ESMF_VM) :: vm | ||
| type(ESMF_GridComp) :: driver | ||
| integer :: localPet | ||
| character(len=512) :: driver_cfg_file |
| 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" |
There was a problem hiding this comment.
String constant police (last time)
| line=__LINE__, file=__FILE__, rcToReturn=rc) | ||
| return | ||
| end select | ||
| if (rc /= ESMF_SUCCESS) return |
| @@ -170,11 +170,22 @@ program test_MetState | |||
|
|
|||
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Do you plan to add documentation on how to run standalone?
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.