-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constituents #495
Merged
Merged
Constituents #495
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
69e2bf9
initial stab at constituents-only PR
52e5985
cleanup and fixes
a5aa37b
add is_scheme_constituent interface
9897870
fix tests and add is_thermo_active property
73ef0a3
add ddt testing and update constituent standard names
071687e
add testing files
d8b7b04
merge up
5560875
fix merge
370e78d
address reviewer comments
e9e70b7
merge feature/capgen
ac18c44
fix tests
9db9477
address reviewer comments
4c1807c
change debug_on subroutine in framework_env to verbose property
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,7 +427,7 @@ def analyze(self, host_model, scheme_library, ddt_library, run_env): | |
phase = RUN_PHASE_NAME | ||
# end if | ||
lmsg = "Group {}, schemes = {}" | ||
if run_env.logger and run_env.logger.isEnabledFor(logging.DEBUG): | ||
if run_env.debug_on(): | ||
run_env.logger.debug(lmsg.format(item.name, | ||
[x.name | ||
for x in item.schemes()])) | ||
|
@@ -490,7 +490,7 @@ def write(self, output_dir, run_env): | |
(calling the group caps one after another)""" | ||
# Set name of module and filename of cap | ||
filename = '{module_name}.F90'.format(module_name=self.module) | ||
if run_env.logger and run_env.logger.isEnabledFor(logging.DEBUG): | ||
if run_env.debug_on(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed! |
||
run_env.logger.debug('Writing CCPP suite file, {}'.format(filename)) | ||
# end if | ||
# Retrieve the name of the constituent module for Group use statements | ||
|
@@ -808,32 +808,46 @@ def write_req_vars_sub(self, ofile, errmsg_name, errcode_name): | |
input_vars = [set(), set(), set()] # leaves, arrays, leaf elements | ||
inout_vars = [set(), set(), set()] # leaves, arrays, leaf elements | ||
output_vars = [set(), set(), set()] # leaves, arrays, leaf elements | ||
const_initialized_in_physics = {} | ||
for part in suite.groups: | ||
for var in part.call_list.variable_list(): | ||
phase = part.phase() | ||
stdname = var.get_prop_value("standard_name") | ||
intent = var.get_prop_value("intent") | ||
protected = var.get_prop_value("protected") | ||
constituent = var.is_constituent() | ||
if stdname not in const_initialized_in_physics: | ||
const_initialized_in_physics[stdname] = False | ||
# end if | ||
if (parent is not None) and (not protected): | ||
pvar = parent.find_variable(standard_name=stdname) | ||
if pvar is not None: | ||
protected = pvar.get_prop_value("protected") | ||
# end if | ||
# end if | ||
elements = var.intrinsic_elements(check_dict=self.parent) | ||
if (intent == 'in') and (not protected): | ||
elements = var.intrinsic_elements(check_dict=self.parent, | ||
ddt_lib=self.__ddt_lib) | ||
if (intent == 'in') and (not protected) and (not const_initialized_in_physics[stdname]): | ||
if isinstance(elements, list): | ||
input_vars[1].add(stdname) | ||
input_vars[2].update(elements) | ||
else: | ||
input_vars[0].add(stdname) | ||
# end if | ||
elif intent == 'inout': | ||
elif intent == 'inout' and (not const_initialized_in_physics[stdname]): | ||
if isinstance(elements, list): | ||
inout_vars[1].add(stdname) | ||
inout_vars[2].update(elements) | ||
else: | ||
inout_vars[0].add(stdname) | ||
# end if | ||
elif constituent and (intent == 'out' and phase != 'initialize' and not | ||
const_initialized_in_physics[stdname]): | ||
# constituents HAVE to be initialized in the init phase because the dycore needs to advect them | ||
emsg = f"constituent variable '{stdname}' cannot be initialized in the '{phase}' phase" | ||
raise CCPPError(emsg) | ||
elif intent == 'out' and constituent and phase == 'initialize': | ||
const_initialized_in_physics[stdname] = True | ||
elif intent == 'out': | ||
if isinstance(elements, list): | ||
output_vars[1].add(stdname) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below, should be just
run_env.verbose()
or even better a propertyrun_env.verbose
. This way it's consistent with #512 where I addedrun_env.debug
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed!