www.mooseframework.org
ComputeElemDampingThread.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 "NonlinearSystemBase.h"
13 #include "NonlinearSystem.h"
14 #include "Problem.h"
15 #include "ElementDamper.h"
16 
17 #include "libmesh/threads.h"
18 
21  : ThreadedElementLoop<ConstElemRange>(feproblem),
22  _damping(1.0),
23  _nl(nl),
24  _element_dampers(_nl.getElementDamperWarehouse())
25 {
26 }
27 
28 // Splitting Constructor
30  Threads::split split)
32  _damping(1.0),
33  _nl(x._nl),
34  _element_dampers(x._element_dampers)
35 {
36 }
37 
39 
40 void
42 {
43  _fe_problem.prepare(elem, _tid);
45 
46  std::set<MooseVariable *> damped_vars;
47 
48  const std::vector<std::shared_ptr<ElementDamper>> & edampers =
50  for (const auto & damper : edampers)
51  damped_vars.insert(damper->getVariable());
52 
54 
55  const std::vector<std::shared_ptr<ElementDamper>> & objects =
57  for (const auto & obj : objects)
58  {
59  Real cur_damping = obj->computeDamping();
60  obj->checkMinDamping(cur_damping);
61  if (cur_damping < _damping)
62  _damping = cur_damping;
63  }
64 }
65 
66 Real
68 {
69  return _damping;
70 }
71 
72 void
74 {
75  if (y._damping < _damping)
76  _damping = y._damping;
77 }
78 
79 void
81 {
82  const auto & damper_wh = _nl.getElementDamperWarehouse();
83  if (!_fe_problem.shouldPrintExecution(_tid) || !damper_wh.hasActiveObjects())
84  return;
85 
86  const auto & console = _fe_problem.console();
87  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
88  console << "[DBG] Beginning elemental loop to compute damping on " << execute_on << std::endl;
89  // Dampers are currently not block restricted
90  console << "[DBG] Ordering of dampers " << std::endl;
91  console << damper_wh.activeObjectsToFormattedString() << std::endl;
92 }
void printGeneralExecutionInformation() const override
Print list of objects executed and in which order.
void join(const ComputeElemDampingThread &y)
Base class for assembly-like calculations.
const MooseObjectWarehouse< ElementDamper > & _element_dampers
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse() const
void reinitIncrementAtQpsForDampers(THREAD_ID tid, const std::set< MooseVariable *> &damped_vars)
Compute the incremental change in variables at QPs for dampers.
ComputeElemDampingThread(FEProblemBase &feproblem, NonlinearSystemBase &nl)
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
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 reinitElem(const Elem *elem, const THREAD_ID tid) override
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
virtual void prepare(const Elem *elem, const THREAD_ID tid) override