Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CardMech
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Harbor 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
KIT
Mpp
CardMech
Commits
37573893
Commit
37573893
authored
1 week ago
by
Laura Stengel
Browse files
Options
Downloads
Patches
Plain Diff
fixed prestress for DG and added needed (missing) methods
parent
e5a083db
No related branches found
Branches containing commit
No related tags found
1 merge request
!276
i..
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/elasticity/assemble/DGElasticity.cpp
+156
-7
156 additions, 7 deletions
src/elasticity/assemble/DGElasticity.cpp
src/elasticity/assemble/DGElasticity.hpp
+4
-0
4 additions, 0 deletions
src/elasticity/assemble/DGElasticity.hpp
with
160 additions
and
7 deletions
src/elasticity/assemble/DGElasticity.cpp
+
156
−
7
View file @
37573893
...
...
@@ -568,6 +568,44 @@ void DGElasticity::Jacobi(const cell &c, const Vector &U, Matrix &A) const {
}
}
//TODO stimmt das so?
void
DGElasticity
::
TractionStiffness
(
Matrix
&
matrix
)
const
{
matrix
=
0
;
for
(
cell
c
=
matrix
.
cells
();
c
!=
matrix
.
cells_end
();
++
c
)
{
DGVectorFieldElement
E
(
matrix
,
*
c
);
DGSizedRowEntries
A_c
(
matrix
,
*
c
,
E
.
shape_size
(),
*
c
,
E
.
shape_size
());
for
(
int
f
=
0
;
f
<
c
.
Faces
();
++
f
)
{
DGVectorFieldFaceElement
faceElem
(
matrix
,
*
c
,
f
);
//passt das hier zb?
if
(
matrix
.
OnBoundary
(
*
c
,
f
))
{
int
bc
=
matrix
.
GetMesh
().
BoundaryFacePart
(
c
.
Face
(
f
));
if
((
bc
>=
ROBIN_BC_EPI
)
&&
(
bc
<=
ROBIN_BC_BASE
))
{
for
(
int
q
=
0
;
q
<
faceElem
.
nQ
();
++
q
)
{
VectorField
n
=
faceElem
.
QNormal
(
q
);
auto
N
=
Product
(
n
,
n
);
double
w
=
faceElem
.
QWeight
(
q
);
for
(
int
i
=
0
;
i
<
faceElem
.
shape_size
();
++
i
)
{
for
(
int
k
=
0
;
k
<
E
.
Dim
();
++
k
)
{
auto
phi_ik
=
faceElem
.
VectorComponentValue
(
q
,
i
,
k
);
auto
Nphi_ik
=
N
*
faceElem
.
VectorComponentValue
(
q
,
i
,
k
);
for
(
int
j
=
0
;
j
<
faceElem
.
shape_size
();
++
j
)
{
for
(
int
l
=
0
;
l
<
E
.
Dim
();
++
l
)
{
auto
phi_jl
=
faceElem
.
VectorComponentValue
(
q
,
j
,
l
);
A_c
(
i
,
j
,
k
,
l
)
+=
w
*
eProblem
.
TractionStiffness
(
Time
(),
faceElem
.
QPoint
(
q
),
E
.
Bnd
(
f
))
*
Nphi_ik
*
phi_jl
;
}
}
}
}
}
}
}
}
}
}
void
DGElasticity
::
Project
(
const
Vector
&
fine
,
Vector
&
u
)
const
{
int
dlevel
=
fine
.
SpaceLevel
()
-
u
.
SpaceLevel
();
...
...
@@ -854,14 +892,11 @@ double DGElasticity::H1Error(const Vector &u, const Vector &reference) const {
}
void
DGElasticity
::
prestress
(
const
Vector
&
u
,
Vector
&
pStress
)
{
Prestress
=
std
::
make_unique
<
Vector
>
(
0.0
,
u
);
//TODO THis has to be updated
for
(
cell
c
=
u
.
cells
();
c
!=
u
.
cells_end
();
++
c
)
{
const
auto
&
cellMat
=
eProblem
.
GetMaterial
(
c
);
DGVectorFieldElement
E
(
u
,
*
c
);
DGSizedRowBndValues
r_c
(
*
Pres
tress
,
*
c
,
E
.
shape_size
());
DGSizedRowBndValues
r_c
(
pS
tress
,
*
c
,
E
.
shape_size
());
Tensor
Q
=
OrientationMatrix
(
c
.
GetData
());
...
...
@@ -880,10 +915,119 @@ void DGElasticity::prestress(const Vector &u, Vector &pStress) {
}
}
}
}
for
(
int
f
=
0
;
f
<
c
.
Faces
();
++
f
)
{
double
s
=
cellMat
.
Isochoric
().
GetMaxParameter
()
*
(
pow
(
degree
,
2
)
*
penalty
)
/
u
.
GetMesh
().
MaxMeshWidth
();
DGVectorFieldFaceElement
FE
(
u
,
*
c
,
f
);
if
(
E
.
Bnd
(
f
)
==
1
)
{
// Dirichlet-RB
for
(
int
q
=
0
;
q
<
FE
.
nQ
();
++
q
)
{
double
w
=
FE
.
QWeight
(
q
);
Point
z
=
FE
.
QPoint
(
q
);
VectorField
N
=
FE
.
QNormal
(
q
);
VectorField
U
=
eProblem
.
Deformation
(
Time
(),
z
);
VectorField
u_diff
=
FE
.
VectorValue
(
q
,
u
)
-
U
;
Tensor
F
=
DeformationGradient
(
FE
,
q
,
u
);
auto
Fiso
=
eProblem
.
IsochoricPart
(
F
);
for
(
int
i
=
0
;
i
<
FE
.
shape_size
();
++
i
)
for
(
int
k
=
0
;
k
<
E
.
Dim
();
++
k
)
{
auto
u_ik
=
FE
.
VectorComponentValue
(
q
,
i
,
k
);
auto
Du_ik
=
FE
.
VectorRowGradient
(
q
,
i
,
k
);
double
SN
=
cellMat
.
TotalDerivative
(
Fiso
,
F
,
Q
,
Product
(
u_ik
,
N
));
double
SN_ik
=
cellMat
.
TotalSecondDerivative
(
Fiso
,
F
,
Q
,
Du_ik
,
Product
(
u_diff
,
N
));
r_c
(
i
,
k
)
-=
w
*
(
SN
+
SN_ik
*
sign
-
s
*
u_diff
*
u_ik
);
}
}
}
else
if
(
E
.
Bnd
(
f
)
==
199
)
{
// Dirichlet-RB
for
(
int
q
=
0
;
q
<
FE
.
nQ
();
++
q
)
{
double
w
=
FE
.
QWeight
(
q
);
Point
z
=
FE
.
QPoint
(
q
);
VectorField
N
=
FE
.
QNormal
(
q
);
VectorField
u_diff
=
FE
.
VectorValue
(
q
,
u
);
Tensor
F
=
DeformationGradient
(
FE
,
q
,
u
);
auto
Fiso
=
eProblem
.
IsochoricPart
(
F
);
for
(
int
i
=
0
;
i
<
FE
.
shape_size
();
++
i
)
for
(
int
k
=
0
;
k
<
E
.
Dim
();
++
k
)
{
auto
u_ik
=
FE
.
VectorComponentValue
(
q
,
i
,
k
);
auto
Du_ik
=
FE
.
VectorRowGradient
(
q
,
i
,
k
);
double
SN
=
cellMat
.
TotalDerivative
(
Fiso
,
F
,
Q
,
Product
(
u_ik
,
N
));
double
SN_ik
=
cellMat
.
TotalSecondDerivative
(
Fiso
,
F
,
Q
,
Du_ik
,
Product
(
u_diff
,
N
));
r_c
(
i
,
k
)
-=
w
*
(
SN
+
SN_ik
*
sign
-
s
*
u_diff
*
u_ik
);
}
}
}
else
if
(
E
.
Bnd
(
f
)
==
-
1
)
{
cell
cf
=
pStress
.
find_neighbour_cell
(
c
,
f
);
if
(
cf
()
<
c
())
continue
;
int
f1
=
pStress
.
find_neighbour_face_id
(
c
.
Face
(
f
),
cf
);
DGVectorFieldElement
E_nghbr
(
u
,
*
cf
);
DGVectorFieldFaceElement
FE_nghbr
(
pStress
,
*
cf
,
f1
);
DGSizedRowBndValues
r_cf
(
pStress
,
*
cf
,
E_nghbr
.
shape_size
());
s
=
cellMat
.
Isochoric
().
GetMaxParameter
()
*
(
pow
(
degree
,
2
)
*
penalty
)
/
u
.
GetMesh
().
MaxMeshWidth
();
for
(
int
q
=
0
;
q
<
FE
.
nQ
();
++
q
)
{
double
w
=
FE
.
QWeight
(
q
);
Point
z
=
FE
.
QPoint
(
q
);
VectorField
N
=
FE
.
QNormal
(
q
);
// für erstes Face-Element
VectorField
U
=
FE
.
VectorValue
(
q
,
u
);
Tensor
F
=
DeformationGradient
(
FE
,
q
,
u
);
auto
Fiso
=
eProblem
.
IsochoricPart
(
F
);
Tensor
inverseFA
=
mat
::
active_deformation
(
Q
,
FE
.
VectorValue
(
q
,
*
gamma
));
F
=
F
*
inverseFA
;
// das gleiche für das zweite Face-Element
int
q1
=
FE
.
findQPointID
(
FE_nghbr
,
z
);
VectorField
u_nghbr
=
FE_nghbr
.
VectorValue
(
q1
,
u
);
Tensor
F_nghbr
=
DeformationGradient
(
FE_nghbr
,
q1
,
u
);
auto
Fiso_nghbr
=
eProblem
.
IsochoricPart
(
F_nghbr
);
Tensor
inverseFA_nghbr
=
mat
::
active_deformation
(
Q
,
FE_nghbr
.
VectorValue
(
q1
,
*
gamma
));
F_nghbr
=
F_nghbr
*
inverseFA_nghbr
;
for
(
int
i
=
0
;
i
<
FE
.
shape_size
();
++
i
)
{
for
(
int
k
=
0
;
k
<
E
.
Dim
();
++
k
)
{
auto
u_ik
=
FE
.
VectorComponentValue
(
q
,
i
,
k
);
auto
Du_ik
=
FE
.
VectorRowGradient
(
q
,
i
,
k
);
Prestress
->
ClearDirichletValues
();
Prestress
->
Collect
();
double
SN
=
cellMat
.
TotalDerivative
(
Fiso
,
F
,
Q
,
Product
(
u_ik
,
N
));
double
SN_ik
=
cellMat
.
TotalSecondDerivative
(
Fiso
,
F
,
Q
,
Du_ik
,
Product
(
U
,
N
));
double
SN_nghbr
=
cellMat
.
TotalDerivative
(
Fiso_nghbr
,
F_nghbr
,
Q
,
Product
(
u_ik
,
N
));
double
SN_ik_nghbr
=
cellMat
.
TotalSecondDerivative
(
Fiso
,
F
,
Q
,
Du_ik
,
Product
(
u_nghbr
,
N
));
r_c
(
i
,
k
)
+=
w
*
(
s
*
U
*
u_ik
-
0.5
*
SN
-
0.5
*
SN_ik
*
sign
);
r_c
(
i
,
k
)
+=
w
*
(
-
s
*
u_nghbr
*
u_ik
-
0.5
*
SN_nghbr
+
0.5
*
SN_ik_nghbr
*
sign
);
}
}
for
(
int
j
=
0
;
j
<
FE_nghbr
.
shape_size
();
++
j
)
for
(
int
k
=
0
;
k
<
E
.
Dim
();
++
k
)
{
auto
u_jk
=
FE_nghbr
.
VectorComponentValue
(
q1
,
j
,
k
);
auto
Du_jk
=
FE_nghbr
.
VectorRowGradient
(
q1
,
j
,
k
);
double
SN
=
cellMat
.
TotalDerivative
(
Fiso
,
F
,
Q
,
Product
(
u_jk
,
N
));
double
SN_jk
=
cellMat
.
TotalSecondDerivative
(
Fiso_nghbr
,
F_nghbr
,
Q
,
Du_jk
,
Product
(
U
,
N
));
double
SN_nghbr
=
cellMat
.
TotalDerivative
(
Fiso_nghbr
,
F_nghbr
,
Q
,
Product
(
u_jk
,
N
));
double
SN_jk_nghbr
=
cellMat
.
TotalSecondDerivative
(
Fiso_nghbr
,
F_nghbr
,
Q
,
Du_jk
,
Product
(
u_nghbr
,
N
));
r_cf
(
j
,
k
)
+=
w
*
(
s
*
u_nghbr
*
u_jk
+
0.5
*
SN_nghbr
+
0.5
*
SN_jk_nghbr
*
sign
);
r_cf
(
j
,
k
)
+=
w
*
(
-
s
*
U
*
u_jk
+
0.5
*
SN
-
0.5
*
SN_jk
*
sign
);
}
}
}
}
}
}
...
...
@@ -1278,3 +1422,8 @@ std::pair<double, double> DGElasticity::detF(const Vector &u) const {
return
{
Jmin
,
Jmax
};
}
void
DGElasticity
::
SetInitialValue
(
Vector
&
u
)
{
IElasticity
::
SetInitialValue
(
u
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/elasticity/assemble/DGElasticity.hpp
+
4
−
0
View file @
37573893
...
...
@@ -39,6 +39,8 @@ public:
void
Jacobi
(
const
cell
&
c
,
const
Vector
&
u
,
Matrix
&
A
)
const
override
;
void
TractionStiffness
(
Matrix
&
matrix
)
const
override
;
void
MassMatrix
(
Matrix
&
massMatrix
)
const
override
;
void
SystemMatrix
(
Matrix
&
systemMatrix
)
const
override
;
...
...
@@ -129,6 +131,8 @@ public:
}
std
::
pair
<
double
,
double
>
detF
(
const
Vector
&
u
)
const
override
;
void
SetInitialValue
(
Vector
&
u
)
override
;
};
#endif //DGELASTICITY_HPP
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