From 4f8138b22992cc666fe957ff0ab9f5954c053f2e Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Thu, 18 Jan 2024 20:00:04 -0800 Subject: [PATCH] Add test refs #26592 --- .../doc/content/syntax/AuxKernels/index.md | 17 ++- framework/src/auxkernels/AuxKernel.C | 10 +- .../lower_d_var/gold/lower-d-aux-var_out.csv | 3 + .../auxkernels/lower_d_var/lower-d-aux-var.i | 141 ++++++++++++++++++ test/tests/auxkernels/lower_d_var/tests | 10 ++ 5 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 test/tests/auxkernels/lower_d_var/gold/lower-d-aux-var_out.csv create mode 100644 test/tests/auxkernels/lower_d_var/lower-d-aux-var.i create mode 100644 test/tests/auxkernels/lower_d_var/tests diff --git a/framework/doc/content/syntax/AuxKernels/index.md b/framework/doc/content/syntax/AuxKernels/index.md index a04a07dd8f98..0a9c77ab6b24 100644 --- a/framework/doc/content/syntax/AuxKernels/index.md +++ b/framework/doc/content/syntax/AuxKernels/index.md @@ -67,12 +67,12 @@ is done to allow the syntax to be consistent regardless of the AuxKernel flavor: In order to compute properties in the mortar sense, it is necessary to loop over the mortar segment mesh to spatially integrate variables. `MortarNodalAuxKernel`s offer this functionality where these "weighted" variables, -which intervene in the computation of contact constraints and their residuals, can be coupled to generate the desired output value. -Therefore, if postprocessing of mortar quantities is required, nodal mortar auxiliary kernels can be employed. +which intervene in the computation of contact constraints and their residuals, can be coupled to generate the desired output value. +Therefore, if postprocessing of mortar quantities is required, nodal mortar auxiliary kernels can be employed. Objects inheriting from `MortarNodalAuxKernel` allow for said operations on the mortar lower-dimensional domains featuring similar functionality to other nodal auxiliary kernels, including the possibility of computing quantities in an `incremental` manner. - + ## Execute Flags AuxKernel objects inherit from the [SetupInterface.md] so they include the "execute_on" variable. @@ -88,6 +88,17 @@ execution of a simulation. In this case, the `EXEC_LINEAR` flag should be remove `EXEC_INITIAL` flag should be added to perform the auxiliary variable calculation during the initial setup phase as well. +## Populating lower-dimensional auxiliary variables + +Lower-dimensional auxiliary variables may be populated using boundary restricted +auxiliary kernels. The boundary restriction of the aux kernel should be +coincident with (a subset of) the lower-dimensional blocks that the +lower-dimensional variable lives on. Using a boundary restricted auxiliary +kernel as opposed to a lower-d block-restricted auxiliary kernel (which is not +supported) allows pulling +in coincident face evaluations of higher-dimensional variables and material +properties as well as evaluations of coupled lower-dimensional variables. + ## Example A: Post processing with AuxKernel The following example is extracted from step 4 of the diff --git a/framework/src/auxkernels/AuxKernel.C b/framework/src/auxkernels/AuxKernel.C index c397a7a603d6..5e8a20e26708 100644 --- a/framework/src/auxkernels/AuxKernel.C +++ b/framework/src/auxkernels/AuxKernel.C @@ -351,14 +351,16 @@ AuxKernelTempl::compute() _local_ke.resize(_n_local_dofs, _n_local_dofs); _local_ke.zero(); + const auto & test = _lower_d_calc ? _var.phiLower() : _test; + // assemble the local mass matrix and the load - for (unsigned int i = 0; i < _test.size(); i++) + for (unsigned int i = 0; i < test.size(); i++) for (_qp = 0; _qp < _qrule->n_points(); _qp++) { - ComputeValueType t = _JxW[_qp] * _coord[_qp] * _test[i][_qp]; + ComputeValueType t = _JxW[_qp] * _coord[_qp] * test[i][_qp]; _local_re(i) += t * computeValue(); - for (unsigned int j = 0; j < _test.size(); j++) - _local_ke(i, j) += t * _test[j][_qp]; + for (unsigned int j = 0; j < test.size(); j++) + _local_ke(i, j) += t * test[j][_qp]; } // mass matrix is always SPD but in case of boundary restricted, it will be rank deficient _local_sol.resize(_n_local_dofs); diff --git a/test/tests/auxkernels/lower_d_var/gold/lower-d-aux-var_out.csv b/test/tests/auxkernels/lower_d_var/gold/lower-d-aux-var_out.csv new file mode 100644 index 000000000000..45fb09532b6c --- /dev/null +++ b/test/tests/auxkernels/lower_d_var/gold/lower-d-aux-var_out.csv @@ -0,0 +1,3 @@ +time,avg_lower_constant_bottom,avg_lower_constant_left,avg_lower_constant_right,avg_lower_constant_top,avg_lower_first_bottom,avg_lower_first_left,avg_lower_first_right,avg_lower_first_top +0,0,0,0,0,0,0,0,0 +1,0.5,0.5,1.5,1.5,0.5,0.5,1.5,1.5 diff --git a/test/tests/auxkernels/lower_d_var/lower-d-aux-var.i b/test/tests/auxkernels/lower_d_var/lower-d-aux-var.i new file mode 100644 index 000000000000..a92361d54290 --- /dev/null +++ b/test/tests/auxkernels/lower_d_var/lower-d-aux-var.i @@ -0,0 +1,141 @@ +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + nx = 10 + ny = 10 + [] + [lower_left] + type = LowerDBlockFromSidesetGenerator + input = gen + sidesets = 'left' + new_block_name = 'lower_left' + [] + [lower_right] + type = LowerDBlockFromSidesetGenerator + input = lower_left + sidesets = 'right' + new_block_name = 'lower_right' + [] + [lower_top] + type = LowerDBlockFromSidesetGenerator + input = lower_right + sidesets = 'top' + new_block_name = 'lower_top' + [] + [lower_bottom] + type = LowerDBlockFromSidesetGenerator + input = lower_top + sidesets = 'bottom' + new_block_name = 'lower_bottom' + [] +[] + +[Problem] + solve = false +[] + +[AuxVariables] + [lower_constant] + family = MONOMIAL + order = CONSTANT + block = 'lower_top lower_right lower_bottom lower_left' + [] + [lower_first] + family = MONOMIAL + order = FIRST + block = 'lower_top lower_right lower_bottom lower_left' + [] + [higher] + family = MONOMIAL + order = CONSTANT + block = '0' + [] +[] + +[AuxKernels] + [lower_constant] + type = MaterialRealAux + property = 'prop' + variable = lower_constant + boundary = 'top bottom right left' + [] + [lower_first] + type = MaterialRealAux + property = 'prop' + variable = lower_first + boundary = 'top bottom right left' + [] + [higher] + type = MaterialRealAux + property = 'prop' + variable = higher + block = 0 + [] +[] + +[Functions] + [func] + type = ParsedFunction + expression = 'x + y' + [] +[] + +[Materials] + [func] + type = GenericFunctionMaterial + prop_names = 'prop' + prop_values = 'func' + [] +[] + +[Outputs] + csv = true +[] + +[Executioner] + type = Steady +[] + +[Postprocessors] + [avg_lower_constant_left] + type = ElementAverageValue + variable = lower_constant + block = lower_left + [] + [avg_lower_first_left] + type = ElementAverageValue + variable = lower_first + block = lower_left + [] + [avg_lower_constant_bottom] + type = ElementAverageValue + variable = lower_constant + block = lower_bottom + [] + [avg_lower_first_bottom] + type = ElementAverageValue + variable = lower_first + block = lower_bottom + [] + [avg_lower_constant_top] + type = ElementAverageValue + variable = lower_constant + block = lower_top + [] + [avg_lower_first_top] + type = ElementAverageValue + variable = lower_first + block = lower_top + [] + [avg_lower_constant_right] + type = ElementAverageValue + variable = lower_constant + block = lower_right + [] + [avg_lower_first_right] + type = ElementAverageValue + variable = lower_first + block = lower_right + [] +[] diff --git a/test/tests/auxkernels/lower_d_var/tests b/test/tests/auxkernels/lower_d_var/tests new file mode 100644 index 000000000000..d1c1a830ccf5 --- /dev/null +++ b/test/tests/auxkernels/lower_d_var/tests @@ -0,0 +1,10 @@ +[Tests] + design = 'AuxKernels/index.md' + issues = '#26592' + [csv] + type = CSVDiff + input = lower-d-aux-var.i + csvdiff = lower-d-aux-var_out.csv + requirement = 'The system shall allow populating lower-dimensional auxiliary variables using boundary restricted auxiliary kernels.' + [] +[]