www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
ComputeNodalDampingThread Class Reference

#include <ComputeNodalDampingThread.h>

Inheritance diagram for ComputeNodalDampingThread:
[legend]

Public Member Functions

 ComputeNodalDampingThread (FEProblemBase &feproblem)
 
 ComputeNodalDampingThread (ComputeNodalDampingThread &x, Threads::split split)
 
virtual ~ComputeNodalDampingThread ()
 
virtual void onNode (ConstNodeRange::const_iterator &node_it) override
 Called for each node. More...
 
void join (const ComputeNodalDampingThread &y)
 
Real damping ()
 
void operator() (const ConstNodeRange &range)
 
virtual void pre ()
 Called before the node range loop. More...
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void postNode (ConstNodeRange::const_iterator &node_it)
 Called after the node assembly is done (including surface assembling) More...
 
virtual void caughtMooseException (MooseException &e)
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing ()
 Whether or not the loop should continue. More...
 

Protected Attributes

Real _damping
 
NonlinearSystemBase_nl
 
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

Definition at line 24 of file ComputeNodalDampingThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalDampingThread() [1/2]

ComputeNodalDampingThread::ComputeNodalDampingThread ( FEProblemBase feproblem)

Definition at line 18 of file ComputeNodalDampingThread.C.

20  _damping(1.0),
21  _nl(feproblem.getNonlinearSystemBase()),
23 {
24 }
NonlinearSystemBase & getNonlinearSystemBase()
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse() const

◆ ComputeNodalDampingThread() [2/2]

ComputeNodalDampingThread::ComputeNodalDampingThread ( ComputeNodalDampingThread x,
Threads::split  split 
)

Definition at line 27 of file ComputeNodalDampingThread.C.

30  _damping(1.0),
31  _nl(x._nl),
32  _nodal_dampers(x._nodal_dampers)
33 {
34 }
static PetscErrorCode Vec x
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers

◆ ~ComputeNodalDampingThread()

ComputeNodalDampingThread::~ComputeNodalDampingThread ( )
virtual

Definition at line 36 of file ComputeNodalDampingThread.C.

36 {}

Member Function Documentation

◆ caughtMooseException()

virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::caughtMooseException ( MooseException e)
inlinevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Definition at line 55 of file ThreadedNodeLoop.h.

56  {
57  std::string what(e.what());
59  };
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception.

◆ damping()

Real ComputeNodalDampingThread::damping ( )

Definition at line 63 of file ComputeNodalDampingThread.C.

Referenced by NonlinearSystemBase::computeDamping().

64 {
65  return _damping;
66 }

◆ join()

void ComputeNodalDampingThread::join ( const ComputeNodalDampingThread y)

Definition at line 69 of file ComputeNodalDampingThread.C.

70 {
71  if (y._damping < _damping)
72  _damping = y._damping;
73 }

◆ keepGoing()

virtual bool ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::keepGoing ( )
inlinevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Definition at line 66 of file ThreadedNodeLoop.h.

66 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.

◆ onNode()

void ComputeNodalDampingThread::onNode ( ConstNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

Reimplemented from ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >.

Definition at line 39 of file ComputeNodalDampingThread.C.

40 {
41  const Node * node = *node_it;
43 
44  std::set<MooseVariable *> damped_vars;
45 
46  const auto & ndampers = _nl.getNodalDamperWarehouse().getActiveObjects(_tid);
47  for (const auto & damper : ndampers)
48  damped_vars.insert(damper->getVariable());
49 
51 
52  const auto & objects = _nodal_dampers.getActiveObjects(_tid);
53  for (const auto & obj : objects)
54  {
55  Real cur_damping = obj->computeDamping();
56  obj->checkMinDamping(cur_damping);
57  if (cur_damping < _damping)
58  _damping = cur_damping;
59  }
60 }
void reinitIncrementAtNodeForDampers(THREAD_ID tid, const std::set< MooseVariable *> &damped_vars)
Compute the incremental change in variables at nodes for dampers.
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...
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse() const
virtual void reinitNode(const Node *node, THREAD_ID tid) override

◆ operator()()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::operator() ( const ConstNodeRange &  range)
inherited

Definition at line 88 of file ThreadedNodeLoop.h.

89 {
90  try
91  {
92  ParallelUniqueId puid;
93  _tid = puid.id;
94 
95  pre();
96 
97  for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
98  {
99  if (!keepGoing())
100  break;
101 
102  onNode(nd);
103 
104  postNode(nd);
105  }
106 
107  post();
108  }
109  catch (MooseException & e)
110  {
112  }
113 }
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.
virtual bool keepGoing()
Whether or not the loop should continue.
Provides a way for users to bail out of the current solve.
virtual void pre()
Called before the node range loop.
virtual void post()
Called after the node range loop.
virtual void postNode(ConstNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(ConstNodeRange::const_iterator &node_it)
Called for each node.

◆ post()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

Reimplemented in ComputeNodalAuxVarsThread.

Definition at line 123 of file ThreadedNodeLoop.h.

124 {
125 }

◆ postNode()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::postNode ( ConstNodeRange::const_iterator &  node_it)
virtualinherited

Called after the node assembly is done (including surface assembling)

Parameters
node- active node

Definition at line 135 of file ThreadedNodeLoop.h.

136 {
137 }

◆ pre()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Definition at line 117 of file ThreadedNodeLoop.h.

118 {
119 }

Member Data Documentation

◆ _damping

Real ComputeNodalDampingThread::_damping
protected

Definition at line 42 of file ComputeNodalDampingThread.h.

Referenced by damping(), join(), and onNode().

◆ _fe_problem

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited

◆ _nl

NonlinearSystemBase& ComputeNodalDampingThread::_nl
protected

Definition at line 43 of file ComputeNodalDampingThread.h.

Referenced by onNode().

◆ _nodal_dampers

const MooseObjectWarehouse<NodalDamper>& ComputeNodalDampingThread::_nodal_dampers
protected

Definition at line 44 of file ComputeNodalDampingThread.h.

Referenced by onNode().

◆ _tid

THREAD_ID ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_tid
protectedinherited

The documentation for this class was generated from the following files: