www.mooseframework.org
ComputeElemDampingThread.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
17 #include "NonlinearSystemBase.h"
18 #include "NonlinearSystem.h"
19 #include "Problem.h"
20 #include "ElementDamper.h"
21 
22 #include "libmesh/threads.h"
23 
25  : ThreadedElementLoop<ConstElemRange>(feproblem),
26  _damping(1.0),
27  _nl(feproblem.getNonlinearSystemBase()),
28  _element_dampers(_nl.getElementDamperWarehouse())
29 {
30 }
31 
32 // Splitting Constructor
34  Threads::split split)
35  : ThreadedElementLoop<ConstElemRange>(x, split),
36  _damping(1.0),
37  _nl(x._nl),
39 {
40 }
41 
43 
44 void
46 {
47  _fe_problem.prepare(elem, _tid);
49 
50  std::set<MooseVariable *> damped_vars;
51 
52  const std::vector<std::shared_ptr<ElementDamper>> & edampers =
54  for (const auto & damper : edampers)
55  damped_vars.insert(damper->getVariable());
56 
58 
59  const std::vector<std::shared_ptr<ElementDamper>> & objects =
61  for (const auto & obj : objects)
62  {
63  Real cur_damping = obj->computeDamping();
64  obj->checkMinDamping(cur_damping);
65  if (cur_damping < _damping)
66  _damping = cur_damping;
67  }
68 }
69 
70 Real
72 {
73  return _damping;
74 }
75 
76 void
78 {
79  if (y._damping < _damping)
80  _damping = y._damping;
81 }
virtual void prepare(const Elem *elem, THREAD_ID tid) override
void join(const ComputeElemDampingThread &y)
Base class for assembly-like calculations.
const MooseObjectWarehouse< ElementDamper > & _element_dampers
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
ComputeElemDampingThread(FEProblemBase &feproblem)
static PetscErrorCode Vec x
virtual void reinitElem(const Elem *elem, THREAD_ID tid) override
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse()
void reinitIncrementAtQpsForDampers(THREAD_ID tid, const std::set< MooseVariable * > &damped_vars)
Compute the incremental change in variables at QPs 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...