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.
Added MooseMesh::getBlocksMaxDimension()
Refs idaholab#23794
- Loading branch information
1 parent
cf41d7d
commit fe3f50a
Showing
8 changed files
with
242 additions
and
2 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
32 changes: 32 additions & 0 deletions
32
test/include/postprocessors/BlocksMaxDimensionPostprocessor.h
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 | ||
|
||
#pragma once | ||
|
||
#include "GeneralPostprocessor.h" | ||
|
||
/** | ||
* Gets the mesh dimension of a list of blocks | ||
*/ | ||
class BlocksMaxDimensionPostprocessor : public GeneralPostprocessor | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
BlocksMaxDimensionPostprocessor(const InputParameters & parameters); | ||
|
||
virtual void initialize() override {} | ||
virtual void execute() override {} | ||
|
||
virtual Real getValue() override; | ||
|
||
protected: | ||
/// Subdomain names | ||
std::vector<SubdomainName> _blocks; | ||
}; |
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 | ||
|
||
#include "BlocksMaxDimensionPostprocessor.h" | ||
|
||
registerMooseObject("MooseTestApp", BlocksMaxDimensionPostprocessor); | ||
|
||
InputParameters | ||
BlocksMaxDimensionPostprocessor::validParams() | ||
{ | ||
InputParameters params = GeneralPostprocessor::validParams(); | ||
params.addRequiredParam<std::vector<SubdomainName>>("block", "The list of subdomain names"); | ||
return params; | ||
} | ||
|
||
BlocksMaxDimensionPostprocessor::BlocksMaxDimensionPostprocessor(const InputParameters & parameters) | ||
: GeneralPostprocessor(parameters), _blocks(getParam<std::vector<SubdomainName>>("block")) | ||
{ | ||
} | ||
|
||
Real | ||
BlocksMaxDimensionPostprocessor::getValue() | ||
{ | ||
return getMooseApp().actionWarehouse().mesh()->getBlocksMaxDimension(_blocks); | ||
} |
146 changes: 146 additions & 0 deletions
146
test/tests/mesh/blocks_max_dimension/blocks_max_dimension.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,146 @@ | ||
# This input file tests MooseMesh::getBlocksMaxDimension(), which gets the MESH | ||
# dimension of a list of subdomain names. | ||
# | ||
# Note the differences between the MESH dimension and the SPATIAL dimension. | ||
# The SPATIAL dimension just looks at the maximum coordinate dimension used: | ||
# - Equals 3 if there is a nonzero z coordinate | ||
# - Equals 2 if there is no nonzero z coordinate, but there is a nonzero y coordinate | ||
# - Equals 1 if there is no nonzero y or z coordinate | ||
# In contrast, the MESH dimension looks at the dimensionality of the elements. | ||
# Therefore, the MESH dimension differs from the SPATIAL dimension when: | ||
# - a 1D element has a nonzero y or z coordinate | ||
# - a 2D element has a nonzero z coordinate | ||
# This test will include subdomains with these cases and test different | ||
# lists of subdomains. | ||
# | ||
|
||
[Mesh] | ||
# 1D block | ||
[block1d_mg] | ||
type = GeneratedMeshGenerator | ||
dim = 1 | ||
xmin = 0.0 | ||
xmax = 1.0 | ||
[] | ||
[block1d_renumber_mg] | ||
type = RenameBlockGenerator | ||
input = block1d_mg | ||
old_block = 0 | ||
new_block = 1 | ||
[] | ||
[block1d_rename_mg] | ||
type = RenameBlockGenerator | ||
input = block1d_renumber_mg | ||
old_block = 1 | ||
new_block = 'block1d' | ||
[] | ||
[block1d_translate_mg] | ||
type = TransformGenerator | ||
input = block1d_rename_mg | ||
transform = TRANSLATE | ||
vector_value = '0 0 1.0' | ||
[] | ||
|
||
# 2D block | ||
[block2d_mg] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
xmin = 2.0 | ||
xmax = 3.0 | ||
ymin = 0.0 | ||
ymax = 1.0 | ||
boundary_id_offset = 10 | ||
[] | ||
[block2d_renumber_mg] | ||
type = RenameBlockGenerator | ||
input = block2d_mg | ||
old_block = 0 | ||
new_block = 2 | ||
[] | ||
[block2d_rename_mg] | ||
type = RenameBlockGenerator | ||
input = block2d_renumber_mg | ||
old_block = 2 | ||
new_block = 'block2d' | ||
[] | ||
[boundary2d_rename_mg] | ||
type = RenameBoundaryGenerator | ||
input = block2d_rename_mg | ||
old_boundary = 'left right bottom top' | ||
new_boundary = 'left2d right2d bottom2d top2d' | ||
[] | ||
[block2d_translate_mg] | ||
type = TransformGenerator | ||
input = boundary2d_rename_mg | ||
transform = TRANSLATE | ||
vector_value = '0 0 1.0' | ||
[] | ||
|
||
# 3D block | ||
[block3d_mg] | ||
type = GeneratedMeshGenerator | ||
dim = 3 | ||
xmin = 4.0 | ||
xmax = 5.0 | ||
ymin = 0.0 | ||
ymax = 1.0 | ||
zmin = 0.0 | ||
zmax = 1.0 | ||
boundary_id_offset = 20 | ||
[] | ||
[block3d_renumber_mg] | ||
type = RenameBlockGenerator | ||
input = block3d_mg | ||
old_block = 0 | ||
new_block = 3 | ||
[] | ||
[block3d_rename_mg] | ||
type = RenameBlockGenerator | ||
input = block3d_renumber_mg | ||
old_block = 3 | ||
new_block = 'block3d' | ||
[] | ||
[boundary3d_rename_mg] | ||
type = RenameBoundaryGenerator | ||
input = block3d_rename_mg | ||
old_boundary = 'left right bottom top back front' | ||
new_boundary = 'left3d right3d bottom3d top3d back3d front3d' | ||
[] | ||
|
||
# combine blocks | ||
[combiner_mg] | ||
type = CombinerGenerator | ||
inputs = 'block1d_translate_mg block2d_translate_mg boundary3d_rename_mg' | ||
[] | ||
[] | ||
|
||
[Postprocessors] | ||
[dim_1d] | ||
type = BlocksMaxDimensionPostprocessor | ||
block = 'block1d' | ||
execute_on = 'INITIAL' | ||
[] | ||
[dim_1d_2d] | ||
type = BlocksMaxDimensionPostprocessor | ||
block = 'block1d block2d' | ||
execute_on = 'INITIAL' | ||
[] | ||
[dim_1d_2d_3d] | ||
type = BlocksMaxDimensionPostprocessor | ||
block = 'block1d block2d block3d' | ||
execute_on = 'INITIAL' | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] | ||
|
||
[Problem] | ||
solve = false | ||
[] | ||
|
||
[Outputs] | ||
csv = true | ||
execute_on = 'INITIAL' | ||
[] |
2 changes: 2 additions & 0 deletions
2
test/tests/mesh/blocks_max_dimension/gold/blocks_max_dimension_out.csv
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,2 @@ | ||
time,dim_1d,dim_1d_2d,dim_1d_2d_3d | ||
0,1,2,3 |
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] | ||
issues = '#23794' | ||
design = 'Mesh/index.md' | ||
[test] | ||
type = CSVDiff | ||
input = 'blocks_max_dimension.i' | ||
csvdiff = 'blocks_max_dimension_out.csv' | ||
recover = false # no solve | ||
|
||
requirement = 'The system shall get the correct mesh dimension for a list of subdomains.' | ||
[] | ||
[] |