Skip to content

Commit

Permalink
Protect against failed point inversions due to interface kernels
Browse files Browse the repository at this point in the history
Or at least we should not try to invert physical points related to
interface kernels unless we actually have a displaced interface kernel
in our system

Closes idaholab#18175
  • Loading branch information
lindsayad committed Jul 1, 2021
1 parent 2d7a48e commit 1e1b24b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
12 changes: 12 additions & 0 deletions framework/doc/content/syntax/InterfaceKernels/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ Interface kernels can be used to provide any general flux condition at an interf
- `neighbor_var`: The "secondary" variable. This could be $c_1$ from our example above.
- `boundary`: The interfacial boundary between the subdomains. Note that this must be a sideset and again must exist on the same subdomain as the primary variable. The fact that this boundary is a sideset allows access to variable gradients.

An important private parameter relevant to displaced mesh calculations is
`_use_undisplaced_reference_points`. If an interface kernel developer sets this
parameter to `true` in the `validParams` of their derived class, then the
displaced problem will use the neighbor reference points computed by the
undisplaced problem as the neighbor reference points for the displaced
problem. If this parameter is `false` (the default), then the neighbor reference
points on the displaced problem will be computed in the traditional way: by
doing an inverse map of the physical locations of the displaced +element+
reference points. Here, reference refers to the reference coordinates
(e.g. $\xi$ and $\eta$) of the quadrature points and physical refers to the
physical coordinates (e.g. $x$ and $y$) of the quadrature points.

For additional information about the interface kernel system, don't hesitate to contact the [MOOSE Discussion forum](https://github.com/idaholab/moose/discussions).

!syntax list /InterfaceKernels objects=True actions=False subsystems=False
Expand Down
4 changes: 4 additions & 0 deletions framework/include/problems/FEProblemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2120,8 +2120,12 @@ class FEProblemBase : public SubProblem, public Restartable
GeometricSearchData _geometric_search_data;
MortarData _mortar_data;

/// Whether to call DisplacedProblem::reinitElem when this->reinitElem is called
bool _reinit_displaced_elem;
/// Whether to call DisplacedProblem::reinitElemFace when this->reinitElemFace is called
bool _reinit_displaced_face;
/// Whether to call DisplacedProblem::reinitNeighbor when this->reinitNeighbor is called
bool _reinit_displaced_neighbor;

/// whether input file has been written
bool _input_file_saved;
Expand Down
24 changes: 17 additions & 7 deletions framework/src/problems/FEProblemBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ FEProblemBase::FEProblemBase(const InputParameters & parameters)
_mortar_data(*this),
_reinit_displaced_elem(false),
_reinit_displaced_face(false),
_reinit_displaced_neighbor(false),
_input_file_saved(false),
_has_dampers(false),
_has_constraints(false),
Expand Down Expand Up @@ -1326,7 +1327,11 @@ FEProblemBase::prepare(const Elem * elem, THREAD_ID tid)
if (_has_nonlocal_coupling && _currently_computing_jacobian)
_assembly[tid]->prepareNonlocal();

if (_displaced_problem && (_reinit_displaced_elem || _reinit_displaced_face))
if (_displaced_problem &&
// _reinit_displaced_neighbor applies to interface type objects which will do computations
// based on both elem and neighbor. Consequently, despite what you might think by its name, we
// must make sure we prepare the displaced elem
(_reinit_displaced_elem || _reinit_displaced_face || _reinit_displaced_neighbor))
{
_displaced_problem->prepare(_displaced_mesh->elemPtr(elem->id()), tid);
if (_has_nonlocal_coupling)
Expand Down Expand Up @@ -1380,7 +1385,8 @@ FEProblemBase::setCurrentSubdomainID(const Elem * elem, THREAD_ID tid)
{
SubdomainID did = elem->subdomain_id();
_assembly[tid]->setCurrentSubdomainID(did);
if (_displaced_problem && (_reinit_displaced_elem || _reinit_displaced_face))
if (_displaced_problem &&
(_reinit_displaced_elem || _reinit_displaced_face || _reinit_displaced_neighbor))
_displaced_problem->assembly(tid).setCurrentSubdomainID(did);
}

Expand All @@ -1389,7 +1395,8 @@ FEProblemBase::setNeighborSubdomainID(const Elem * elem, unsigned int side, THRE
{
SubdomainID did = elem->neighbor_ptr(side)->subdomain_id();
_assembly[tid]->setCurrentNeighborSubdomainID(did);
if (_displaced_problem && (_reinit_displaced_elem || _reinit_displaced_face))
if (_displaced_problem &&
(_reinit_displaced_elem || _reinit_displaced_face || _reinit_displaced_neighbor))
_displaced_problem->assembly(tid).setCurrentNeighborSubdomainID(did);
}

Expand All @@ -1398,7 +1405,8 @@ FEProblemBase::setNeighborSubdomainID(const Elem * elem, THREAD_ID tid)
{
SubdomainID did = elem->subdomain_id();
_assembly[tid]->setCurrentNeighborSubdomainID(did);
if (_displaced_problem && (_reinit_displaced_elem || _reinit_displaced_face))
if (_displaced_problem &&
(_reinit_displaced_elem || _reinit_displaced_face || _reinit_displaced_neighbor))
_displaced_problem->assembly(tid).setCurrentNeighborSubdomainID(did);
}

Expand Down Expand Up @@ -1919,7 +1927,7 @@ FEProblemBase::reinitNeighbor(const Elem * elem, unsigned int side, THREAD_ID ti
_nl->reinitNeighborFace(neighbor, neighbor_side, bnd_id, tid);
_aux->reinitNeighborFace(neighbor, neighbor_side, bnd_id, tid);

if (_displaced_problem && _reinit_displaced_face)
if (_displaced_problem && _reinit_displaced_neighbor)
{
// There are cases like for cohesive zone modeling without significant sliding where we cannot
// use FEInterface::inverse_map in Assembly::reinitElemAndNeighbor in the displaced problem
Expand Down Expand Up @@ -2821,7 +2829,7 @@ FEProblemBase::addInterfaceKernel(const std::string & interface_kernel_name,
{
parameters.set<SubProblem *>("_subproblem") = _displaced_problem.get();
parameters.set<SystemBase *>("_sys") = &_displaced_problem->nlSys();
_reinit_displaced_face = true;
_reinit_displaced_neighbor = true;

if (use_undisplaced_reference_points)
{
Expand Down Expand Up @@ -3494,9 +3502,11 @@ FEProblemBase::addUserObject(const std::string & user_object_name,
{
if (euo || nuo)
_reinit_displaced_elem = true;
else if (suo || iuo)
else if (suo)
// shouldn't we add isuo
_reinit_displaced_face = true;
else if (iuo)
_reinit_displaced_neighbor = true;
}

if (guo && !tguo)
Expand Down

0 comments on commit 1e1b24b

Please sign in to comment.