Skip to content

Commit

Permalink
feat: field manager yaml updates (#1001)
Browse files Browse the repository at this point in the history
Updates the field_manager code to add optional support for yaml input, and cleans up unused code

BREAKING CHANGE: when compiled with `--with-yaml`/ `--Duse_yaml` field_manager will expect yaml input (field_table.yaml) for field_tables
  • Loading branch information
GFDL-Eric authored Aug 15, 2022
1 parent a799986 commit ec57a48
Show file tree
Hide file tree
Showing 9 changed files with 1,389 additions and 2,399 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ list(APPEND fms_fortran_src_files
exchange/xgrid.F90
field_manager/field_manager.F90
field_manager/fm_util.F90
field_manager/fm_yaml.F90
fms/fms_io.F90
fms/fms.F90
fms2_io/blackboxio.F90
Expand Down
6 changes: 4 additions & 2 deletions field_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ noinst_LTLIBRARIES = libfield_manager.la
# Each convenience library depends on its source.
libfield_manager_la_SOURCES = \
field_manager.F90 \
fm_yaml.F90 \
fm_util.F90 \
parse.inc

field_manager_mod.$(FC_MODEXT): parse.inc
field_manager_mod.$(FC_MODEXT): parse.inc fm_yaml_mod.$(FC_MODEXT)
fm_util_mod.$(FC_MODEXT): field_manager_mod.$(FC_MODEXT)

# Mod files are built and then installed as headers.
MODFILES = \
field_manager_mod.$(FC_MODEXT) \
fm_util_mod.$(FC_MODEXT)
fm_util_mod.$(FC_MODEXT) \
fm_yaml_mod.$(FC_MODEXT)
BUILT_SOURCES = $(MODFILES)
nodist_include_HEADERS = $(MODFILES)

Expand Down
3,218 changes: 827 additions & 2,391 deletions field_manager/field_manager.F90

Large diffs are not rendered by default.

523 changes: 523 additions & 0 deletions field_manager/fm_yaml.F90

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions libFMS.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ module fms
get_field_method, get_field_methods, parse, fm_change_list, &
fm_change_root, fm_dump_list, fm_exists, fm_get_index, &
fm_get_current_list, fm_get_length, fm_get_type, fm_get_value, &
fm_intersection, fm_init_loop, &
fm_init_loop, &
fm_loop_over_list, fm_new_list, fm_new_value, &
fm_reset_loop, fm_return_root, &
fm_modify_name, fm_query_method, fm_find_methods, fm_copy_list, &
fm_set_verbosity, fm_field_name_len, fm_path_name_len, &
fm_field_name_len, fm_path_name_len, &
fm_string_len, fm_type_name_len, NUM_MODELS, NO_FIELD, &
MODEL_ATMOS, MODEL_OCEAN, MODEL_LAND, MODEL_ICE, MODEL_COUPLER, &
fm_array_list_def, method_type, method_type_short, &
method_type, method_type_short, &
method_type_very_short, fm_list_iter_type, default_method
use fm_util_mod, only: fm_util_start_namelist, fm_util_end_namelist, &
fm_util_check_for_bad_fields, fm_util_set_caller, &
Expand Down
1 change: 0 additions & 1 deletion supported_interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Additional information for this module and others can be found in the Doxygen ge
- fm_copy_list
- fm_set_verbosity
##### Types
- fm_array_list_def
- method_type
- method_type_short
- method_type_very_short
Expand Down
2 changes: 1 addition & 1 deletion test_fms/field_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ TESTS = test_field_manager2.sh
EXTRA_DIST = test_field_manager2.sh

# Clean up
CLEANFILES = input.nml *.out* field_table *.dpi *.spi *.dyn *.spl
CLEANFILES = input.nml *.out* field_table *.dpi *.spi *.dyn *.spl *.yaml
3 changes: 2 additions & 1 deletion test_fms/field_manager/test_field_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
program test_field_manager

use field_manager_mod
use mpp_mod, only : mpp_exit, mpp_pe, mpp_root_pe, mpp_error, NOTE, FATAL
use mpp_mod, only : mpp_init, mpp_exit, mpp_pe, mpp_root_pe, mpp_error, NOTE, FATAL

implicit none

Expand All @@ -48,6 +48,7 @@ program test_field_manager
logical :: success
type(method_type), dimension(20) :: methods

call mpp_init
call field_manager_init(nfields)

! Dump the list of fields produced from reading the field_table
Expand Down
28 changes: 28 additions & 0 deletions test_fms/field_manager/test_field_manager2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ cat <<_EOF > field_table
"units", "kg/kg" /
_EOF

cat <<_EOF > field_table.yaml
field_table:
- field_type: tracer
modlist:
- model_type: atmos_mod
varlist:
- variable: radon
longname: radon-222
units: VMR*1E21
profile_type: fixed
subparams:
- surface_value: 0.0E+00
convection: all
- model_type: ocean_mod
varlist:
- variable: biotic1
diff_horiz: linear
subparams:
- slope: ok
longname: biotic one
- variable: age_ctl
- model_type: land_mod
varlist:
- variable: sphum
longname: specific humidity
units: kg/kg
_EOF

cat <<_EOF > input.nml
&test_field_manager
Expand Down

0 comments on commit ec57a48

Please sign in to comment.