Skip to content

Commit

Permalink
Do not add into vectors if they do not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
andrsd committed Jun 18, 2018
1 parent b20e3de commit cb837d3
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 3 deletions.
7 changes: 4 additions & 3 deletions framework/src/problems/DisplacedProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,10 @@ DisplacedProblem::addCachedResidual(THREAD_ID tid)
void
DisplacedProblem::addCachedResidualDirectly(NumericVector<Number> & residual, THREAD_ID tid)
{

_assembly[tid]->addCachedResidual(residual, _displaced_nl.timeVectorTag());
_assembly[tid]->addCachedResidual(residual, _displaced_nl.nonTimeVectorTag());
if (_displaced_nl.hasVector(_displaced_nl.timeVectorTag()))
_assembly[tid]->addCachedResidual(residual, _displaced_nl.timeVectorTag());
if (_displaced_nl.hasVector(_displaced_nl.nonTimeVectorTag()))
_assembly[tid]->addCachedResidual(residual, _displaced_nl.nonTimeVectorTag());
}

void
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[Mesh]
file = 2-lines.e
displacements = 'disp_x'
[]

[AuxVariables]
[./disp_x]
[../]
[]

[AuxKernels]
[./disp_x_ak]
type = ConstantAux
variable = disp_x
value = 1
[../]
[]

[Variables]
[./u]
[../]
[]

[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = 1
value = 1
[../]

[./right]
type = DirichletBC
variable = u
boundary = 4
value = 3
[../]
[]

[Constraints]
[./c1]
type = EqualValueNodalConstraint
variable = u
master = 0
slave = 4
penalty = 100000
use_displaced_mesh = true
[../]
[]

[Executioner]
type = Steady

solve_type = 'PJFNK'
[]

[Outputs]
exodus = true
[]
8 changes: 8 additions & 0 deletions test/tests/constraints/nodal_constraint/tests
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@
max_parallel = 1
max_threads = 1 #6511
[../]

[./displaced_test]
type = 'Exodiff'
input = 'nodal_constraint_displaced_test.i'
exodiff = 'nodal_constraint_displaced_test_out.e'
max_parallel = 1
max_threads = 1 #6511
[../]
[]

0 comments on commit cb837d3

Please sign in to comment.