-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgsThermoAssembler.hpp
89 lines (70 loc) · 3.01 KB
/
gsThermoAssembler.hpp
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
/** @file gsThermoAssembler.hpp
@brief Provides assembler implementation for the gsThermoAssembler.
This file is part of the G+Smo library.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Author(s):
D. Fusseder (2012 - 2015, TU Kaiserslautern),
A.Shamanskiy (2016 - ...., TU Kaiserslautern)
*/
#pragma once
#include <gsElasticity/gsThermoAssembler.h>
#include <gsElasticity/gsVisitorThermo.h>
#include <gsElasticity/gsVisitorThermoBoundary.h>
namespace gismo
{
template <class T>
gsThermoAssembler<T>::gsThermoAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & bases,
const gsBoundaryConditions<T> & b_conditions,
const gsFunction<T> & body_force,
const gsFunctionSet<T> & temperature_field)
:gsElasticityAssembler<T>(patches,bases,b_conditions,body_force),
m_temperatureField(temperature_field),
assembledElasticity(false)
{
m_options.addReal("InitTemp","Initial temperature of the object",20.);
m_options.addReal("ThExpCoef","Coefficient of thermal expansion of the material",20.);
m_options.addSwitch("ParamTemp","Yes if the temperature field is parametric",true);
findNonDirichletSides();
}
template <class T>
void gsThermoAssembler<T>::assemble(bool saveEliminationMatrix)
{
GISMO_UNUSED(saveEliminationMatrix);
Base::assemble(false);
elastRhs = gsAssembler<T>::m_system.rhs();
assembledElasticity = true;
assembleThermo();
}
template <class T>
void gsThermoAssembler<T>::findNonDirichletSides()
{
for (std::vector< patchSide >::iterator side = m_pde_ptr->domain().bBegin(); side != m_pde_ptr->domain().bEnd(); ++side)
{
std::pair<index_t,boxSide> temp(side->patch,side->index());
typename gsBoundaryConditions<T>::const_iterator it = m_pde_ptr->bc().dirichletBegin();
for ( ; it != m_pde_ptr->bc().dirichletEnd(); ++it )
if (temp.first == it->patch() && temp.second == it->side())
goto exitLabel;
nonDirichletSides.push_back(temp);
exitLabel:;
}
}
template <class T>
void gsThermoAssembler<T>::assembleThermo()
{
GISMO_ENSURE(assembledElasticity, "gsElThermoAssembler::assemble() hasn't been called!");
gsAssembler<T>::m_system.rhs().setZero();
gsVisitorThermo<T> visitor(m_temperatureField);
gsAssembler<T>::template push<gsVisitorThermo<T> >(visitor);
for (std::vector<std::pair<index_t,boxSide> >::const_iterator it = nonDirichletSides.begin();
it != nonDirichletSides.end(); ++it)
{
gsVisitorThermoBoundary<T> bVisitor(it->second,m_temperatureField);
gsAssembler<T>::template apply<gsVisitorThermoBoundary<T> >(bVisitor,it->first,it->second);
}
gsAssembler<T>::m_system.rhs() += elastRhs;
}
} // namespace ends