forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
238 additions
and
102 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "Kernel.h" | ||
|
||
/** | ||
* Kernel that tries to obtain a writable reference to a variable, but fails immediately because | ||
* only AuxKernels, ElementUserObjects, and NodalUserObjects are permitted to get a writable | ||
* reference. | ||
*/ | ||
class MultipleUpdateErrorKernel : public Kernel | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
MultipleUpdateErrorKernel(const InputParameters & parameters); | ||
|
||
protected: | ||
Real computeQpResidual() override; | ||
|
||
/// use deprecated API | ||
const bool _deprecated; | ||
|
||
/// current API | ||
MooseVariable * _var1; | ||
MooseVariable * _var2; | ||
|
||
/// deprectated API | ||
VariableValue * _dvar1; | ||
VariableValue * _dvar2; | ||
}; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "MultipleUpdateErrorKernel.h" | ||
|
||
registerMooseObject("MooseTestApp", MultipleUpdateErrorKernel); | ||
|
||
InputParameters | ||
MultipleUpdateErrorKernel::validParams() | ||
{ | ||
InputParameters params = Kernel::validParams(); | ||
params.addRequiredCoupledVar("var1", "an aux variable to update"); | ||
params.addRequiredCoupledVar("var2", "another aux variable to update"); | ||
params.addParam<bool>("use_deprecated_api", false, "Test the deprecated API"); | ||
return params; | ||
} | ||
|
||
MultipleUpdateErrorKernel::MultipleUpdateErrorKernel(const InputParameters & parameters) | ||
: Kernel(parameters), _deprecated(getParam<bool>("use_deprecated_api")) | ||
{ | ||
if (_deprecated) | ||
{ | ||
_dvar1 = &writableCoupledValue("var1"); | ||
_dvar2 = &writableCoupledValue("var2"); | ||
} | ||
else | ||
{ | ||
_var1 = &writableVariable("var1"); | ||
_var2 = &writableVariable("var2"); | ||
} | ||
} | ||
|
||
Real | ||
MultipleUpdateErrorKernel::computeQpResidual() | ||
{ | ||
mooseError("This should never be reached"); | ||
} |
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
58 changes: 58 additions & 0 deletions
58
test/tests/auxkernels/nodal_aux_var/multi_update_var_error.i
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
xmin = 0 | ||
xmax = 1 | ||
ymin = 0 | ||
ymax = 1 | ||
nx = 2 | ||
ny = 2 | ||
[] | ||
|
||
[Variables] | ||
[u] | ||
order = FIRST | ||
family = LAGRANGE | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[ten] | ||
order = FIRST | ||
family = LAGRANGE | ||
initial_condition = 1 | ||
[] | ||
[2k] | ||
order = FIRST | ||
family = LAGRANGE | ||
initial_condition = 2 | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[all] | ||
type = MultipleUpdateErrorKernel | ||
variable = u | ||
var1 = ten | ||
var2 = 2k | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 1 | ||
value = 0 | ||
[] | ||
[right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 3 | ||
value = 1 | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] |
Oops, something went wrong.