Skip to content

Commit

Permalink
Address comments (idaholab#22563)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Mar 2, 2023
1 parent 3fb48b7 commit 4f59c25
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion framework/doc/content/source/interfaces/Coupleable.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ method that can be used to set the nodal or elemental DOF value(s) of the variab
requested variable. I.e. nodal user objects and AuxKernels may only obtain references to nodal variables, and
element user objects and elemental AuxKernels may only obtain references to elemental variables.

The block restrictins of the variables are also checked not to exceed the block restrictions of the calling object.
The block restrictions of the variables are also checked not to exceed the block restrictions of the calling object.
MOOSE keeps track of all variables to which a reference was obtained through `Coupleable::writableVariable`. Each
variable in the system may at most be written to by a single object on any given subdomain.

Expand Down
8 changes: 4 additions & 4 deletions framework/include/interfaces/Coupleable.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ class Coupleable
}

/**
* Checks whether the object has any writable coupled variables
* returns a reference to the set of writable coupled variables
*/
bool hasWritableCoupledVariables() const { return !_writable_coupled_variables[_c_tid].empty(); }
auto & getWritableCoupledVariables() const { return _writable_coupled_variables[_c_tid]; }

/**
* returns a reference to the set of writable coupled variables
* Checks whether the object has any writable coupled variables
*/
auto & getWritableCoupledVariables() const { return _writable_coupled_variables[_c_tid]; }
bool hasWritableCoupledVariables() const { return !getWritableCoupledVariables().empty(); }

protected:
/**
Expand Down
2 changes: 1 addition & 1 deletion framework/src/interfaces/Coupleable.C
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ Coupleable::checkWritableVar(MooseVariable * var)
}

// var is unique across threads, so we could forego having a separate set per thread, but we
// need qucik access to the list of all variables that need to be inserted into the solution
// need quick access to the list of all variables that need to be inserted into the solution
// vector by a given thread.
_writable_coupled_variables[_c_tid].insert(var);
}
Expand Down
12 changes: 6 additions & 6 deletions test/tests/auxkernels/nodal_aux_var/tests
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"NodalUserObjects\. 'all' is neither of those\."
issues = '#22563'
allow_deprecated = true
requirement = "The writableVariable API shall be limited to use from AuxKernels, "
requirement = "Writing to auxiliary variables shall be limited to use from AuxKernels, "
"ElementUserObjects, or NodalUserObjects."
[]

Expand All @@ -49,7 +49,7 @@
exodiff = 'out_multi_var.e'
issues = '#2099'
allow_deprecated = true
requirement = "The AuxKernel objects shall be capable of wriyting to to multiple coupled "
requirement = Auxiliary kernel objects shall be capable of wriyting to to multiple coupled "
"variables using the deprecated writeCoupledValue method."
[]
[multi_update_deprecated_error]
Expand All @@ -60,8 +60,8 @@
"AuxKernel\."
issues = '#22563'
allow_deprecated = true
requirement = "The writableCoupledValue API shall be limited to use from AuxKernels, "
"ElementUserObjects, or NodalUserObjects."
requirement = "Writing to auxiliary variables shall be limited to use from AuxKernels, "
"ElementUserObjects, or NodalUserObjects using variable values."
[]
[multi_update_deprecated_error2]
type = RunException
Expand All @@ -70,7 +70,7 @@
expect_err = "The elemental AuxKernel 'all' cannot obtain a writable reference to the nodal variable 'ten'\."
issues = '#22563'
allow_deprecated = true
requirement = "The writableCoupledValue API shall enforce nodal/elemental consistency between "
requirement = "The writing to auxiliary variables shall enforce nodal/elemental consistency between "
"the kernel variable and the writable variables."
[]
[multi_update_deprecated_error3]
Expand All @@ -89,7 +89,7 @@
expect_err = "Unable to create a writable reference for 'var1', is it a constant expression\?"
issues = '#22563'
allow_deprecated = true
requirement = "The writableCoupledValue API shall error out if a constant value is passed in as variable name."
requirement = "The writing to auxiliary variables shall error out if a constant value is passed in as variable name."
[]

[multi_update_elem_test]
Expand Down
8 changes: 5 additions & 3 deletions test/tests/userobjects/writable_variable/tests
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@
type = Exodiff
input = boundary.i
exodiff = boundary_out.e
requirement = "The system shall permit writing to variables from boundary restricted nodal user objects."
requirement = "The system shall permit writing to variables from boundary restricted nodal user "
"objects."
[]
[boundary_error]
type = RunException
input = boundary2.i
expect_err = "'nodal1' of type 'MultiUpdateNodalUO' depends on variable(s) 'v'. However, that "
expect_err = "'nodal1' of type 'MultiUpdateNodalUO' depends on variable\(s\) 'v'. However, that "
"variable does not appear to be defined on \(all of\) boundary 'bottom'\."
requirement = "The system shall make sure that variables written to by boundary restricted user objects are available along the entire boundary."
requirement = "The system shall make sure that variables written to by boundary restricted user "
"objects are available along the entire boundary."
[]
[]

0 comments on commit 4f59c25

Please sign in to comment.