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.
allow loading elemental variables in exodus file for setting extra el…
…ement integers idaholab#14916
- Loading branch information
Showing
8 changed files
with
138 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
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 "AuxKernel.h" | ||
|
||
// Forward Declarations | ||
class ElemExtraIDAux; | ||
|
||
template <> | ||
InputParameters validParams<ElemExtraIDAux>(); | ||
|
||
class ElemExtraIDAux : public AuxKernel | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
ElemExtraIDAux(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeValue() override; | ||
|
||
const dof_id_type & _id; | ||
}; |
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 "ElemExtraIDAux.h" | ||
|
||
registerMooseObject("MooseApp", ElemExtraIDAux); | ||
|
||
defineLegacyParams(ElemExtraIDAux); | ||
|
||
InputParameters | ||
ElemExtraIDAux::validParams() | ||
{ | ||
InputParameters params = AuxKernel::validParams(); | ||
params.addRequiredParam<std::vector<ExtraElementIDName>>("extra_id_name", | ||
"The extra ID name in the mesh"); | ||
params.addClassDescription("Puts element extra IDs into an aux variable."); | ||
return params; | ||
} | ||
|
||
ElemExtraIDAux::ElemExtraIDAux(const InputParameters & parameters) | ||
: AuxKernel(parameters), _id(getElementID("extra_id_name")) | ||
{ | ||
} | ||
|
||
Real | ||
ElemExtraIDAux::computeValue() | ||
{ | ||
return _id; | ||
} |
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
35 changes: 35 additions & 0 deletions
35
test/tests/meshgenerators/file_mesh_generator/exodus_file_mesh_with_id.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,35 @@ | ||
[Mesh] | ||
[material_id_mesh] | ||
type = FileMeshGenerator | ||
file = mesh_with_material_id.e | ||
exodus_extra_element_integers = material_id | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[material_id] | ||
family = MONOMIAL | ||
order = CONSTANT | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[set_material_id] | ||
type = ElemExtraIDAux | ||
variable = material_id | ||
extra_id_name = material_id | ||
[] | ||
[] | ||
|
||
[Problem] | ||
kernel_coverage_check = false | ||
solve = false | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] |
Binary file added
BIN
+26.8 KB
test/tests/meshgenerators/file_mesh_generator/gold/exodus_file_mesh_with_id_out.e
Binary file not shown.
Binary file added
BIN
+26.5 KB
test/tests/meshgenerators/file_mesh_generator/mesh_with_material_id.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