Loading [MathJax]/extensions/tex2jax.js
Plugins
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
scaled_hooke_law.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019: Ruhr University Bochum
3 * Author: Andreas Vogel
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33#ifndef SCALED_HOOKE_LAW_H_
34#define SCALED_HOOKE_LAW_H_
35
36#include "mat_law_interface.h"
37#include "hooke.h"
40
41
42
43namespace ug{
44namespace SmallStrainMechanics{
45
48
49
50
51
52template <typename TDomain>
53class IScaledHookeLaw : public HookeLaw<TDomain>
54{
55 private:
58
61
62
63 public:
65 static const int dim = base_type::dim;
66
69
70 public:
74 : HookeLaw<TDomain>(),
75 m_spScaling(spScaling), m_spEnergy(spEnergy),
77 {}
78
81
83 void init_internal_vars(TBaseElem* elem, const size_t numIP)
84 {
86 base_type::m_bInit = true;
87
88 m_spScaling->set(1.0);
89 m_spEnergy->set(0.0);
90 }
91 }
92
94 {
95 const size_t fct = 0; // \todo: generalize
96 std::vector<DoFIndex> ind;
97 if(m_spScaling->inner_dof_indices(elem, fct, ind) != 1)
98 UG_THROW("Wrong number dofs");
99
100 m_pScaling_elem = & DoFRef(*m_spScaling, ind[0]);
101 m_pEnergy_elem = &DoFRef(*m_spEnergy, ind[0]);
102 }
103
105
106 public:
109
110 protected:
113
116};
117
118
119
120
122
125template <typename TDomain>
127 : public IScaledHookeLaw<TDomain>
128{
129 private:
132
135
136 protected:
139
140 public:
142 static const int dim = base_type::dim;
143
146
147 public:
153
156
157
159 {
160 (*m_pEnergy_elem) /= (*m_pScaling_elem);
161 }
162};
163
165
168template <typename TDomain>
170 : public IScaledHookeLaw<TDomain>
171{
172 private:
175
178
179 protected:
182
183 public:
185 static const int dim = base_type::dim;
186
189
190 public:
194 int expPenalize)
195 : IScaledHookeLaw<TDomain>(spChi, spDrivingForce),
196 m_expPenalize(expPenalize)
197 {}
198
201
203
204
206 {
207 (*m_pEnergy_elem) = ((m_expPenalize-1) * (*m_pEnergy_elem)) / (*m_pScaling_elem);
208 }
209
210 protected:
212};
213
214}// end of namespace SmallStrainMechanics
215}// end of namespace ug
216
217#endif /* SCALED_HOOKE_LAW_H_ */
Material Law:
Definition scaled_hooke_law.h:128
bool m_bInit
flag indicating, if material law has been initialized
Definition mat_law_interface.h:128
domain_traits< TDomain::dim >::grid_base_object TBaseElem
base element type of associated domain
Definition mat_law_interface.h:50
Definition scaled_hooke_law.h:54
Material Law:
Definition scaled_hooke_law.h:171
number * m_pEnergy_elem
Definition scaled_hooke_law.h:115
number * m_pScaling_elem
Definition scaled_hooke_law.h:114
TopologyOptimLaw< TDomain > this_type
own type
Definition scaled_hooke_law.h:177
number * m_pEnergy_elem
Definition scaled_hooke_law.h:115
DamageLaw< TDomain > this_type
own type
Definition scaled_hooke_law.h:134
virtual number scaling_on_curr_elem()
Definition scaled_hooke_law.h:202
virtual void post_process_energy_on_curr_elem()
Definition scaled_hooke_law.h:104
static const int dim
World dimension.
Definition scaled_hooke_law.h:142
base_type::TBaseElem TBaseElem
base element type
Definition scaled_hooke_law.h:68
static const int dim
World dimension.
Definition hooke.h:86
TopologyOptimLaw(SmartPtr< GridFunction< TDomain, CPUAlgebra > > spChi, SmartPtr< GridFunction< TDomain, CPUAlgebra > > spDrivingForce, int expPenalize)
constructor
Definition scaled_hooke_law.h:192
HookeLaw< TDomain > base_type
Base class type.
Definition scaled_hooke_law.h:57
virtual number scaling_on_curr_elem()
Definition scaled_hooke_law.h:107
base_type::TBaseElem TBaseElem
base element type
Definition scaled_hooke_law.h:145
DamageLaw(SmartPtr< GridFunction< TDomain, CPUAlgebra > > spF, SmartPtr< GridFunction< TDomain, CPUAlgebra > > spPsi0)
constructor
Definition scaled_hooke_law.h:149
number * m_pScaling_elem
Definition scaled_hooke_law.h:114
int m_expPenalize
Definition scaled_hooke_law.h:211
base_type::TBaseElem TBaseElem
base element type
Definition scaled_hooke_law.h:188
SmartPtr< GridFunction< TDomain, CPUAlgebra > > m_spEnergy
Definition scaled_hooke_law.h:112
static const int dim
World dimension.
Definition scaled_hooke_law.h:185
IScaledHookeLaw< TDomain > this_type
own type
Definition scaled_hooke_law.h:60
IScaledHookeLaw< TDomain > base_type
Base class type.
Definition scaled_hooke_law.h:131
IScaledHookeLaw< TDomain > base_type
Base class type.
Definition scaled_hooke_law.h:174
static const int dim
World dimension.
Definition scaled_hooke_law.h:65
~TopologyOptimLaw()
Destructor.
Definition scaled_hooke_law.h:200
SmartPtr< GridFunction< TDomain, CPUAlgebra > > m_spScaling
Definition scaled_hooke_law.h:111
void internal_vars(TBaseElem *elem)
Definition scaled_hooke_law.h:93
void init_internal_vars(TBaseElem *elem, const size_t numIP)
reset values explicitly
Definition scaled_hooke_law.h:83
number & energy_on_curr_elem()
Definition scaled_hooke_law.h:108
IScaledHookeLaw(SmartPtr< GridFunction< TDomain, CPUAlgebra > > spScaling, SmartPtr< GridFunction< TDomain, CPUAlgebra > > spEnergy)
constructor
Definition scaled_hooke_law.h:72
~DamageLaw()
Destructor.
Definition scaled_hooke_law.h:155
virtual void post_process_energy_on_curr_elem()
Definition scaled_hooke_law.h:158
virtual void post_process_energy_on_curr_elem()
Definition scaled_hooke_law.h:205
~IScaledHookeLaw()
Destructor.
Definition scaled_hooke_law.h:80
#define UG_THROW(msg)
double number
const number & DoFRef(const TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)