https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeElemDampingThread.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 "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)
31 : ThreadedElementLoop<ConstElemRange>(x, split),
32 _damping(1.0),
33 _nl(x._nl),
34 _element_dampers(x._element_dampers)
35{
36}
37
39
40void
42{
45
46 std::set<MooseVariable *> damped_vars;
47
48 const auto & edampers = _element_dampers.getActiveObjects(_tid);
49 for (const auto & damper : edampers)
50 if (damper->variableDefinedOnElement(elem))
51 damped_vars.insert(damper->getVariable());
52
53 if (!damped_vars.empty())
55
56 for (const auto & damper : edampers)
57 {
58 if (!damper->variableDefinedOnElement(elem))
59 continue;
60
61 Real cur_damping = damper->computeDamping();
62 damper->checkMinDamping(cur_damping);
63 if (cur_damping < _damping)
64 _damping = cur_damping;
65 }
66}
67
68Real
73
74void
80
81void
83{
84 const auto & damper_wh = _nl.getElementDamperWarehouse();
85 if (!_fe_problem.shouldPrintExecution(_tid) || !damper_wh.hasActiveObjects())
86 return;
87
88 const auto & console = _fe_problem.console();
89 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
90 console << "[DBG] Beginning elemental loop to compute damping on " << execute_on << std::endl;
91 // Dampers are currently not block restricted
92 console << "[DBG] Ordering of dampers " << std::endl;
93 console << damper_wh.activeObjectsToFormattedString() << std::endl;
94}
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
const MooseObjectWarehouse< ElementDamper > & _element_dampers
void join(const ComputeElemDampingThread &y)
void printGeneralExecutionInformation() const override
Print list of objects executed and in which order.
ComputeElemDampingThread(FEProblemBase &feproblem, NonlinearSystemBase &nl)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
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.
Nonlinear system to be solved.
void reinitIncrementAtQpsForDampers(THREAD_ID tid, const std::set< MooseVariable * > &damped_vars)
Compute the incremental change in variables at QPs for dampers.
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse() const
const ConsoleStream & console() const
Return console handle.
Definition Problem.h:48
Base class for assembly-like calculations.