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