forked from idaholab/moose
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API for deprecating coupled variables (Closes idaholab#15497)
- Loading branch information
Showing
11 changed files
with
229 additions
and
14 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 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//* 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 "ADKernel.h" | ||
|
||
/** | ||
* Tests the InputParameters::addDeprecatedCoupledVar method | ||
* | ||
*/ | ||
class DeprecatedCoupledVarKernel : public ADKernel | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
DeprecatedCoupledVarKernel(const InputParameters & parameters); | ||
|
||
protected: | ||
ADReal computeQpResidual() override; | ||
|
||
const ADVariableValue & _source; | ||
}; |
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,35 @@ | ||
//* 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 "DeprecatedCoupledVarKernel.h" | ||
|
||
registerMooseObject("MooseTestApp", DeprecatedCoupledVarKernel); | ||
|
||
InputParameters | ||
DeprecatedCoupledVarKernel::validParams() | ||
{ | ||
InputParameters params = ADKernel::validParams(); | ||
params.addCoupledVar("source", "A variable representing a source term"); | ||
params.addDeprecatedCoupledVar("stupid_name", | ||
"source", | ||
"A variable representing a source term", | ||
"'stupid_name' is deprecated. Please use 'source' instead"); | ||
return params; | ||
} | ||
|
||
DeprecatedCoupledVarKernel::DeprecatedCoupledVarKernel(const InputParameters & parameters) | ||
: ADKernel(parameters), _source(adCoupledValue("source")) | ||
{ | ||
} | ||
|
||
ADReal | ||
DeprecatedCoupledVarKernel::computeQpResidual() | ||
{ | ||
return -_test[_i][_qp] * _source[_qp]; | ||
} |
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,75 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
nx = 10 | ||
ny = 10 | ||
[] | ||
|
||
[Variables] | ||
[./u] | ||
[../] | ||
[v][] | ||
[] | ||
|
||
[Kernels] | ||
active = 'diff_u coupled_u diff_v deprecated_coupled_v' | ||
[./diff_u] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[coupled_u] | ||
type = DeprecatedCoupledVarKernel | ||
variable = u | ||
source = v | ||
[] | ||
[diff_v] | ||
type = Diffusion | ||
variable = v | ||
[] | ||
[deprecated_coupled_v] | ||
type = DeprecatedCoupledVarKernel | ||
variable = v | ||
stupid_name = u | ||
[] | ||
[blessed_coupled_v] | ||
type = DeprecatedCoupledVarKernel | ||
variable = v | ||
source = u | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[./left_u] | ||
type = DirichletBC | ||
variable = u | ||
boundary = left | ||
value = 0 | ||
[../] | ||
[./right_u] | ||
type = DirichletBC | ||
variable = u | ||
boundary = right | ||
value = 1 | ||
[../] | ||
[./left_v] | ||
type = DirichletBC | ||
variable = v | ||
boundary = left | ||
value = 1 | ||
[../] | ||
[./right_v] | ||
type = DirichletBC | ||
variable = v | ||
boundary = right | ||
value = 0 | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = 'NEWTON' | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] |
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 @@ | ||
deprecated_coupled_var_out.e |
Binary file not shown.
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