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