www.mooseframework.org
Public Member Functions | Protected 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, NonlinearSystemBase &nl)
 
 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 Member Functions

void printGeneralExecutionInformation () const override
 Print information about the loop, mostly order of execution of objects. More...
 

Protected Attributes

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

Detailed Description

Definition at line 23 of file ComputeNodalDampingThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalDampingThread() [1/2]

ComputeNodalDampingThread::ComputeNodalDampingThread ( FEProblemBase feproblem,
NonlinearSystemBase nl 
)

Definition at line 18 of file ComputeNodalDampingThread.C.

◆ ComputeNodalDampingThread() [2/2]

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

◆ ~ComputeNodalDampingThread()

ComputeNodalDampingThread::~ComputeNodalDampingThread ( )
virtual

Definition at line 37 of file ComputeNodalDampingThread.C.

37 {}

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 56 of file ThreadedNodeLoop.h.

57  {
58  Threads::spin_mutex::scoped_lock lock(threaded_node_mutex);
59 
60  std::string what(e.what());
62  };
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
static Threads::spin_mutex threaded_node_mutex

◆ damping()

Real ComputeNodalDampingThread::damping ( )

Definition at line 64 of file ComputeNodalDampingThread.C.

Referenced by NonlinearSystemBase::computeDamping().

65 {
66  return _damping;
67 }

◆ join()

void ComputeNodalDampingThread::join ( const ComputeNodalDampingThread y)

Definition at line 70 of file ComputeNodalDampingThread.C.

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

◆ 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 69 of file ThreadedNodeLoop.h.

69 { 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 40 of file ComputeNodalDampingThread.C.

41 {
42  const Node * node = *node_it;
44 
45  std::set<MooseVariable *> damped_vars;
46 
47  const auto & ndampers = _nl.getNodalDamperWarehouse().getActiveObjects(_tid);
48  for (const auto & damper : ndampers)
49  damped_vars.insert(damper->getVariable());
50 
52 
53  const auto & objects = _nodal_dampers.getActiveObjects(_tid);
54  for (const auto & obj : objects)
55  {
56  Real cur_damping = obj->computeDamping();
57  obj->checkMinDamping(cur_damping);
58  if (cur_damping < _damping)
59  _damping = cur_damping;
60  }
61 }
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, const 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...
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse() const

◆ operator()()

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

Definition at line 94 of file ThreadedNodeLoop.h.

95 {
96  try
97  {
98  ParallelUniqueId puid;
99  _tid = puid.id;
100 
101  pre();
103 
104  for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
105  {
106  if (!keepGoing())
107  break;
108 
109  onNode(nd);
110 
111  postNode(nd);
112  }
113 
114  post();
115  }
116  catch (MooseException & e)
117  {
119  }
120 }
virtual void printGeneralExecutionInformation() const
Print information about the loop, mostly order of execution of objects.
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< AuxKernelType >.

Definition at line 130 of file ThreadedNodeLoop.h.

131 {
132 }

◆ 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 142 of file ThreadedNodeLoop.h.

143 {
144 }

◆ pre()

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

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Definition at line 124 of file ThreadedNodeLoop.h.

125 {
126 }

◆ printGeneralExecutionInformation()

void ComputeNodalDampingThread::printGeneralExecutionInformation ( ) const
overrideprotectedvirtual

Print information about the loop, mostly order of execution of objects.

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

Definition at line 77 of file ComputeNodalDampingThread.C.

78 {
79  const auto & damper_wh = _nl.getNodalDamperWarehouse();
80  if (!_fe_problem.shouldPrintExecution(_tid) || !damper_wh.hasActiveObjects())
81  return;
82 
83  const auto & console = _fe_problem.console();
84  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
85  console << "[DBG] Executing nodal dampers on " << execute_on << std::endl;
86  console << "[DBG] Ordering of the dampers on the blocks they are defined on:" << std::endl;
87  // TODO Check that all objects are active at this point
88  console << damper_wh.activeObjectsToFormattedString() << std::endl;
89 }
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse() const

Member Data Documentation

◆ _damping

Real ComputeNodalDampingThread::_damping
protected

Definition at line 44 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 45 of file ComputeNodalDampingThread.h.

Referenced by onNode(), and printGeneralExecutionInformation().

◆ _nodal_dampers

const MooseObjectWarehouse<NodalDamper>& ComputeNodalDampingThread::_nodal_dampers
protected

Definition at line 46 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: