-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathComputeElemDampingThread.C
More file actions
94 lines (79 loc) · 2.67 KB
/
ComputeElemDampingThread.C
File metadata and controls
94 lines (79 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//* This file is part of the MOOSE framework
//* https://mooseframework.inl.gov
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
// MOOSE includes
#include "ComputeElemDampingThread.h"
#include "NonlinearSystemBase.h"
#include "NonlinearSystem.h"
#include "Problem.h"
#include "ElementDamper.h"
#include "libmesh/threads.h"
ComputeElemDampingThread::ComputeElemDampingThread(FEProblemBase & feproblem,
NonlinearSystemBase & nl)
: ThreadedElementLoop<ConstElemRange>(feproblem),
_damping(1.0),
_nl(nl),
_element_dampers(_nl.getElementDamperWarehouse())
{
}
// Splitting Constructor
ComputeElemDampingThread::ComputeElemDampingThread(ComputeElemDampingThread & x,
Threads::split split)
: ThreadedElementLoop<ConstElemRange>(x, split),
_damping(1.0),
_nl(x._nl),
_element_dampers(x._element_dampers)
{
}
ComputeElemDampingThread::~ComputeElemDampingThread() {}
void
ComputeElemDampingThread::onElement(const Elem * elem)
{
_fe_problem.prepare(elem, _tid);
_fe_problem.reinitElem(elem, _tid);
std::set<MooseVariable *> damped_vars;
const auto & edampers = _element_dampers.getActiveObjects(_tid);
for (const auto & damper : edampers)
if (damper->variableDefinedOnElement(elem))
damped_vars.insert(damper->getVariable());
if (!damped_vars.empty())
_nl.reinitIncrementAtQpsForDampers(_tid, damped_vars);
for (const auto & damper : edampers)
{
if (!damper->variableDefinedOnElement(elem))
continue;
Real cur_damping = damper->computeDamping();
damper->checkMinDamping(cur_damping);
if (cur_damping < _damping)
_damping = cur_damping;
}
}
Real
ComputeElemDampingThread::damping()
{
return _damping;
}
void
ComputeElemDampingThread::join(const ComputeElemDampingThread & y)
{
if (y._damping < _damping)
_damping = y._damping;
}
void
ComputeElemDampingThread::printGeneralExecutionInformation() const
{
const auto & damper_wh = _nl.getElementDamperWarehouse();
if (!_fe_problem.shouldPrintExecution(_tid) || !damper_wh.hasActiveObjects())
return;
const auto & console = _fe_problem.console();
const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
console << "[DBG] Beginning elemental loop to compute damping on " << execute_on << std::endl;
// Dampers are currently not block restricted
console << "[DBG] Ordering of dampers " << std::endl;
console << damper_wh.activeObjectsToFormattedString() << std::endl;
}