From 2023494f3ec0e2f3f656e5757d57d627d94491e8 Mon Sep 17 00:00:00 2001 From: "Joshua E. Hansel" Date: Wed, 23 Aug 2023 10:02:47 -0500 Subject: [PATCH] Used functor point in ParsedFunctorMaterial Refs #24380 --- .../src/functormaterials/ParsedFunctorMaterial.C | 9 ++++----- .../gold/parsed_functor_material_out.csv | 2 ++ .../parsed_functor_material/parsed_functor_material.i | 4 +++- .../functormaterials/parsed_functor_material/tests | 11 +++++++++++ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 test/tests/functormaterials/parsed_functor_material/gold/parsed_functor_material_out.csv create mode 100644 test/tests/functormaterials/parsed_functor_material/tests diff --git a/framework/src/functormaterials/ParsedFunctorMaterial.C b/framework/src/functormaterials/ParsedFunctorMaterial.C index 5eba83ed80bf..8d7258552430 100644 --- a/framework/src/functormaterials/ParsedFunctorMaterial.C +++ b/framework/src/functormaterials/ParsedFunctorMaterial.C @@ -75,14 +75,13 @@ ParsedFunctorMaterialTempl::ParsedFunctorMaterialTempl(const InputParamet _func_params[i] = (*_functors[i])(r, t); // Store the space and time values - // TODO: find some way to extract x,y,z from r. getPoint(r) does not exist yet. - // const auto r_point = getPoint(r); - _func_params[_n_functors] = 0; + const auto r_point = r.getPoint(); + _func_params[_n_functors] = r_point(0); #if LIBMESH_DIM > 1 - _func_params[_n_functors + 1] = 0; + _func_params[_n_functors + 1] = r_point(1); #endif #if LIBMESH_DIM > 2 - _func_params[_n_functors + 2] = 0; + _func_params[_n_functors + 2] = r_point(2); #endif _func_params[_n_functors + LIBMESH_DIM] = getTime(t); diff --git a/test/tests/functormaterials/parsed_functor_material/gold/parsed_functor_material_out.csv b/test/tests/functormaterials/parsed_functor_material/gold/parsed_functor_material_out.csv new file mode 100644 index 000000000000..12f54b11d77c --- /dev/null +++ b/test/tests/functormaterials/parsed_functor_material/gold/parsed_functor_material_out.csv @@ -0,0 +1,2 @@ +time,get_prop1 +0,71.859874482049 diff --git a/test/tests/functormaterials/parsed_functor_material/parsed_functor_material.i b/test/tests/functormaterials/parsed_functor_material/parsed_functor_material.i index 07bdf4ea0a24..fae1ede02f27 100644 --- a/test/tests/functormaterials/parsed_functor_material/parsed_functor_material.i +++ b/test/tests/functormaterials/parsed_functor_material/parsed_functor_material.i @@ -35,11 +35,12 @@ [Postprocessors] # The value should be: - # 5 + 3^2 + 2 + pi + e + 4 + 3 + 4.5 + 7.5 = 40.85987448204884 + # 5 * 3^2 + 2 + pi + e + 4 + 3 + 4.5 + 7.5 = 71.85987448204884 [get_prop1] type = ElementExtremeFunctorValue functor = prop1 value_type = max + execute_on = 'INITIAL' [] [] @@ -54,4 +55,5 @@ [Outputs] csv = true + execute_on = 'INITIAL' [] diff --git a/test/tests/functormaterials/parsed_functor_material/tests b/test/tests/functormaterials/parsed_functor_material/tests new file mode 100644 index 000000000000..f5366e1c08dd --- /dev/null +++ b/test/tests/functormaterials/parsed_functor_material/tests @@ -0,0 +1,11 @@ +[Tests] + issues = '#24380' + design = 'ParsedFunctorMaterial.md' + + [test] + type = CSVDiff + input = parsed_functor_material.i + csvdiff = parsed_functor_material_out.csv + requirement = 'The system shall be able to parse an expression of functors to compute a functor material property.' + [] +[]