LifeV
VenantKirchhoffViscoelasticData.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 ************************************************************************
4 
5  This file is part of the LifeV Applications.
6  Copyright (C) 2001-2010 EPFL, Politecnico di Milano, INRIA
7 
8  This library is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as
10  published by the Free Software Foundation; either version 2.1 of the
11  License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  USA
22 
23 ************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @brief VenantKirchhoffViscoelasticData - Class to secondorder problem (S. Venant Kirchhoff Viscoelastic)
29 
30  @author Matteo Pozzoli <matteo1.pozzoli@mail.polimi.it>
31 
32  @contributor Matteo Pozzoli <matteo1.pozzoli@mail.polimi.it>
33  @maintainer Matteo Pozzoli <matteo1.pozzoli@mail.polimi.it>
34  */
35 
36 #include <lifev/structure/solver/VenantKirchhoffViscoelasticData.hpp>
37 
38 namespace LifeV
39 {
40 
41 //===================================================
42 // Constructor
43 //===================================================
44 
46  M_time ( ),
47  M_timeAdvance ( ),
48  M_density ( ),
49  M_thickness ( ),
50  M_poisson ( ),
51  M_young ( ),
52  M_gamma ( ),
53  M_beta ( ),
54  M_verbose ( ),
55  M_order ( ),
56  M_damping ( )
57 {
58 }
59 
61  M_time ( venantKirchhoffViscoelasticData.M_time ),
62  M_timeAdvance ( venantKirchhoffViscoelasticData.M_timeAdvance ),
63  M_density ( venantKirchhoffViscoelasticData.M_density ),
64  M_thickness ( venantKirchhoffViscoelasticData.M_thickness ),
65  M_poisson ( venantKirchhoffViscoelasticData.M_poisson ),
66  M_young ( venantKirchhoffViscoelasticData.M_young ),
67  M_gamma ( venantKirchhoffViscoelasticData.M_gamma ),
68  M_beta ( venantKirchhoffViscoelasticData.M_beta ),
69  M_verbose ( venantKirchhoffViscoelasticData.M_verbose ),
71  M_damping ( venantKirchhoffViscoelasticData.M_damping )
72 {
73 }
74 
75 //==================================================
76 // Operators
77 //==================================================
78 
80 VenantKirchhoffViscoelasticData::operator= ( const VenantKirchhoffViscoelasticData& venantKirchhoffViscoelasticData )
81 {
82  if ( this != &venantKirchhoffViscoelasticData )
83  {
84  M_time = venantKirchhoffViscoelasticData.M_time;
85  M_timeAdvance = venantKirchhoffViscoelasticData.M_timeAdvance;
86  M_density = venantKirchhoffViscoelasticData.M_density;
87  M_thickness = venantKirchhoffViscoelasticData.M_thickness;
88  M_poisson = venantKirchhoffViscoelasticData.M_poisson;
89  M_young = venantKirchhoffViscoelasticData.M_young;
90  M_gamma = venantKirchhoffViscoelasticData.M_gamma;
91  M_beta = venantKirchhoffViscoelasticData.M_beta;
92  M_verbose = venantKirchhoffViscoelasticData.M_verbose;
93  M_order = venantKirchhoffViscoelasticData.M_order;
94  M_damping = venantKirchhoffViscoelasticData.M_damping;
95  }
96 
97  return *this;
98 }
99 
100 // ===================================================
101 // Methods
102 // ===================================================
103 
104 void
105 VenantKirchhoffViscoelasticData::setup ( const GetPot& dataFile, const std::string& section )
106 {
107  // If data time has not been set
108  if ( !M_time.get() )
109  {
110  M_time.reset ( new time_Type ( dataFile, section + "/time_discretization" ) );
111  }
112 
113  if ( !M_timeAdvance.get() )
114  {
115  M_timeAdvance.reset ( new timeAdvance_Type ( dataFile, section + "/time_discretization" ) );
116  }
117 
118  // physics
119  M_density = dataFile ( ( section + "/physics/density" ).data(), 1. );
120  M_thickness = dataFile ( ( section + "/physics/thickness" ).data(), 0.1 );
121 
122  UInt materialsNumber = dataFile.vector_variable_size ( ( section + "/physics/material_flag" ).data() );
123  // std::cout<<"materialNumber "<<materialsNumber<<"\n";
124  if ( materialsNumber == 0 )
125  {
126  std::cout << "The material flag was not set from data file. Its value will be dedced from the first volume marker." << "\n";
127  // M_young[1] = dataFile( ( section + "/physics/young" ).data(), 0. );
128  // M_poisson[1] = dataFile( ( section + "/physics/poisson" ).data(), 0. );
129  }
130  else
131  {
132  ASSERT ( materialsNumber == dataFile.vector_variable_size ( ( section + "/physics/young" ).data() ), "!!! ERROR: Inconsistent size for Young Modulus !!!");
133  ASSERT ( materialsNumber == dataFile.vector_variable_size ( ( section + "/physics/poisson" ).data() ), "!!! ERROR: Inconsistent size for Poisson Coeff. !!!");
134 
135  UInt material (0);
136  for ( UInt i (0) ; i < materialsNumber ; ++i )
137  {
138  material = dataFile ( ( section + "/physics/material_flag" ).data(), 0., i );
139  M_young[material] = dataFile ( ( section + "/physics/young" ).data(), 0., i );
140  M_poisson[material] = dataFile ( ( section + "/physics/poisson" ).data(), 0., i );
141  M_gamma[material] = dataFile ( ( section + "/physics/young" ).data(), 0., i );
142  M_beta[material] = dataFile ( ( section + "/physics/poisson" ).data(), 0., i );
143  }
144  }
145 
146  M_damping = dataFile ( (section + "/damping").data(), false);
147 
148  // space_discretization
149  M_order = dataFile ( (section + "/space_discretization/order").data(), "P1" );
150 
151  // miscellaneous
152  M_verbose = dataFile ( (section + "/miscellaneous/verbose").data(), 1 );
153 
154 }
155 
156 void
157 VenantKirchhoffViscoelasticData::showMe ( std::ostream& output ) const
158 {
159  // physics
160  output << "\n*** Values for data [solid/physics]\n\n";
161  output << "density = " << M_density << std::endl;
162  output << "thickness = " << M_thickness << std::endl;
163  for ( MaterialContainer_ConstIterator i = M_young.begin() ; i != M_young.end() ; ++i )
164  {
165  output << "young[" << i->first << "] = " << i->second << std::endl;
166  }
167  for ( MaterialContainer_ConstIterator i = M_poisson.begin() ; i != M_poisson.end() ; ++i )
168  {
169  output << "poisson[" << i->first << "] = " << i->second << std::endl;
170  }
171 
172  for ( MaterialContainer_ConstIterator i = M_poisson.begin() ; i != M_poisson.end() ; ++i )
173  {
174  output << "Lame - lambda[" << i->first << "] = " << lambda ( i->first ) << std::endl;
175  output << "Lame - mu[" << i->first << "] = " << mu ( i->first ) << std::endl;
176  }
177 
178  for ( MaterialContainer_ConstIterator i = M_gamma.begin() ; i != M_gamma.end() ; ++i )
179  {
180  output << "gamma[" << i->first << "] = " << i->second << std::endl;
181  }
182 
183  for ( MaterialContainer_ConstIterator i = M_beta.begin() ; i != M_beta.end() ; ++i )
184  {
185  output << "beta[" << i->first << "] = " << i->second << std::endl;
186  }
187 
188  output << "\n*** Values for data [solid/miscellaneous]\n\n";
189  output << "verbose = " << M_verbose << std::endl;
190 
191  output << "\n*** Values for data [solid/space_discretization]\n\n";
192  output << "FE order = " << M_order << std::endl;
193 
194  output << "\n*** Values for data [solid/time_discretization]\n\n";
195  M_time->showMe ( output );
196  M_timeAdvance->showMe ( output );
197 }
198 
199 
200 
201 // ===================================================
202 // Set Method
203 // ===================================================
204 void
206 {
207  M_density = density;
208 }
209 
210 void
212 {
213  M_thickness = thickness;
214 }
215 
216 void
217 VenantKirchhoffViscoelasticData::setPoisson ( const Real& poisson, const UInt& material )
218 {
219  M_poisson[material] = poisson;
220 }
221 
222 void
223 VenantKirchhoffViscoelasticData::setYoung ( const Real& young, const UInt& material )
224 {
225  M_young[material] = young;
226 }
227 
228 void
229 VenantKirchhoffViscoelasticData::setGamma ( const Real& gamma, const UInt& material )
230 {
231  M_gamma[material] = gamma;
232 }
233 
234 
235 void
236 VenantKirchhoffViscoelasticData::setBeta ( const Real& beta, const UInt& material )
237 {
238  M_beta[material] = beta;
239 }
240 
241 // ===================================================
242 // Get Method
243 // ===================================================
244 const Real&
246 {
247  return M_density;
248 }
249 
250 const Real&
252 {
253  return M_thickness;
254 }
255 
256 Real
257 VenantKirchhoffViscoelasticData::poisson ( const UInt& material ) const
258 {
259  MaterialContainer_Type::const_iterator IT = M_poisson.find ( material );
260  if (IT != M_poisson.end() )
261  {
262  return M_poisson.find ( material )->second;
263  }
264  else
265  {
266  return 0;
267  }
268 }
269 
270 Real
271 VenantKirchhoffViscoelasticData::young ( const UInt& material ) const
272 {
273  MaterialContainer_Type::const_iterator IT = M_young.find ( material );
274  if (IT != M_young.end() )
275  {
276  return IT->second;
277  }
278  else
279  {
280  return 0;
281  }
282 }
283 
284 Real
285 VenantKirchhoffViscoelasticData::lambda ( const UInt& material ) const
286 {
287  return M_young.find ( material )->second * M_poisson.find ( material )->second /
288  ( ( 1.0 + M_poisson.find ( material )->second ) * ( 1.0 - 2.0 * M_poisson.find ( material )->second ) );
289 }
290 
291 Real
292 VenantKirchhoffViscoelasticData::mu ( const UInt& material ) const
293 {
294  return M_young.find ( material )->second / ( 2.0 * ( 1.0 + M_poisson.find ( material )->second ) );
295 }
296 
297 
298 const Real&
299 VenantKirchhoffViscoelasticData::gamma ( const UInt& material ) const
300 {
301  return M_gamma.find ( material )->second;
302 }
303 
304 const Real&
305 VenantKirchhoffViscoelasticData::beta ( const UInt& material ) const
306 {
307  return M_beta.find ( material )->second;
308 }
309 
310 const std::string&
312 {
313  return M_order;
314 }
315 
316 }
void showMe(std::ostream &output=std::cout) const
Display the values.
void setPoisson(const Real &poisson, const UInt &material=1)
Set poisson.
const Real & thickness() const
Get solid thickness.
VenantKirchhoffViscoelasticData(const VenantKirchhoffViscoelasticData &VenantKirchhoffViscoelasticData)
const Real & rho() const
Get solid density.
timePtr_Type M_time
Data containers for time and mesh.
Real mu(const UInt &material=1) const
Get solid second Lame coefficient.
void updateInverseJacobian(const UInt &iQuadPt)
void setDensity(const Real &density)
Set density.
MaterialContainer_Type M_beta
damping coefficint (mass)
VenantKirchhoffViscoelasticData & operator=(const VenantKirchhoffViscoelasticData &VenantKirchhoffViscoelasticData)
Operator=.
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
void setup(const GetPot &dataFile, const std::string &section="solid")
Read the dataFile and set all the quantities.
Real young(const UInt &material=1) const
Get solid young modulus.
void setYoung(const Real &young, const UInt &material=1)
Set Young modulus.
const Real & gamma(const UInt &material=1) const
Get damping coefficients.
MaterialContainer_Type M_gamma
damping coefficient (Stiffness)
void setGamma(const Real &gamma, const UInt &material)
const Real & beta(const UInt &material=1) const
double Real
Generic real data.
Definition: LifeV.hpp:175
void setBeta(const Real &beta, const UInt &material)
void setThickness(const Real &thickness)
Set thickness.
const std::string & order() const
Get FE order.
bool M_damping
damping true when there is damping term
Real poisson(const UInt &material=1) const
Get solid poisson coefficient.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
Real lambda(const UInt &material=1) const
Get solid first lame coefficient.