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 test for converting vector functors refs idaholab#19420
- Loading branch information
Showing
3 changed files
with
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
[Mesh] | ||
[gen] | ||
type = GeneratedMeshGenerator | ||
dim = 1 | ||
nx = 10 | ||
xmax = 2 | ||
[] | ||
[subdomain1] | ||
input = gen | ||
type = SubdomainBoundingBoxGenerator | ||
bottom_left = '1.0 0 0' | ||
block_id = 1 | ||
top_right = '2.0 1.0 0' | ||
[] | ||
[interface] | ||
input = subdomain1 | ||
type = SideSetsBetweenSubdomainsGenerator | ||
primary_block = '0' | ||
paired_block = '1' | ||
new_boundary = 'primary0_interface' | ||
[] | ||
[] | ||
|
||
[Variables] | ||
[u] | ||
order = FIRST | ||
family = LAGRANGE_VEC | ||
initial_condition = 2 | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[v] | ||
order = FIRST | ||
family = MONOMIAL_VEC | ||
initial_condition = 3 | ||
[] | ||
[] | ||
|
||
[FunctorMaterials] | ||
[block0] | ||
type = GenericVectorFunctorMaterial | ||
block = '0' | ||
prop_names = 'D' | ||
prop_values = '4 3 2' | ||
[] | ||
[block1] | ||
type = GenericVectorFunctorMaterial | ||
block = '1' | ||
prop_names = 'D' | ||
prop_values = '2 1 0' | ||
[] | ||
[] | ||
|
||
[Materials] | ||
[convert_to_reg] | ||
type = VectorMaterialFunctorConverter | ||
functors_in = 'D u v' | ||
reg_props_out = 'm1 m3 m4' | ||
outputs = 'exo' | ||
[] | ||
[convert_to_ad] | ||
type = VectorMaterialFunctorConverter | ||
functors_in = 'D u v' | ||
ad_props_out = 'm1a m3a m4a' | ||
outputs = 'exo' | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = NEWTON | ||
[] | ||
|
||
[Problem] | ||
solve = false | ||
[] | ||
|
||
[Outputs] | ||
[exo] | ||
type = Exodus | ||
hide = 'u v' | ||
[] | ||
[] |
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 |
---|---|---|
@@ -1,11 +1,40 @@ | ||
[Tests] | ||
design = 'Materials/MaterialFunctorConverter.md' | ||
design = 'MaterialFunctorConverter.md' | ||
[scalar] | ||
type = 'Exodiff' | ||
input = 'conversion.i' | ||
exodiff = 'conversion_out.e' | ||
exodiff = 'conversion_exo.e' | ||
requirement = "The system shall be able to convert functors to regular (using automatic " | ||
"differentiation or not) material properties." | ||
issues = "#19420" | ||
[] | ||
# Note: Functions are declared as real functors, even functions that return a vector. | ||
# They are excluded from the conversions for now until we find a solution #24502 | ||
[vector] | ||
type = 'Exodiff' | ||
input = 'conversion_vec.i' | ||
exodiff = 'conversion_vec_exo.e' | ||
requirement = "The system shall be able to convert vector functors to regular vector material " | ||
"properties." | ||
issues = "#19420" | ||
[] | ||
|
||
[exception_checks] | ||
requirement = 'The system shall error' | ||
issues = '#19420' | ||
[ad_and_regular] | ||
type = RunException | ||
input = conversion.i | ||
cli_args = "Materials/convert_to_reg/ad_props_out='m1 m2 m3 m4'" | ||
expect_err = 'We dont support converting functors to both AD and regular material properties' | ||
detail = 'if the user requests conversions to both AD and regular material properties, as this is not supported,' | ||
[] | ||
[wrong_size] | ||
type = RunException | ||
input = conversion.i | ||
cli_args = "Materials/convert_to_reg/reg_props_out='m1 m2 m3'" | ||
expect_err = 'The number of output properties must match the number of input functors' | ||
detail = 'if the user inputs a different number of functors and material properties, as the conversion match one to one, and' | ||
[] | ||
[] | ||
[] |