Skip to content

Commit

Permalink
Merge pull request #25805 from lindsayad/dont-couple-disps-without-be…
Browse files Browse the repository at this point in the history
…ing-asked

Don't auto-set displacement parameter in kernels/bcs
  • Loading branch information
lindsayad authored Oct 23, 2023
2 parents 5e3df8f + a745b32 commit f1e4bf9
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 12 deletions.
6 changes: 0 additions & 6 deletions framework/src/kernels/ADKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ ADKernelTempl<T>::ADKernelTempl(const InputParameters & parameters)
}

_has_diag_save_in = _diag_save_in.size() > 0;

if (_use_displaced_mesh && _displacements.empty())
mooseError("ADKernel ",
name(),
"has been asked to act on the displaced mesh, but no displacements have been "
"coupled in. Your Jacobian will be wrong without that coupling");
}

template <typename T>
Expand Down
6 changes: 0 additions & 6 deletions framework/src/problems/FEProblemBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -2455,9 +2455,6 @@ FEProblemBase::addKernel(const std::string & kernel_name,
{
parameters.set<SubProblem *>("_subproblem") = _displaced_problem.get();
parameters.set<SystemBase *>("_sys") = &_displaced_problem->nlSys(nl_sys_num);
const auto & disp_names = _displaced_problem->getDisplacementVarNames();
parameters.set<std::vector<VariableName>>("displacements") =
std::vector<VariableName>(disp_names.begin(), disp_names.end());
_reinit_displaced_elem = true;
}
else
Expand Down Expand Up @@ -2558,9 +2555,6 @@ FEProblemBase::addBoundaryCondition(const std::string & bc_name,
{
parameters.set<SubProblem *>("_subproblem") = _displaced_problem.get();
parameters.set<SystemBase *>("_sys") = &_displaced_problem->nlSys(nl_sys_num);
const auto & disp_names = _displaced_problem->getDisplacementVarNames();
parameters.set<std::vector<VariableName>>("displacements") =
std::vector<VariableName>(disp_names.begin(), disp_names.end());
_reinit_displaced_face = true;
}
else
Expand Down
60 changes: 60 additions & 0 deletions test/tests/misc/block-restricted-disps/test.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[Mesh]
[gen]
type = GeneratedMeshGenerator
xmax = 1.5
dim = 1
nx = 3
[]
[sub1]
type = SubdomainBoundingBoxGenerator
bottom_left = '0.5 0 0'
top_right = '1 1 0'
block_id = 1
input = gen
[]
[sub2]
type = SubdomainBoundingBoxGenerator
bottom_left = '1 0 0'
top_right = '1.5 1 0'
block_id = 2
input = sub1
[]
displacements = 'disp_x'
[]

[Variables]
[u][]
[]

[AuxVariables]
[disp_x]
block = 1
[]
[]

[Kernels]
[diff]
type = Diffusion
variable = u
use_displaced_mesh = true
[]
[]

[BCs]
[left]
type = DirichletBC
variable = u
value = 0
boundary = left
[]
[right]
type = DirichletBC
variable = u
value = 1
boundary = right
[]
[]

[Executioner]
type = Steady
[]
9 changes: 9 additions & 0 deletions test/tests/misc/block-restricted-disps/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Tests]
design = 'DisplacedProblem.md'
issues = '#25804'
[run]
type = RunApp
input = test.i
requirement = 'The system shall be able to run a kernel on the displaced mesh with blocks that are a superset of the displacement variable blocks.'
[]
[]

0 comments on commit f1e4bf9

Please sign in to comment.