Skip to content

Commit

Permalink
Add ghosting to pass the boundary test for block material
Browse files Browse the repository at this point in the history
Ideally, we would use a postprocessor that currently does not have an issue with insufficient
ghosting when used on its own, see idaholab#19534. But I dont think there is one that will trigger
the ghosting we want. I could admittedly make a new one, which would be a rework of SideAverageMaterialProperty,
but it could make that one confusing.

Use MatpropName and FunctorName instead of strings for parameters for the AD converters
Refs idaholab#19420
  • Loading branch information
GiudGiud committed Dec 4, 2021
1 parent 2ebfde4 commit 760c5bb
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
19 changes: 10 additions & 9 deletions framework/src/materials/FunctorADConverter.C
Expand Up @@ -21,24 +21,25 @@ FunctorADConverterTempl<T>::validParams()
InputParameters params = FunctorMaterial::validParams();
params.addClassDescription("Converts regular functors to AD functors and "
" AD functors to regular functors");
params.addParam<std::vector<std::string>>(
params.addParam<std::vector<MooseFunctorName>>(
"reg_props_in", "The names of the regular functors to convert to AD functors");
params.addParam<std::vector<std::string>>("ad_props_out", "The names of the output AD functors");
params.addParam<std::vector<std::string>>(
params.addParam<std::vector<MooseFunctorName>>("ad_props_out",
"The names of the output AD functors");
params.addParam<std::vector<MooseFunctorName>>(
"ad_props_in", "The names of the AD functors to convert to regular functors");
params.addParam<std::vector<std::string>>("reg_props_out",
"The names of the output regular functors");
params.addParam<std::vector<MooseFunctorName>>("reg_props_out",
"The names of the output regular functors");
return params;
}

template <typename T>
FunctorADConverterTempl<T>::FunctorADConverterTempl(const InputParameters & parameters)
: FunctorMaterial(parameters)
{
auto reg_props_in = getParam<std::vector<std::string>>("reg_props_in");
auto ad_props_out = getParam<std::vector<std::string>>("ad_props_out");
auto ad_props_in = getParam<std::vector<std::string>>("ad_props_in");
auto reg_props_out = getParam<std::vector<std::string>>("reg_props_out");
auto reg_props_in = getParam<std::vector<MooseFunctorName>>("reg_props_in");
auto ad_props_out = getParam<std::vector<MooseFunctorName>>("ad_props_out");
auto ad_props_in = getParam<std::vector<MooseFunctorName>>("ad_props_in");
auto reg_props_out = getParam<std::vector<MooseFunctorName>>("reg_props_out");

// Check input sizes
if (reg_props_in.size() != ad_props_out.size())
Expand Down
20 changes: 10 additions & 10 deletions framework/src/materials/MaterialADConverter.C
Expand Up @@ -33,14 +33,14 @@ MaterialADConverterTempl<T>::validParams()
InputParameters params = Material::validParams();
params.addClassDescription(
"Converts regular material properties to AD properties and vice versa");
params.addParam<std::vector<std::string>>(
params.addParam<std::vector<MaterialPropertyName>>(
"reg_props_in", "The names of the regular material properties to convert to AD properties");
params.addParam<std::vector<std::string>>("ad_props_out",
"The names of the output AD properties");
params.addParam<std::vector<std::string>>(
params.addParam<std::vector<MaterialPropertyName>>("ad_props_out",
"The names of the output AD properties");
params.addParam<std::vector<MaterialPropertyName>>(
"ad_props_in", "The names of the AD material properties to convert to regular properties");
params.addParam<std::vector<std::string>>("reg_props_out",
"The names of the output regular properties");
params.addParam<std::vector<MaterialPropertyName>>("reg_props_out",
"The names of the output regular properties");
params.addParam<bool>(
"intra_convert", false, "Whether to allow intra conversion, e.g. regular->regular, ad->ad");
return params;
Expand All @@ -50,10 +50,10 @@ template <typename T>
MaterialADConverterTempl<T>::MaterialADConverterTempl(const InputParameters & parameters)
: Material(parameters), _intra_convert(getParam<bool>("intra_convert"))
{
auto reg_props_in = getParam<std::vector<std::string>>("reg_props_in");
auto ad_props_out = getParam<std::vector<std::string>>("ad_props_out");
auto ad_props_in = getParam<std::vector<std::string>>("ad_props_in");
auto reg_props_out = getParam<std::vector<std::string>>("reg_props_out");
auto reg_props_in = getParam<std::vector<MaterialPropertyName>>("reg_props_in");
auto ad_props_out = getParam<std::vector<MaterialPropertyName>>("ad_props_out");
auto ad_props_in = getParam<std::vector<MaterialPropertyName>>("ad_props_in");
auto reg_props_out = getParam<std::vector<MaterialPropertyName>>("reg_props_out");

if (_intra_convert)
{
Expand Down
Binary file modified test/tests/materials/piecewise_by_block_material/gold/test_out.e
Binary file not shown.
20 changes: 20 additions & 0 deletions test/tests/materials/piecewise_by_block_material/test.i
Expand Up @@ -21,6 +21,21 @@
[]
[]

[Variables]
[dummy]
type = MooseVariableFVReal
[]
[]

# This is added to have sufficient ghosting layers, see #19534
[FVKernels]
[diff]
type = FVDiffusion
variable = 'dummy'
coeff = 1
[]
[]

[AuxVariables]
[u]
type = MooseVariableFVReal
Expand Down Expand Up @@ -80,4 +95,9 @@

[Outputs]
exodus = true
# To get level of ghosting
[console]
type = Console
system_info = 'framework mesh aux nonlinear execution relationship'
[]
[]
1 change: 1 addition & 0 deletions test/tests/materials/piecewise_by_block_material/tests
Expand Up @@ -6,6 +6,7 @@
exodiff = test_out.e
requirement = 'The system shall provide a material object that can, for a single material property, map subdomain IDs to a possibly discontinuous property value.'
design = 'PiecewiseConstantByBlockMaterial.md'
ad_indexing_type = 'global'
[]
[functor]
type = Exodiff
Expand Down

0 comments on commit 760c5bb

Please sign in to comment.