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
cc59328b
Commit
cc59328b
authored
3 years ago
by
Vanraes Valentin
Browse files
Options
Downloads
Patches
Plain Diff
Correction Compute Normal
parent
7a8f4c73
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
srcs/FEM/FEM_Functions.cpp
+29
-3
29 additions, 3 deletions
srcs/FEM/FEM_Functions.cpp
with
29 additions
and
3 deletions
srcs/FEM/FEM_Functions.cpp
+
29
−
3
View file @
cc59328b
...
@@ -70,6 +70,28 @@ void Compute_B_matrix(const int j, const int numNodes, const std::vector<double>
...
@@ -70,6 +70,28 @@ void Compute_B_matrix(const int j, const int numNodes, const std::vector<double>
}
}
}
}
//Compute the normal of one element
void
Compute_Normal
(
std
::
vector
<
double
>
&
normalElement
,
std
::
vector
<
int
>
ez
,
std
::
vector
<
double
>
all_nodecoord
,
std
::
vector
<
std
::
vector
<
std
::
size_t
>>
elementTags
,
std
::
vector
<
std
::
size_t
>
all_nodeTags
,
int
i
){
for
(
std
::
size_t
el
=
0
;
el
<
elementTags
[
i
].
size
();
el
++
){
int
it1
=
all_nodeTags
[
2
*
el
];
int
it2
=
all_nodeTags
[
2
*
el
+
1
];
double
x1
=
all_nodecoord
[
3
*
(
it1
-
1
)];
double
y1
=
all_nodecoord
[
3
*
(
it1
-
1
)
+
1
];
double
x2
=
all_nodecoord
[
3
*
(
it2
-
1
)];
double
y2
=
all_nodecoord
[
3
*
(
it2
-
1
)
+
1
];
std
::
vector
<
double
>
vectorElement
;
vectorElement
[
0
]
=
x2
-
x1
;
vectorElement
[
1
]
=
y2
-
y1
;
normalElement
[
0
]
=
vectorElement
[
1
]
*
ez
[
2
]
;
normalElement
[
1
]
=
-
vectorElement
[
1
]
*
ez
[
2
];
}
}
//Get physical properties of domain
//Get physical properties of domain
void
Get_physical_Prop_Domain
(
const
std
::
vector
<
std
::
string
>
keys
,
double
&
E
,
double
&
nu
,
double
&
rho
,
void
Get_physical_Prop_Domain
(
const
std
::
vector
<
std
::
string
>
keys
,
double
&
E
,
double
&
nu
,
double
&
rho
,
...
@@ -111,7 +133,8 @@ void Get_physical_Prop_Domain(const std::vector<std::string> keys, double & E, d
...
@@ -111,7 +133,8 @@ void Get_physical_Prop_Domain(const std::vector<std::string> keys, double & E, d
// we first consider the K matrix and the volumic part of the f vector
// we first consider the K matrix and the volumic part of the f vector
void
Loop_K_F
(
const
Eigen
::
Matrix
<
double
,
3
,
3
>
H_matrix
,
const
double
rho
,
const
double
bx
,
const
double
by
,
void
Loop_K_F
(
const
Eigen
::
Matrix
<
double
,
3
,
3
>
H_matrix
,
const
double
rho
,
const
double
bx
,
const
double
by
,
const
std
::
string
integration_rule
,
const
std
::
string
integration_rule
,
const
std
::
vector
<
double
>
all_nodecoord
,
std
::
vector
<
double
>
&
normalElement
,
const
std
::
vector
<
int
>
ez
,
int
&
dim
,
int
&
tag
,
std
::
vector
<
int
>
&
tags
,
int
&
dim
,
int
&
tag
,
std
::
vector
<
int
>
&
tags
,
Eigen
::
SparseMatrix
<
double
>
&
full_K_matrix
,
Eigen
::
SparseMatrix
<
double
>
&
full_K_matrix
,
std
::
vector
<
double
>
&
full_f_vector
,
std
::
vector
<
double
>
&
full_f_vector
,
...
@@ -157,6 +180,7 @@ void Loop_K_F(const Eigen::Matrix<double, 3, 3> H_matrix, const double rho, cons
...
@@ -157,6 +180,7 @@ void Loop_K_F(const Eigen::Matrix<double, 3, 3> H_matrix, const double rho, cons
int
numComponents
,
numOrientations
;
int
numComponents
,
numOrientations
;
std
::
vector
<
double
>
basisFunctions
;
std
::
vector
<
double
>
basisFunctions
;
std
::
vector
<
double
>
basisFunctionsGradient
;
std
::
vector
<
double
>
basisFunctionsGradient
;
gmsh
::
model
::
mesh
::
getBasisFunctions
(
elementTypes
[
i
],
localCoords
,
gmsh
::
model
::
mesh
::
getBasisFunctions
(
elementTypes
[
i
],
localCoords
,
"Lagrange"
,
numComponents
,
"Lagrange"
,
numComponents
,
basisFunctions
,
basisFunctions
,
...
@@ -166,7 +190,6 @@ void Loop_K_F(const Eigen::Matrix<double, 3, 3> H_matrix, const double rho, cons
...
@@ -166,7 +190,6 @@ void Loop_K_F(const Eigen::Matrix<double, 3, 3> H_matrix, const double rho, cons
"GradLagrange"
,
numComponents
,
"GradLagrange"
,
numComponents
,
basisFunctionsGradient
,
basisFunctionsGradient
,
numOrientations
);
numOrientations
);
/*---------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)
for
(
std
::
size_t
el
=
0
;
el
<
elementTags
[
i
].
size
();
el
++
){
for
(
std
::
size_t
el
=
0
;
el
<
elementTags
[
i
].
size
();
el
++
){
...
@@ -230,9 +253,11 @@ void Compute_Neumann_BC(const int numNodes, const int i, const std::vector<std::
...
@@ -230,9 +253,11 @@ void Compute_Neumann_BC(const int numNodes, const int i, const std::vector<std::
std
::
vector
<
double
>
&
full_f_vector
){
std
::
vector
<
double
>
&
full_f_vector
){
for
(
std
::
size_t
el
=
0
;
el
<
elementTags
[
i
].
size
();
el
++
){
for
(
std
::
size_t
el
=
0
;
el
<
elementTags
[
i
].
size
();
el
++
){
for
(
int
j
=
0
;
j
<
2
*
numNodes
;
++
j
){
for
(
int
j
=
0
;
j
<
2
*
numNodes
;
++
j
){
f_vector
[
j
]
=
0.
;
f_vector
[
j
]
=
0.
;
}
}
// looping over the Gauss points (formula of slide 17)
// looping over the Gauss points (formula of slide 17)
for
(
std
::
size_t
j
=
0
;
j
<
weights
.
size
();
++
j
){
for
(
std
::
size_t
j
=
0
;
j
<
weights
.
size
();
++
j
){
// looping over the number of shape functions
// looping over the number of shape functions
...
@@ -314,13 +339,14 @@ void Neumann_BC(const std::vector<std::string> keys, const std::string integrati
...
@@ -314,13 +339,14 @@ void Neumann_BC(const std::vector<std::string> keys, const std::string integrati
elementName
,
dim
,
order
,
elementName
,
dim
,
order
,
numNodes
,
localNodeCoord
,
numNodes
,
localNodeCoord
,
numPrimaryNodes
);
numPrimaryNodes
);
// get Gauss points coordinates and weights
// get Gauss points coordinates and weights
std
::
vector
<
double
>
localCoords
,
weights
;
std
::
vector
<
double
>
localCoords
,
weights
;
gmsh
::
model
::
mesh
::
getIntegrationPoints
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getIntegrationPoints
(
elementTypes
[
i
],
integration_rule
,
//maybe use different integration method on boundary than in domain
integration_rule
,
//maybe use different integration method on boundary than in domain
localCoords
,
weights
);
localCoords
,
weights
);
// get determinants and Jacobians (only determinants will be useful)
// get determinants and Jacobians (only determinants will be useful)
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
std
::
vector
<
double
>
jacobians
,
determinants
,
coords
;
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
gmsh
::
model
::
mesh
::
getJacobians
(
elementTypes
[
i
],
...
...
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