Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad authored and subhendu-LANL committed Mar 12, 2024
1 parent 3c5a5c1 commit 4f8138b
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 7 deletions.
17 changes: 14 additions & 3 deletions framework/doc/content/syntax/AuxKernels/index.md
Expand Up @@ -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.
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions framework/src/auxkernels/AuxKernel.C
Expand Up @@ -351,14 +351,16 @@ AuxKernelTempl<ComputeValueType>::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);
Expand Down
@@ -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
141 changes: 141 additions & 0 deletions 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
[]
[]
10 changes: 10 additions & 0 deletions 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.'
[]
[]

0 comments on commit 4f8138b

Please sign in to comment.