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.
Fix and test user object support (idaholab#22563)
- Loading branch information
Showing
11 changed files
with
226 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//* 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 "ElementUserObject.h" | ||
|
||
/** | ||
* Test object for the writableVariable API for nodal values | ||
*/ | ||
class MultiUpdateElementalUO : public ElementUserObject | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
MultiUpdateElementalUO(const InputParameters & parameters); | ||
|
||
virtual void initialize() override {} | ||
virtual void execute() override; | ||
virtual void finalize() override {} | ||
virtual void threadJoin(const UserObject &) override {} | ||
|
||
protected: | ||
MooseVariable & _v; | ||
}; |
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,31 @@ | ||
//* 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 "NodalUserObject.h" | ||
|
||
/** | ||
* Test object for the writableVariable API for nodal values | ||
*/ | ||
class MultiUpdateNodalUO : public NodalUserObject | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
MultiUpdateNodalUO(const InputParameters & parameters); | ||
|
||
virtual void initialize() override {} | ||
virtual void execute() override; | ||
virtual void finalize() override {} | ||
virtual void threadJoin(const UserObject &) override {} | ||
|
||
protected: | ||
MooseVariable & _v; | ||
}; |
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,33 @@ | ||
//* 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 "MultiUpdateElementalUO.h" | ||
|
||
registerMooseObject("MooseTestApp", MultiUpdateElementalUO); | ||
|
||
InputParameters | ||
MultiUpdateElementalUO::validParams() | ||
{ | ||
InputParameters params = ElementUserObject::validParams(); | ||
params.addClassDescription("Test object for the writableVariable API for elemental values"); | ||
params.addRequiredCoupledVar("v", "Coupled variable that will be written to by the test object."); | ||
return params; | ||
} | ||
|
||
MultiUpdateElementalUO::MultiUpdateElementalUO(const InputParameters & parameters) | ||
: ElementUserObject(parameters), _v(writableVariable("v")) | ||
{ | ||
} | ||
|
||
void | ||
MultiUpdateElementalUO::execute() | ||
{ | ||
// it really is a DOF value | ||
_v.setNodalValue(1.23); | ||
} |
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,32 @@ | ||
//* 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 "MultiUpdateNodalUO.h" | ||
|
||
registerMooseObject("MooseTestApp", MultiUpdateNodalUO); | ||
|
||
InputParameters | ||
MultiUpdateNodalUO::validParams() | ||
{ | ||
InputParameters params = NodalUserObject::validParams(); | ||
params.addClassDescription("Test object for the writableVariable API for nodal values"); | ||
params.addRequiredCoupledVar("v", "Coupled variable that will be written to by the test object."); | ||
return params; | ||
} | ||
|
||
MultiUpdateNodalUO::MultiUpdateNodalUO(const InputParameters & parameters) | ||
: NodalUserObject(parameters), _v(writableVariable("v")) | ||
{ | ||
} | ||
|
||
void | ||
MultiUpdateNodalUO::execute() | ||
{ | ||
_v.setNodalValue(1.23); | ||
} |
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,35 @@ | ||
[Mesh] | ||
[gen] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
nx = 1 | ||
ny = 1 | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[v] | ||
family = MONOMIAL | ||
order = CONSTANT | ||
[] | ||
[] | ||
|
||
[UserObjects] | ||
[elemental] | ||
type = MultiUpdateElementalUO | ||
v = v | ||
[] | ||
[] | ||
|
||
[Problem] | ||
kernel_coverage_check = false | ||
solve = false | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[Mesh] | ||
[gen] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
nx = 1 | ||
ny = 1 | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[v] | ||
family = LAGRANGE | ||
order = FIRST | ||
[] | ||
[] | ||
|
||
[UserObjects] | ||
[elemental] | ||
type = MultiUpdateNodalUO | ||
v = v | ||
[] | ||
[] | ||
|
||
[Problem] | ||
kernel_coverage_check = false | ||
solve = false | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] | ||
|
||
[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,12 @@ | ||
[Tests] | ||
[nodal] | ||
type = Exodiff | ||
input = nodal.i | ||
exodiff = nodal_out.e | ||
[] | ||
[elemental] | ||
type = Exodiff | ||
input = elemental.i | ||
exodiff = elemental_out.e | ||
[] | ||
[] |