https://mooseframework.inl.gov
ComputeNodalDampingThread.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // MOOSE includes
12 #include "NonlinearSystem.h"
13 #include "Problem.h"
14 #include "NodalDamper.h"
15 
16 #include "libmesh/threads.h"
17 
20  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(feproblem),
21  _damping(1.0),
22  _nl(nl),
23  _nodal_dampers(_nl.getNodalDamperWarehouse())
24 {
25 }
26 
27 // Splitting Constructor
30  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(x, split),
31  _damping(1.0),
32  _nl(x._nl),
33  _nodal_dampers(x._nodal_dampers)
34 {
35 }
36 
38 
39 void
41 {
42  const Node * node = *node_it;
44 
45  std::set<MooseVariable *> damped_vars;
46 
47  const auto & ndampers = _nodal_dampers.getActiveObjects(_tid);
48  for (const auto & damper : ndampers)
49  if (damper->variableDefinedOnNode(node))
50  damped_vars.insert(damper->getVariable());
51 
52  if (!damped_vars.empty())
54 
55  for (const auto & damper : ndampers)
56  {
57  if (!damper->variableDefinedOnNode(node))
58  continue;
59 
60  Real cur_damping = damper->computeDamping();
61  damper->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 }
79 
80 void
82 {
83  const auto & damper_wh = _nl.getNodalDamperWarehouse();
84  if (!_fe_problem.shouldPrintExecution(_tid) || !damper_wh.hasActiveObjects())
85  return;
86 
87  const auto & console = _fe_problem.console();
88  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
89  console << "[DBG] Executing nodal dampers on " << execute_on << std::endl;
90  console << "[DBG] Ordering of the dampers on the blocks they are defined on:" << std::endl;
91  // TODO Check that all objects are active at this point
92  console << damper_wh.activeObjectsToFormattedString() << std::endl;
93 }
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 ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
void join(const ComputeNodalDampingThread &y)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Nonlinear system to be solved.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
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...
virtual void onNode(ConstNodeRange::const_iterator &node_it) override
const MooseObjectWarehouse< NodalDamper > & _nodal_dampers
tbb::split split
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
vec_type::const_iterator const_iterator
ComputeNodalDampingThread(FEProblemBase &feproblem, NonlinearSystemBase &nl)
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse() const
void printGeneralExecutionInformation() const override
Print information about the loop, mostly order of execution of objects.