Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow auxiliary variables for FE IKs #28978

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/doc/content/source/timeintegrators/Ralston.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ All kernels except time-(derivative)-kernels should have the parameter `implicit
time integrator.

!alert warning
ExplicitRK2-derived TimeIntegrators [ExplicitMidpoint.md], [Heun.md], [Ralston.md]) and other multistage
ExplicitRK2-derived TimeIntegrators ([ExplicitMidpoint.md], [Heun.md], [Ralston.md]) and other multistage
TimeIntegrators are known not to work with Materials/AuxKernels that accumulate 'state' and
should be used with caution.

Expand Down
7 changes: 7 additions & 0 deletions framework/src/interfacekernels/InterfaceKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Assembly.h"
#include "MooseVariableFE.h"
#include "SystemBase.h"
#include "AuxiliarySystem.h"

#include "libmesh/quadrature.h"

Expand Down Expand Up @@ -56,8 +57,14 @@ InterfaceKernelTempl<T>::InterfaceKernelTempl(const InputParameters & parameters
_grad_test_neighbor(_neighbor_var.gradPhiFaceNeighbor())

{
// Neighbor variable dependency is added by
// NeighborCoupleableMooseVariableDependencyIntermediateInterface
addMooseVariableDependency(this->mooseVariable());

// Disallow auxiliary variables for neighbor variables
if (_fe_problem.getAuxiliarySystem().hasVariable(_neighbor_var.name()))
paramError("neighbor_var", "Auxiliary variables may not be used as the neighbor variable");

if (!parameters.isParamValid("boundary"))
mooseError(
"In order to use an interface kernel, you must specify a boundary where it will live.");
Expand Down
3 changes: 1 addition & 2 deletions framework/src/interfacekernels/InterfaceKernelBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ InterfaceKernelBase::validParams()
"length as diag_save_in. This vector specifies whether the corresponding aux_var should "
"save-in jacobian contributions from the primary ('p') or secondary side ('s').");
params.addParamNamesToGroup("diag_save_in save_in save_in_var_side diag_save_in_var_side",
"Advanced");
"Residual and Jacobian debug output");

// InterfaceKernels always need one layer of ghosting.
params.addRelationshipManager("ElementSideNeighborLayers",
Expand Down Expand Up @@ -98,7 +98,6 @@ InterfaceKernelBase::InterfaceKernelBase(const InputParameters & parameters)
_save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
_diag_save_in_var_side(parameters.get<MultiMooseEnum>("diag_save_in_var_side")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in"))

{
}

Expand Down
6 changes: 3 additions & 3 deletions framework/src/userobjects/PropertyReadFile.C
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ PropertyReadFile::getElementData(const Elem * elem, unsigned int prop_num) const
jelem,
" greater than than total number of element in mesh: ",
_mesh.nElem(),
". Elements should be numbered consecutively.");
". Elements should be numbered consecutively, and ids should start from 0.");
return _reader.getData(jelem)[prop_num];
}

Expand All @@ -316,7 +316,7 @@ PropertyReadFile::getNodeData(const Node * const node, const unsigned int prop_n
jnode,
" greater than than total number of nodes in mesh: ",
_mesh.nNodes(),
". Nodes should be numbered consecutively.");
". Nodes should be numbered consecutively, with ids starting from 0.");
return _reader.getData(jnode)[prop_num];
}

Expand All @@ -334,7 +334,7 @@ PropertyReadFile::getBlockData(const Elem * elem, unsigned int prop_num) const
elem_subdomain_id,
" greater than than total number of blocks in mesh: ",
_nblock,
". Blocks should be numbered consecutively.");
". Blocks should be numbered consecutively, starting from 0.");
return _reader.getData(elem_subdomain_id - offset)[prop_num];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ must be provided:
- `splitting = effective_thermal_conductivity`, `locality = global`: `average_kappa` and `average_kappa_solid` postprocessors,
as well as `average_eps` postprocessor due to internal representation of $\kappa_f$ as $\epsilon\tilde{\kappa}_f$.

! alert note
!alert note
To protect against cases where at the first time step
the thermal conductivity or effective thermal conductivity might not have yet
been initialized, or cases where the coupled postprocessors have not yet been
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where $\boldsymbol{x}_{n+1}$ is the position vector of materials points in
$\kappa_{n+1}$, and $\boldsymbol{x}_{n}$ is the position vector of materials
points in $\kappa_{n}$.

alert note title=Incremental vs Total Deformation Gradient
!alert note title=Incremental vs Total Deformation Gradient
Note that $\hat{\boldsymbol{F}}$ is NOT the deformation gradient, but rather the
incremental deformation gradient of $\kappa_{n+1}$ with respect to $\kappa_n$.
Thus $\hat{\boldsymbol{F}} = \boldsymbol{F}_{n+1} \boldsymbol{F}_n^{-1}$, where
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[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]
type = SideSetsBetweenSubdomainsGenerator
input = 'subdomain1'
primary_block = '0'
paired_block = '1'
new_boundary = 'primary0_interface'
[]
[]

[Variables]
[u]
order = FIRST
family = LAGRANGE
block = '0'
[]
[]

[AuxVariables]
[v]
order = FIRST
family = LAGRANGE
block = '1'
[]
[]

[Kernels]
[diff_u]
type = MatDiffusion
variable = u
block = '0'
diffusivity = D
[]
[]

[InterfaceKernels]
[interface]
type = InterfaceDiffusion
variable = u
neighbor_var = 'v'
boundary = 'primary0_interface'
D = D
D_neighbor = D
[]
[]

[Materials]
[block0]
type = GenericConstantMaterial
block = '0'
prop_names = 'D'
prop_values = '4'
[]
[block1]
type = GenericConstantMaterial
block = '1'
prop_names = 'D'
prop_values = '2'
[]
[]

[Executioner]
type = Steady
solve_type = PJFNK
nl_rel_tol = 1e-10
[]

[Problem]
kernel_coverage_check = false
[]
10 changes: 10 additions & 0 deletions test/tests/interfacekernels/auxiliary_variables/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Tests]
design = 'InterfaceKernels/index.md'
[no_aux]
type = RunException
input = 'reaction_1D_steady.i'
expect_err = 'Auxiliary variables may not be used as the neighbor variable'
requirement = 'The system shall error if the error attempts to use an auxiliary variable as the neighbor variable in an interface kernel.'
issues = '#28977'
[]
[]