From fca3a9e3df101bd07a228631e5509ec4a93a9906 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Mon, 6 Jan 2025 10:08:13 -0700 Subject: [PATCH] Bugfix for variables in multiple groups (#618) PR to address issue with variable intents *across* groups. **Description** - Current behavior for variables across groups: the intent for the first group is used as the "truth". - If variable "foo" is intent "out" in Group A and intent "in" in Group B, "foo" will be added to the variable dictionary used by the host as intent "out", which then the host assumes means that the framework will handle it - Updated behavior for variables across groups: adjust the intent of the existing variable to "inout" if a conflict arises across groups (or suites) User interface changes?: No Testing: test removed: N/A unit tests: Updated capgen & ddt test - variable intents across suites also affected; PASS system tests: all PASS manual testing: Ran in CAM-SIMA --- scripts/suite_objects.py | 4 +--- test/capgen_test/run_test | 2 +- test/capgen_test/test_host.F90 | 3 ++- test/capgen_test/test_reports.py | 2 +- test/ddthost_test/run_test | 2 +- test/ddthost_test/test_host.F90 | 3 ++- test/ddthost_test/test_reports.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/suite_objects.py b/scripts/suite_objects.py index 7317e75d..24b92488 100755 --- a/scripts/suite_objects.py +++ b/scripts/suite_objects.py @@ -86,9 +86,7 @@ def add_vars(self, call_list, run_env, gen_unique=False): """Add new variables from another CallList ()""" for var in call_list.variable_list(): stdname = var.get_prop_value('standard_name') - if stdname not in self: - self.add_variable(var, run_env, gen_unique=gen_unique) - # end if + self.add_variable(var, run_env, gen_unique=gen_unique, adjust_intent=True, exists_ok=True) # end for def add_variable(self, newvar, run_env, exists_ok=False, gen_unique=False, diff --git a/test/capgen_test/run_test b/test/capgen_test/run_test index 0f826c69..f0b71aa2 100755 --- a/test/capgen_test/run_test +++ b/test/capgen_test/run_test @@ -144,7 +144,7 @@ input_vars_ddt="${input_vars_ddt},horizontal_loop_end" input_vars_ddt="${input_vars_ddt},model_times,number_of_model_times" input_vars_ddt="${input_vars_ddt},surface_air_pressure" output_vars_ddt="ccpp_error_code,ccpp_error_message" -output_vars_ddt="${output_vars_ddt},model_times,number_of_model_times" +output_vars_ddt="${output_vars_ddt},model_times,number_of_model_times,surface_air_pressure" required_vars_temp="ccpp_error_code,ccpp_error_message" required_vars_temp="${required_vars_temp},coefficients_for_interpolation" required_vars_temp="${required_vars_temp},configuration_variable" diff --git a/test/capgen_test/test_host.F90 b/test/capgen_test/test_host.F90 index 1958db99..8f716322 100644 --- a/test/capgen_test/test_host.F90 +++ b/test/capgen_test/test_host.F90 @@ -400,10 +400,11 @@ program test 'number_of_model_times ', & 'surface_air_pressure ' /) - character(len=cm), target :: test_outvars2(4) = (/ & + character(len=cm), target :: test_outvars2(5) = (/ & 'ccpp_error_code ', & 'ccpp_error_message ', & 'model_times ', & + 'surface_air_pressure ', & 'number_of_model_times ' /) character(len=cm), target :: test_reqvars2(5) = (/ & diff --git a/test/capgen_test/test_reports.py b/test/capgen_test/test_reports.py index 8061102a..ed123013 100644 --- a/test/capgen_test/test_reports.py +++ b/test/capgen_test/test_reports.py @@ -75,7 +75,7 @@ def usage(errmsg=None): "horizontal_loop_begin", "horizontal_loop_end", "surface_air_pressure", "horizontal_dimension"] _OUTPUT_VARS_DDT = ["ccpp_error_code", "ccpp_error_message", "model_times", - "number_of_model_times"] + "surface_air_pressure", "number_of_model_times"] _REQUIRED_VARS_DDT = _INPUT_VARS_DDT + _OUTPUT_VARS_DDT _PROT_VARS_TEMP = ["horizontal_loop_begin", "horizontal_loop_end", "horizontal_dimension", "vertical_layer_dimension", diff --git a/test/ddthost_test/run_test b/test/ddthost_test/run_test index e7b5d09d..65e73886 100755 --- a/test/ddthost_test/run_test +++ b/test/ddthost_test/run_test @@ -144,7 +144,7 @@ input_vars_ddt="${input_vars_ddt},horizontal_loop_end" input_vars_ddt="${input_vars_ddt},model_times,number_of_model_times" input_vars_ddt="${input_vars_ddt},surface_air_pressure" output_vars_ddt="ccpp_error_code,ccpp_error_message" -output_vars_ddt="${output_vars_ddt},model_times,number_of_model_times" +output_vars_ddt="${output_vars_ddt},model_times,number_of_model_times,surface_air_pressure" required_vars_temp="ccpp_error_code,ccpp_error_message" required_vars_temp="${required_vars_temp},coefficients_for_interpolation" required_vars_temp="${required_vars_temp},horizontal_dimension" diff --git a/test/ddthost_test/test_host.F90 b/test/ddthost_test/test_host.F90 index 02809e8d..d060e59e 100644 --- a/test/ddthost_test/test_host.F90 +++ b/test/ddthost_test/test_host.F90 @@ -391,10 +391,11 @@ program test 'number_of_model_times ', & 'surface_air_pressure ' /) - character(len=cm), target :: test_outvars2(4) = (/ & + character(len=cm), target :: test_outvars2(5) = (/ & 'ccpp_error_code ', & 'ccpp_error_message ', & 'model_times ', & + 'surface_air_pressure ', & 'number_of_model_times ' /) character(len=cm), target :: test_reqvars2(5) = (/ & diff --git a/test/ddthost_test/test_reports.py b/test/ddthost_test/test_reports.py index 99046387..aae9098b 100644 --- a/test/ddthost_test/test_reports.py +++ b/test/ddthost_test/test_reports.py @@ -65,7 +65,7 @@ "horizontal_loop_begin", "horizontal_loop_end", "surface_air_pressure", "horizontal_dimension"] _OUTPUT_VARS_DDT = ["ccpp_error_code", "ccpp_error_message", "model_times", - "number_of_model_times"] + "number_of_model_times", "surface_air_pressure"] _REQUIRED_VARS_DDT = _INPUT_VARS_DDT + _OUTPUT_VARS_DDT _PROT_VARS_TEMP = ["horizontal_loop_begin", "horizontal_loop_end", "horizontal_dimension", "vertical_layer_dimension",