Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
AssembleFE_SCI_NH_def.hpp
1#ifndef ASSEMBLEFE_SCI_NH_DEF_hpp
2#define ASSEMBLEFE_SCI_NH_DEF_hpp
3
4#ifdef FEDD_HAVE_ACEGENINTERFACE
5#include <aceinterface.hpp>
6#endif
7
8#include <vector>
9// #include <iostream>
10
11namespace FEDD
12{
13
14 template <class SC, class LO, class GO, class NO>
15 AssembleFE_SCI_NH<SC, LO, GO, NO>::AssembleFE_SCI_NH(int flag, vec2D_dbl_Type nodesRefConfig, ParameterListPtr_Type params, tuple_disk_vec_ptr_Type tuple) : AssembleFE<SC, LO, GO, NO>(flag, nodesRefConfig, params, tuple)
16 {
17 // Extracting values from ParameterList
18 E0_ = this->params_->sublist("Parameter Solid").get("E", 379.95e-6);
19 E1_ = this->params_->sublist("Parameter Solid").get("E1", 300.0e-6);
20 poissonRatio_ = this->params_->sublist("Parameter Solid").get("Poisson Ratio", 0.49e-0);
21 c1_ = this->params_->sublist("Parameter Solid").get("c1", 0.25e-0);
22 D0_ = this->params_->sublist("Parameter Diffusion").get("D0", 6.0e-5);
23 m_ = this->params_->sublist("Parameter Diffusion").get("m", 0.0);
24 dofOrdering_ = this->params_->sublist("Parameter").get("Ordering", 2);
25
26 FEType_ = std::get<1>(this->diskTuple_->at(0)); // FEType of Disk
27 dofsSolid_ = std::get<2>(this->diskTuple_->at(0)); // Degrees of freedom per node
28 dofsChem_ = std::get<2>(this->diskTuple_->at(1)); // Degrees of freedom per node
29
30 numNodesSolid_ = std::get<3>(this->diskTuple_->at(0)); // Number of nodes of element
31 numNodesChem_ = std::get<3>(this->diskTuple_->at(1)); // Number of nodes of element
32
33 dofsElement_ = dofsSolid_ * numNodesSolid_ + dofsChem_ * numNodesChem_; // "Dimension of return matrix"
34
35 solution_n_.resize(60, 0.);
36 solution_n1_.resize(60, 0.);
37
38 /*timeParametersVec_.resize(0, vec_dbl_Type(2));
39 numSegments_ = this->params_->sublist("Timestepping Parameter").sublist("Timestepping Intervalls").get("Number of Segments",0);
40
41 for(int i=1; i <= numSegments_; i++){
42
43 double startTime = this->params_->sublist("Timestepping Parameter").sublist("Timestepping Intervalls").sublist(std::to_string(i)).get("Start Time",0.);
44 double dtTmp = this->params_->sublist("Timestepping Parameter").sublist("Timestepping Intervalls").sublist(std::to_string(i)).get("dt",0.1);
45
46 vec_dbl_Type segment = {startTime,dtTmp};
47 timeParametersVec_.push_back(segment);
48 }*/
49
50 }
51
52 template <class SC, class LO, class GO, class NO>
54 {
55
56 SmallMatrixPtr_Type elementMatrix = Teuchos::rcp(new SmallMatrix_Type(dofsElement_, 0.));
57
58 assembleDeformationDiffusionNeoHook(elementMatrix);
59 // elementMatrix->print();
60 this->jacobian_ = elementMatrix;
61 }
62
63 template <class SC, class LO, class GO, class NO>
65 {
66
67 // If we have a time segment setting we switch to the demanded time increment
68 /*for(int i=0; i<numSegments_ ; i++){
69 if(this->timeStep_ +1.0e-12 > timeParametersVec_[i][0])
70 this->timeIncrement_=timeParametersVec_[i][1];
71 }*/
72
73 this->timeStep_ = this->timeStep_ + this->timeIncrement_;
74
75 this->timeIncrement_ = dt;
76
77 for (int i = 0; i < 40; i++)
78 {
79 if (i < 30)
80 solution_n_[i] = (*this->solution_)[i];
81 else
82 solution_n_[i] = (*this->solution_)[i];
83 }
84 }
85
86 template <class SC, class LO, class GO, class NO>
88 {
89
90 this->rhsVec_.reset(new vec_dbl_Type(dofsElement_, 0.));
91#ifdef FEDD_HAVE_ACEGENINTERFACE
92
93 std::vector<double> positions(30);
94 int count = 0;
95 for (int i = 0; i < 10; i++)
96 {
97 for (int j = 0; j < 3; j++)
98 {
99 positions[count] = this->getNodesRefConfig()[i][j];
100 count++;
101 }
102 }
103
104 std::vector<double> displacements(30);
105 for (int i = 0; i < 30; i++){
106 displacements[i] = (*this->solution_)[i];
107 }
108 std::vector<double> concentrations(10);
109 for (int i = 0; i < 10; i++)
110 concentrations[i] = (*this->solution_)[i + 30];
111
112 std::vector<double> concentrationsLastConverged(10);
113 for (int i = 0; i < 10; i++)
114 concentrationsLastConverged[i] = (solution_n_)[i + 30];
115
116 std::vector<double> domainData(6);
117 domainData[0] = this->E0_;
118 domainData[1] = this->E1_;
119 domainData[2] = this->poissonRatio_;
120 domainData[3] = this->c1_;
121 domainData[4] = this->D0_;
122 domainData[5] = this->m_;
123
124 double timeIncrement = this->getTimeIncrement();
125
126 int integrationCode = 19;
127
128 AceGenInterface::DeformationDiffusionNeoHookTetrahedra3D10 neoHookeElement(&positions[0], &displacements[0], &concentrations[0], &concentrationsLastConverged[0], &domainData[0], timeIncrement, integrationCode);
129 neoHookeElement.computeTangentResidual();
130
131 double *residuum = neoHookeElement.getResiduum();
132
133 for (int i = 0; i < 40; i++)
134 (*this->rhsVec_)[i] = residuum[i];
135
136
137#endif
138
139 }
140
141
142 template <class SC, class LO, class GO, class NO>
143 void AssembleFE_SCI_NH<SC, LO, GO, NO>::assembleDeformationDiffusionNeoHook(SmallMatrixPtr_Type &elementMatrix)
144 {
145
146 std::vector<double> positions(30);
147#ifdef FEDD_HAVE_ACEGENINTERFACE
148
149 int count = 0;
150 for (int i = 0; i < 10; i++)
151 {
152 for (int j = 0; j < 3; j++)
153 {
154 positions[count] = this->getNodesRefConfig()[i][j];
155 count++;
156 }
157 }
158
159 std::vector<double> displacements(30);
160 for (int i = 0; i < 30; i++)
161 displacements[i] = (*this->solution_)[i];
162
163 std::vector<double> concentrations(10);
164 for (int i = 0; i < 10; i++)
165 concentrations[i] = (*this->solution_)[i + 30];
166
167 std::vector<double> concentrationsLastConverged(10);
168 for (int i = 0; i < 10; i++)
169 concentrationsLastConverged[i] = (solution_n_)[i + 30];
170
171 std::vector<double> domainData(6);
172 domainData[0] = this->E0_;
173 domainData[1] = this->E1_;
174 domainData[2] = this->poissonRatio_;
175 domainData[3] = this->c1_;
176 domainData[4] = this->D0_;
177 domainData[5] = this->m_;
178
179 double timeIncrement = this->getTimeIncrement();
180
181 int integrationCode = 19;
182
183 AceGenInterface::DeformationDiffusionNeoHookTetrahedra3D10 neoHookeElement(&positions[0], &displacements[0], &concentrations[0], &concentrationsLastConverged[0], &domainData[0], timeIncrement, integrationCode);
184 neoHookeElement.computeTangentResidual();
185
186 double **stiffnessMatrix = neoHookeElement.getStiffnessMatrix();
187
188
189 for (UN i = 0; i < this->dofsElement_; i++)
190 {
191 for (UN j = 0; j < this->dofsElement_; j++)
192 {
193 (*elementMatrix)[i][j] = stiffnessMatrix[i][j];
194 }
195 }
196#endif
197
198 }
199
200
201} // namespace FEDD
202#endif // ASSEMBLEFE_SCI_NH_DEF_hpp
void assembleRHS() override
Assemble the element right hand side vector.
Definition AssembleFE_SCI_NH_def.hpp:87
void advanceInTime(double dt) override
This function is called every time the FEDDLib proceeds from one to the next time step....
Definition AssembleFE_SCI_NH_def.hpp:64
void assembleJacobian() override
Assemble the element Jacobian matrix.
Definition AssembleFE_SCI_NH_def.hpp:53
This abstract class defining the interface for any type of element assembly rountines in the FEDDLib.
Definition AssembleFE_decl.hpp:61
double getTimeIncrement()
Definition AssembleFE_decl.hpp:203
vec2D_dbl_Type getNodesRefConfig()
Definition AssembleFE_def.hpp:142
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36