www.mooseframework.org
ComputeNodalDampingThread.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
17 #include "NonlinearSystem.h"
18 #include "Problem.h"
19 #include "NodalDamper.h"
20 
21 #include "libmesh/threads.h"
22 
24  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(feproblem),
25  _damping(1.0),
26  _nl(feproblem.getNonlinearSystemBase()),
27  _nodal_dampers(_nl.getNodalDamperWarehouse())
28 {
29 }
30 
31 // Splitting Constructor
33  Threads::split split)
34  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(x, split),
35  _damping(1.0),
36  _nl(x._nl),
38 {
39 }
40 
42 
43 void
44 ComputeNodalDampingThread::onNode(ConstNodeRange::const_iterator & node_it)
45 {
46  const Node * node = *node_it;
48 
49  std::set<MooseVariable *> damped_vars;
50 
51  const auto & ndampers = _nl.getNodalDamperWarehouse().getActiveObjects(_tid);
52  for (const auto & damper : ndampers)
53  damped_vars.insert(damper->getVariable());
54 
56 
57  const auto & objects = _nodal_dampers.getActiveObjects(_tid);
58  for (const auto & obj : objects)
59  {
60  Real cur_damping = obj->computeDamping();
61  obj->checkMinDamping(cur_damping);
62  if (cur_damping < _damping)
63  _damping = cur_damping;
64  }
65 }
66 
67 Real
69 {
70  return _damping;
71 }
72 
73 void
75 {
76  if (y._damping < _damping)
77  _damping = y._damping;
78 }
void join(const ComputeNodalDampingThread &y)
static PetscErrorCode Vec x
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
ComputeNodalDampingThread(FEProblemBase &feproblem)
virtual void onNode(ConstNodeRange::const_iterator &node_it) override
Called for each node.
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse()
void reinitIncrementAtNodeForDampers(THREAD_ID tid, const std::set< MooseVariable * > &damped_vars)
Compute the incremental change in variables at nodes for dampers.
virtual void reinitNode(const Node *node, THREAD_ID tid) override
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...