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 a function to retrieve the current last mesh generator for actions …
- Loading branch information
Showing
12 changed files
with
156 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# MOOSE Action System | ||
|
||
MOOSE actions, derived from the base class *Action* are used to set up a problem with other MOOSE objects including mesh generators, kernels, materials, user objects, etc. | ||
An action can be optionally linked to an input syntax, which provides the valid parameters to the action through the MOOSE input parser behind the scene. | ||
An action is assocated with tasks, which determine when the action is to be acted, or the *act* function of an action is to be called by MOOSE. | ||
Association with multiple tasks is allowed. In such case, it is developers' responsibility to switch the functions based on the current task in the act function. | ||
A full list of tasks is available in Moose.C file. | ||
Developers are allowed to register new tasks with MOOSE Action system. | ||
When actions are built either through the input parser or internally by MOOSE, they will exist during the entire simulation. | ||
|
||
MOOSE has lots of built-in actions for adding individual objects through input files. | ||
But MOOSE action system is far beyond the basic capabilities provided by these built-in actions. | ||
Developers are encouraged to explore the MOOSE actions system to create their own actions in order to perform problem setup in one place and potentially simplify the input syntax significantly. | ||
One example is to use an action to append a mesh generator that generats a boundary surrounding a particular subdomain for imposing specific boundary conditions, based on the information not necessarily inside of a mesh generator block. |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
- /ModifyMesh | ||
- /BadKernels | ||
- /MoreAuxVariables | ||
- /Kernels/OldNamedKernel |
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,28 @@ | ||
//* 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 "MooseObjectAction.h" | ||
|
||
// Forward Declaration | ||
class AppendMeshGeneratorAction; | ||
|
||
template <> | ||
InputParameters validParams<AppendMeshGeneratorAction>(); | ||
|
||
class AppendMeshGeneratorAction : public MooseObjectAction | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
AppendMeshGeneratorAction(InputParameters params); | ||
|
||
virtual void act() override; | ||
}; |
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 "AppendMeshGeneratorAction.h" | ||
#include "MooseMesh.h" | ||
#include "MeshGenerator.h" | ||
#include "Factory.h" | ||
#include "MooseApp.h" | ||
|
||
registerMooseAction("MooseApp", AppendMeshGeneratorAction, "append_mesh_generator"); | ||
|
||
defineLegacyParams(AppendMeshGeneratorAction); | ||
|
||
InputParameters | ||
AppendMeshGeneratorAction::validParams() | ||
{ | ||
InputParameters params = MooseObjectAction::validParams(); | ||
return params; | ||
} | ||
|
||
AppendMeshGeneratorAction::AppendMeshGeneratorAction(InputParameters params) | ||
: MooseObjectAction(params) | ||
{ | ||
} | ||
|
||
void | ||
AppendMeshGeneratorAction::act() | ||
{ | ||
if (!_mesh) | ||
mooseError("No mesh file was supplied and no generation block was provided"); | ||
|
||
if (!_moose_object_pars.have_parameter<MeshGeneratorName>("input")) | ||
mooseError("Cannot append a mesh generator that does not take input mesh generators"); | ||
|
||
_moose_object_pars.set<MeshGeneratorName>("input") = _app.getCurrentFinalMeshGenerator(); | ||
_app.addMeshGenerator(_type, _name, _moose_object_pars); | ||
} |
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
20 changes: 20 additions & 0 deletions
20
test/tests/meshgenerators/append_mesh_generator/append_mesh_generator.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,20 @@ | ||
[Mesh] | ||
[gmg] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
nx = 3 | ||
ny = 3 | ||
[] | ||
[] | ||
|
||
[ModifyMesh] | ||
[addss] | ||
type = SideSetsAroundSubdomainGenerator | ||
new_boundary = whole | ||
block = 0 | ||
[] | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] |
Binary file added
BIN
+3.47 KB
test/tests/meshgenerators/append_mesh_generator/gold/append_mesh_generator_in.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Tests] | ||
[./append_mesh_generator_test] | ||
type = 'Exodiff' | ||
input = 'append_mesh_generator.i' | ||
cli_args = '--mesh-only' | ||
exodiff = 'append_mesh_generator_in.e' | ||
requirement = 'MOOSE shall be able to allow actions to append mesh generators.' | ||
design = 'actions/Action.md' | ||
issues = '#15121' | ||
mesh_mode = 'REPLICATED' | ||
recover = false | ||
[../] | ||
[] |