Skip to content

Commit

Permalink
Check custom blocks params (#24820)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Jun 26, 2023
1 parent 080096e commit 067211e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 34 deletions.
3 changes: 1 addition & 2 deletions framework/include/actions/SetupQuadratureAction.h
Expand Up @@ -31,7 +31,6 @@ class SetupQuadratureAction : public Action
Order _order;
Order _element_order;
Order _side_order;
const std::vector<SubdomainID> & _custom_blocks;
const std::vector<std::string> & _custom_orders;
const std::vector<std::pair<SubdomainID, MooseEnumItem>> _custom_block_orders;
const bool _allow_negative_qweights;
};
22 changes: 13 additions & 9 deletions framework/src/actions/SetupQuadratureAction.C
Expand Up @@ -8,6 +8,7 @@
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "SetupQuadratureAction.h"
#include "MooseVariableBase.h"
#include "Conversion.h"
#include "FEProblem.h"
#include "MooseEnum.h"
Expand All @@ -22,6 +23,9 @@ SetupQuadratureAction::validParams()
"ELEVENTH TWELFTH THIRTEENTH FOURTEENTH FIFTEENTH SIXTEENTH SEVENTEENTH "
"EIGHTTEENTH NINTEENTH TWENTIETH",
"AUTO");
MultiMooseEnum orders("CONSTANT FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH NINTH TENTH "
"ELEVENTH TWELFTH THIRTEENTH FOURTEENTH FIFTEENTH SIXTEENTH SEVENTEENTH "
"EIGHTTEENTH NINTEENTH TWENTIETH");

InputParameters params = Action::validParams();
params.addClassDescription("Sets the quadrature type for the simulation.");
Expand All @@ -32,9 +36,10 @@ SetupQuadratureAction::validParams()
params.addParam<std::vector<SubdomainID>>("custom_blocks",
std::vector<SubdomainID>{},
"list of blocks to specify custom quadrature order");
params.addParam<std::vector<std::string>>("custom_orders",
std::vector<std::string>{},
"list of quadrature orders (e.g. FIRST, SECOND, etc.)");
params.addParam<MultiMooseEnum>(
"custom_orders",
orders,
"list of quadrature orders for the blocks specified in `custom_blocks`");
params.addParam<bool>(
"allow_negative_qweights", true, "Whether or not allow negative quadrature weights");

Expand All @@ -47,8 +52,7 @@ SetupQuadratureAction::SetupQuadratureAction(const InputParameters & parameters)
_order(Moose::stringToEnum<Order>(getParam<MooseEnum>("order"))),
_element_order(Moose::stringToEnum<Order>(getParam<MooseEnum>("element_order"))),
_side_order(Moose::stringToEnum<Order>(getParam<MooseEnum>("side_order"))),
_custom_blocks(getParam<std::vector<SubdomainID>>("custom_blocks")),
_custom_orders(getParam<std::vector<std::string>>("custom_orders")),
_custom_block_orders(getParam<SubdomainID, MooseEnumItem>("custom_blocks", "custom_orders")),
_allow_negative_qweights(getParam<bool>("allow_negative_qweights"))
{
}
Expand All @@ -64,11 +68,11 @@ SetupQuadratureAction::act()
_type, _order, _element_order, _side_order, Moose::ANY_BLOCK_ID, _allow_negative_qweights);

// add custom block-specific quadrature rules
for (unsigned int i = 0; i < _custom_blocks.size(); i++)
for (const auto & [block, order] : _custom_block_orders)
_problem->createQRules(_type,
_order,
Moose::stringToEnum<Order>(_custom_orders[i]),
Moose::stringToEnum<Order>(_custom_orders[i]),
_custom_blocks[i],
Moose::stringToEnum<Order>(order),
Moose::stringToEnum<Order>(order),
block,
_allow_negative_qweights);
}
54 changes: 31 additions & 23 deletions test/tests/quadrature/order/tests
@@ -1,55 +1,63 @@
[Tests]
[./order3]
[order3]
type = CSVDiff
input = 'order5.i'
csvdiff = 'order5_out.csv'

requirement = 'The system shall support the ability to manually increase'
' the quadrature order used for numerical integration on the entire mesh.'
requirement = "The system shall support the ability to manually increase the quadrature order "
"used for numerical integration on the entire mesh."
issues = '#3380'
design = 'Quadrature/index.md'
[../]
[./per-block-order]
[]
[per-block-order]
type = CSVDiff
input = 'block-order.i'
csvdiff = 'block-order_out.csv'

requirement = 'The system shall support the ability to manually specify'
' the quadrature order used for numerical integration on a per-block basis'
' with face quadrature between blocks preferring the higher-order between'
' the two sides.'
requirement = "The system shall support the ability to manually specify the quadrature order "
"used for numerical integration on a per-block basis with face quadrature between "
"blocks preferring the higher-order between the two sides."
issues = '#14055'
design = 'Quadrature/index.md'
[../]
[./code-order-bump]
[]
[per-block-order-error]
type = RunException
input = 'block-order.i'
cli_args = 'Executioner/Quadrature/custom_orders=""'
expect_err = '\(Executioner/Quadrature/custom_orders\)\(size: 0\) are of different lengths'
requirement = "The system shall ensure that for per-block specified quadrature orders exactly "
"one order is given per specified block."
issues = '#24820'
design = 'Quadrature/index.md'
[]
[code-order-bump]
type = CSVDiff
input = 'code-order-bump.i'
csvdiff = 'code-order-bump_out.csv'

requirement = 'The system shall support the ability for objects to increase quadrature order'
' in code during runtime.'
requirement = "The system shall support the ability for objects to increase quadrature order in "
"code during runtime."
issues = '#14055'
design = 'Quadrature/index.md'
[../]
[./elem5_side7]
[]
[elem5_side7]
type = CSVDiff
input = 'elem5_side7.i'
csvdiff = 'elem5_side7_out.csv'

requirement = 'The system shall support the ability to control the'
' volumetric and side quadrature orders used for'
' numerical integration on the entire mesh.'
requirement = "The system shall support the ability to control the volumetric and side "
"quadrature orders used for numerical integration on the entire mesh."
issues = '#3380'
design = 'Quadrature/index.md'
[../]
[./material-bumps-block-order]
[]
[material-bumps-block-order]
type = CSVDiff
input = 'material_with_order.i'
csvdiff = 'material_with_order_out.csv'

requirement = 'The system shall support the ability to allow object code to increase'
' the quadrature order used for numerical integration on a per-block basis.'
requirement = "The system shall support the ability to allow object code to increase the "
"quadrature order used for numerical integration on a per-block basis."
issues = '#14055 #15072'
design = 'Quadrature/index.md'
[../]
[]
[]

0 comments on commit 067211e

Please sign in to comment.