Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
LinElasFirstOrder_def.hpp
1#ifndef LinElasFirstOrder_def_hpp
2#define LinElasFirstOrder_def_hpp
3#include "LinElasFirstOrder_decl.hpp"
4namespace FEDD {
5
6template<class SC,class LO,class GO,class NO>
7LinElasFirstOrder<SC,LO,GO,NO>::LinElasFirstOrder(const DomainConstPtr_Type &domain, std::string FEType, ParameterListPtr_Type parameterList):
8Problem_Type(parameterList, domain->getComm())
9{
10 // Bem.: Hier benutzen wir auch direkt den Konstruktor der Klasse Problem, wo z.B. parameterList auf parameterList_ gesetzt wird
11
12 // d_s steht displacement (d) der Struktur (_s). Im Allgemeinen vektorwertig, daher domainDisplacement->GetDimension().
13 // Andernfalls benutzen wir stattdessen 1
14
15 // Siehe Problem_def.hpp fuer die Funktion AddVariable()
16 this->addVariable( domain , FEType , "d_s" ,domain->getDimension() );
17 this->addVariable( domain , FEType , "v_s" ,domain->getDimension() );
18 this->dim_ = this->getDomain(0)->getDimension();
19}
20
21template<class SC,class LO,class GO,class NO>
22LinElasFirstOrder<SC,LO,GO,NO>::~LinElasFirstOrder()
23{
24
25}
26
27template<class SC,class LO,class GO,class NO>
28void LinElasFirstOrder<SC,LO,GO,NO>::info(){
29 this->infoProblem();
30}
31
32template<class SC,class LO,class GO,class NO>
33void LinElasFirstOrder<SC,LO,GO,NO>::assemble( std::string type ) const
34{
35 if(this->verbose_)
36 std::cout << "-- Assembly linear elasticity first order ... " << std::flush;
37
38 // Hole die Dichte \rho (density) und die Paramter \nu (Poisson-ratio) und \mu (zweite Lamé-Konstante)
39 double density = this->parameterList_->sublist("Parameter").get("Density",1.);
40 double poissonRatio = this->parameterList_->sublist("Parameter").get("Poisson Ratio",0.4);
41 double mu = this->parameterList_->sublist("Parameter").get("Mu",2.0e+6);
42
43 // Berechne daraus nun E (Youngsches Modul) und die erste Lamé-Konstanten \lambda
44 double youngModulus = mu*2.*(1 + poissonRatio);
45 double lambda = (poissonRatio*youngModulus)/((1 + poissonRatio)*(1 - 2*poissonRatio));
46
47 // Initialisiere die Steifigkeitsmatrix. Das letzte Argument gibt die (ungefaehre) Anzahl an Eintraege pro Zeile an
48 MatrixPtr_Type K = Teuchos::rcp(new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(0)->getApproxEntriesPerRow() ) );
49 // MatrixPtr_Type K = Teuchos::rcp(new Matrix_Type( this->domainPtr_vec_.at(0)->getMapVecFieldUnique(), 10 ) );
50
51 // Assembliere die Steifigkeitsmatrix. Die 2 gibt degree an, d.h. die Ordnung der Quadraturformel, die benutzt werden soll.
52 this->feFactory_->assemblyLinElasXDim( this->dim_, this->getDomain(0)->getFEType(), K, lambda, mu );
53 K->resumeFill();
54 K->scale(-1.);
55 K->fillComplete();
56
57 MatrixPtr_Type I = Teuchos::rcp(new Matrix_Type( this->getDomain(1)->getMapVecFieldUnique(), 1 ) );
58 this->feFactory_->assemblyIdentity( I );
59 I->resumeFill();
60 I->scale(-density); // use density aswell, since every diagonal mass matrix in TimeProblem will be scaled with density aswell
61 I->fillComplete();
62
63 // Fuege die Steifikeitsmatrix als Blockeintrag an der Stelle (1,1) (in C dann (0,0)) in die Blockmatrix hinein.
64 this->system_->addBlock( K, 0, 0 );
65 this->system_->addBlock( I, 1, 1 );
66
67 // Initialisiere den Loesungsvektor mit der DomainMap und die rechte Seite RHS mit der RangeMap.
68 // int nmbVectors = 1 in Problem_decl.hpp
69// this->initializeVectors();
70
71 this->assembleSourceTerm( 0. );
72
73 this->rhs_->addBlock( this->sourceTerm_->getBlockNonConst(0), 0 );
74
75 if (this->verbose_)
76 std::cout << "done -- " << std::endl;
77}
78
79//template<class SC,class LO,class GO,class NO>
80//void LinElasFirstOrder<SC,LO,GO,NO>::assembleSourceTerm(double time)
81//{
82//
83// double force = this->parameterList_->sublist("Parameter").get("Volume force",0.);
84//
85// MultiVectorPtr_Type sourceTerm = Teuchos::rcp(new MultiVector_Type( this->domainPtr_vec_.at(0)->getMapVecFieldRepeated() ) );
86// vec_dbl_Type funcParameter(3,0.);
87//
88// funcParameter[0] = 0.; // degree of function
89// funcParameter[1] = time;
90// funcParameter[2] = force;
91//
92// this->feFactory_->assemblyRHS(this->dim_, this->domain_FEType_vec_.at(0), sourceTerm, "Vector", this->rhsFuncVec_[0], funcParameter);
93//
94// this->sourceTerm_->getBlockNonConst(0)->putScalar(0.);
95//
96// this->sourceTerm_->getBlockNonConst(0)->exportFromVector( sourceTerm, true, "Add" );
97//
98// double density = this->parameterList_->sublist("Parameter").get("Density",1.);
99//
100// this->sourceTerm_->getBlockNonConst(0)->scale(density);
101// }
102
103}
104#endif
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5