Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Multiphysics 0471
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Denis Louis
Multiphysics 0471
Commits
b9b37611
Commit
b9b37611
authored
3 years ago
by
Denis Louis
Browse files
Options
Downloads
Patches
Plain Diff
debug multiple FEM domains
parent
36ca5ef6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
srcs/FEM/functionsFEM.cpp
+18
-7
18 additions, 7 deletions
srcs/FEM/functionsFEM.cpp
with
18 additions
and
7 deletions
srcs/FEM/functionsFEM.cpp
+
18
−
7
View file @
b9b37611
...
@@ -129,7 +129,7 @@ void fillElementalKandF(const Eigen::Matrix<double, 3, 3> H_matrix, const double
...
@@ -129,7 +129,7 @@ void fillElementalKandF(const Eigen::Matrix<double, 3, 3> H_matrix, const double
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
localCoords
,
jacobians
,
localCoords
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
k
]
);
// values and derivatives of the shape functions at the Gauss points of the reference element
// values and derivatives of the shape functions at the Gauss points of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
@@ -334,7 +334,7 @@ void includeNeumannBC(const std::vector<std::string> & keys, const std::string &
...
@@ -334,7 +334,7 @@ void includeNeumannBC(const std::vector<std::string> & keys, const std::string &
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
localCoords
,
jacobians
,
localCoords
,
jacobians
,
determinants
,
coords
,
tags
[
k
]);
// ai dû rajouter mon tags[k] pr focus on this particular entity
determinants
,
coords
,
tags
[
k
]);
// ai dû rajouter mon tags[k] pr focus on this particular entity
gmsh
::
model
::
mesh
::
getBasisFunctions
(
elementTypes
[
i
],
localCoords
,
gmsh
::
model
::
mesh
::
getBasisFunctions
(
elementTypes
[
i
],
localCoords
,
"Lagrange"
,
numComponents
,
"Lagrange"
,
numComponents
,
...
@@ -600,7 +600,7 @@ void computeStressStrainElNodal(int & dim, std::vector<int> & tags,
...
@@ -600,7 +600,7 @@ void computeStressStrainElNodal(int & dim, std::vector<int> & tags,
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
ityp
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
ityp
],
paramCoord
,
jacobians
,
paramCoord
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
entityTag
]
);
// derivatives of the shape functions at the nodes of the reference element
// derivatives of the shape functions at the nodes of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
@@ -1275,7 +1275,7 @@ void computeStrainEnergy(double & strainEnergy, int & dim, std::vector<int> & ta
...
@@ -1275,7 +1275,7 @@ void computeStrainEnergy(double & strainEnergy, int & dim, std::vector<int> & ta
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
localCoords
,
jacobians
,
localCoords
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
k
]
);
// values and derivatives of the shape functions at the Gauss points of the reference element
// values and derivatives of the shape functions at the Gauss points of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
@@ -1424,7 +1424,9 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
...
@@ -1424,7 +1424,9 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
localCoords
,
jacobians
,
localCoords
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
k
]);
//big modif
//std::cout << "entity " << k << ", element type " << i << ",jacobians size: " << jacobians.size() << ", weights size: " << weights.size() << "\n";
// values and derivatives of the shape functions at the Gauss points of the reference element
// values and derivatives of the shape functions at the Gauss points of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
@@ -1438,6 +1440,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
...
@@ -1438,6 +1440,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
basisFunctionsGradient
,
basisFunctionsGradient
,
numOrientations
);
numOrientations
);
//std::cout << "entity " << k << ", element tags " << elementTags[i].size() << ",jacobians size: " << jacobians.size() << ",determinants size: " << determinants.size() << ", weights size: " << weights.size() << ", basis functions size: " << basisFunctions.size() << ", basis functions gradient size: " << basisFunctionsGradient.size() << "\n";
/*---------computing the K matrix (and f vector, only volumic part for now)------*/
/*---------computing the K matrix (and f vector, only volumic part for now)------*/
// looping over the elements (computing elemental K matrices)
// looping over the elements (computing elemental K matrices)
//double test1 = omp_get_wtime();
//double test1 = omp_get_wtime();
...
@@ -1468,6 +1472,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
...
@@ -1468,6 +1472,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
jacob2D
(
1
,
0
)
=
jacob
(
1
,
0
);
jacob2D
(
1
,
0
)
=
jacob
(
1
,
0
);
jacob2D
(
0
,
1
)
=
jacob
(
0
,
1
);
jacob2D
(
0
,
1
)
=
jacob
(
0
,
1
);
jacob2D
(
1
,
1
)
=
jacob
(
1
,
1
);
jacob2D
(
1
,
1
)
=
jacob
(
1
,
1
);
//std::cout << "element tag: " << elementTags[i][el] << "jacob2d: " << jacob2D << "\n";
// computing the inverse
// computing the inverse
Eigen
::
Matrix
<
double
,
2
,
2
>
jacobinv
=
jacob2D
.
inverse
();
Eigen
::
Matrix
<
double
,
2
,
2
>
jacobinv
=
jacob2D
.
inverse
();
...
@@ -1480,6 +1486,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
...
@@ -1480,6 +1486,8 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
computeBmatrix
(
j
,
numNodes
,
basisFunctionsGradient
,
determinants
,
jacobinvtrans
,
B_matrix
);
computeBmatrix
(
j
,
numNodes
,
basisFunctionsGradient
,
determinants
,
jacobinvtrans
,
B_matrix
);
//std::cout << "element tag: " << elementTags[i][el] << "B matrix: " << B_matrix << "\n";
for
(
int
l
=
0
;
l
<
numNodes
;
++
l
){
// looping over the number of shape functions
for
(
int
l
=
0
;
l
<
numNodes
;
++
l
){
// looping over the number of shape functions
f_vector
[
2
*
l
]
=
f_vector
[
2
*
l
]
+
rho
*
basisFunctions
[
l
+
numNodes
*
j
]
*
bx
*
determinants
[
j
+
weights
.
size
()
*
el
]
*
weights
[
j
];
//pas oublier le dét !
f_vector
[
2
*
l
]
=
f_vector
[
2
*
l
]
+
rho
*
basisFunctions
[
l
+
numNodes
*
j
]
*
bx
*
determinants
[
j
+
weights
.
size
()
*
el
]
*
weights
[
j
];
//pas oublier le dét !
...
@@ -1487,11 +1495,14 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
...
@@ -1487,11 +1495,14 @@ void assembleKlistVolumicF(const Eigen::Matrix<double, 3, 3> H_matrix, const dou
}
}
K_matrix
=
K_matrix
+
B_matrix
.
transpose
()
*
H_matrix
*
B_matrix
*
determinants
[
j
+
weights
.
size
()
*
el
]
*
weights
[
j
];
K_matrix
=
K_matrix
+
B_matrix
.
transpose
()
*
H_matrix
*
B_matrix
*
determinants
[
j
+
weights
.
size
()
*
el
]
*
weights
[
j
];
//std::cout << "determinant: " << determinants[j+weights.size()*el] << ", weight: " << weights[j] << "\n";
}
}
/*------------- ASSEMBLY PROCESS ------------*/
/*------------- ASSEMBLY PROCESS ------------*/
// USE LIST OF TRIPLETS TO PUSH ONLY ONCE -> more rapid and easier to parallelize
// USE LIST OF TRIPLETS TO PUSH ONLY ONCE -> more rapid and easier to parallelize
assembleKtriplet
(
i
,
el
,
nodeTags
,
numNodes
,
nodeIndexMap
,
my_k_list
[
omp_get_thread_num
()],
K_matrix
,
f_vector
);
assembleKtriplet
(
i
,
el
,
nodeTags
,
numNodes
,
nodeIndexMap
,
my_k_list
[
omp_get_thread_num
()],
K_matrix
,
f_vector
);
assembleFthread
(
i
,
el
,
nodeTags
,
numNodes
,
nodeIndexMap
,
thread_f_vector
[
omp_get_thread_num
()],
f_vector
);
assembleFthread
(
i
,
el
,
nodeTags
,
numNodes
,
nodeIndexMap
,
thread_f_vector
[
omp_get_thread_num
()],
f_vector
);
//std::cout << "element tag: " << elementTags[i][el] << "local K matrix: " << K_matrix << "\n";
}
}
//double test2 = omp_get_wtime() - test1;
//double test2 = omp_get_wtime() - test1;
//std::cout << "loop time: " << test2 << "\n";
//std::cout << "loop time: " << test2 << "\n";
...
@@ -1593,7 +1604,7 @@ void computeStressStrainLinearWay(int & dim, std::vector<int> & tags,
...
@@ -1593,7 +1604,7 @@ void computeStressStrainLinearWay(int & dim, std::vector<int> & tags,
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
ityp
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
ityp
],
paramCoord
,
jacobians
,
paramCoord
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
entityTag
]
);
// derivatives of the shape functions at the nodes of the reference element
// derivatives of the shape functions at the nodes of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
@@ -1705,7 +1716,7 @@ void computeStrainEnergyLinearWay(double & strainEnergy, int & dim, std::vector<
...
@@ -1705,7 +1716,7 @@ void computeStrainEnergyLinearWay(double & strainEnergy, int & dim, std::vector<
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
localCoords
,
jacobians
,
localCoords
,
jacobians
,
determinants
,
coords
);
determinants
,
coords
,
tags
[
k
]
);
// values and derivatives of the shape functions at the Gauss points of the reference element
// values and derivatives of the shape functions at the Gauss points of the reference element
// we are here working with derivatives in the reference space, same for all elements
// we are here working with derivatives in the reference space, same for all elements
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment