www.mooseframework.org
ComputeNodalDampingThread.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
19  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(feproblem),
20  _damping(1.0),
21  _nl(feproblem.getNonlinearSystemBase()),
22  _nodal_dampers(_nl.getNodalDamperWarehouse())
23 {
24 }
25 
26 // Splitting Constructor
29  : ThreadedNodeLoop<ConstNodeRange, ConstNodeRange::const_iterator>(x, split),
30  _damping(1.0),
31  _nl(x._nl),
32  _nodal_dampers(x._nodal_dampers)
33 {
34 }
35 
37 
38 void
39 ComputeNodalDampingThread::onNode(ConstNodeRange::const_iterator & node_it)
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 }
61 
62 Real
64 {
65  return _damping;
66 }
67 
68 void
70 {
71  if (y._damping < _damping)
72  _damping = y._damping;
73 }
void reinitIncrementAtNodeForDampers(THREAD_ID tid, const std::set< MooseVariable *> &damped_vars)
Compute the incremental change in variables at nodes for dampers.
void join(const ComputeNodalDampingThread &y)
static PetscErrorCode Vec x
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Python like split function for strings.
Definition: MooseUtils.C:784
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...
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() const
virtual void reinitNode(const Node *node, THREAD_ID tid) override