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 
20  : ThreadedElementLoop<ConstElemRange>(feproblem),
21  _damping(1.0),
22  _nl(feproblem.getNonlinearSystemBase()),
23  _element_dampers(_nl.getElementDamperWarehouse())
24 {
25 }
26 
27 // Splitting Constructor
30  : ThreadedElementLoop<ConstElemRange>(x, split),
31  _damping(1.0),
32  _nl(x._nl),
33  _element_dampers(x._element_dampers)
34 {
35 }
36 
38 
39 void
41 {
42  _fe_problem.prepare(elem, _tid);
44 
45  std::set<MooseVariable *> damped_vars;
46 
47  const std::vector<std::shared_ptr<ElementDamper>> & edampers =
49  for (const auto & damper : edampers)
50  damped_vars.insert(damper->getVariable());
51 
53 
54  const std::vector<std::shared_ptr<ElementDamper>> & objects =
56  for (const auto & obj : objects)
57  {
58  Real cur_damping = obj->computeDamping();
59  obj->checkMinDamping(cur_damping);
60  if (cur_damping < _damping)
61  _damping = cur_damping;
62  }
63 }
64 
65 Real
67 {
68  return _damping;
69 }
70 
71 void
73 {
74  if (y._damping < _damping)
75  _damping = y._damping;
76 }
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
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.
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.
std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Python like split function for strings.
Definition: MooseUtils.C:736
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...