Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
Geometry_def.hpp
1#ifndef GEOMETRY_def_hpp
2#define GEOMETRY_def_hpp
3
4#include "feddlib/core/FE/Domain.hpp"
5#include "feddlib/core/FE/FE.hpp"
6
7namespace FEDD {
8// Funktion fuer die rechte Seite der DGL in 2D
9void ZeroFErhsFunc2D(double* x, double* result, double* parameters)
10{
11 // Wir setzen die rechte Seite f_vec = (0, 0)
12 result[0] = 0.0;
13 result[1] = 0.0;
14 return;
15}
16
17// Funktion fuer die rechte Seite der DGL in 3D
18void ZeroFErhsFunc3D(double* x, double* result, double* parameters)
19{
20 // Wir setzen die rechte Seite f_vec = (0, 0, 0)
21 result[0] = 0.0;
22 result[1] = 0.0;
23 result[2] = 0.0;
24 return;
25}
26
27double HeuristicScaling(double* x, double* parameter)
28{
29 if(x[0] < parameter[0]) // Wenn die Distanz des Schwerpunkts des Elements zum Interface kleiner als 0.03 ist
30 {
31 return parameter[1];
32 }
33 else
34 {
35 return 1.0;
36 }
37}
38
39
40template<class SC,class LO,class GO,class NO>
41Geometry<SC,LO,GO,NO>::Geometry(const DomainConstPtr_Type &domain, std::string FEType, ParameterListPtr_Type parameterList):
42Problem_Type(parameterList,domain->getComm())
43{
44 this->addVariable( domain , FEType , "d_f" , domain->getDimension());
45 this->dim_ = this->getDomain(0)->getDimension();
46}
47
48
49template<class SC,class LO,class GO,class NO>
50Geometry<SC,LO,GO,NO>::~Geometry()
51{
52
53}
54
55template<class SC,class LO,class GO,class NO>
56void Geometry<SC,LO,GO,NO>::info(){
57 this->infoProblem();
58}
59
60template<class SC,class LO,class GO,class NO>
61void Geometry<SC,LO,GO,NO>::assemble( std::string type ) const
62{
63
64 MatrixPtr_Type H = Teuchos::rcp( new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(0)->getDimension() * this->getDomain(0)->getApproxEntriesPerRow() ) );
65
66 if (this->parameterList_->sublist("Parameter").get("Model","Laplace")=="Laplace"){
67 if (this->verbose_)
68 std::cout << "-- Assembly Geometry (scaled Laplace)... " << std::flush;
69 double distanceLaplace = this->parameterList_->sublist("Parameter").get("Distance Laplace",0.03);
70 double coefficientLaplace = this->parameterList_->sublist("Parameter").get("Coefficient Laplace",1000.);
71 if (this->verbose_){
72 std::cout << "\n Distance Laplace = " << distanceLaplace << " coefficient Laplace = " << coefficientLaplace << " ... " << std::flush;
73 }
74 vec_dbl_Type parameter(2);
75 parameter[0] = distanceLaplace;
76 parameter[1] = coefficientLaplace;
77
78 this->feFactory_->assemblyLaplaceXDim(this->dim_, this->getDomain(0)->getFEType(), H, HeuristicScaling, &(parameter.at(0)) );
79 }
80 else if (this->parameterList_->sublist("Parameter").get("Model","Laplace")=="Elasticity"){
81 if (this->verbose_)
82 std::cout << "-- Assembly Geometry (linear elasticity)... " << std::flush;
83 double poissonRatio = this->parameterList_->sublist("Parameter").get("Poisson Ratio",0.3);
84 double mu = this->parameterList_->sublist("Parameter").get("Mu",2.0e+6);
85 double youngModulus = mu*2.*(1 + poissonRatio);
86 double lambda = (poissonRatio*youngModulus)/((1 + poissonRatio)*(1 - 2*poissonRatio));
87 if (this->verbose_){
88 std::cout << "\n Poisson ratio = " << poissonRatio << " mu = "<<mu << " lambda = "<< lambda << " E = " << youngModulus << "... " << std::flush;
89 }
90
91 this->feFactory_->assemblyLinElasXDim( this->dim_, this->getDomain(0)->getFEType(), H, lambda, mu );
92 }
93 else
94 TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Unknown model for geometry.");
95
96 this->system_->addBlock( H, 0, 0 );
97
98 this->assembleSourceTerm( 0./*time*/ );
99
100 this->addToRhs( this->sourceTerm_ );
101
102 if (this->verbose_)
103 std::cout << "done -- " << std::endl;
104}
105
106}
107#endif
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36