Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-elasticity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-elasticity
Commits
6935f934
Commit
6935f934
authored
12 years ago
by
akbib
Committed by
akbib@FU-BERLIN.DE
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
also test the 2D case
[[Imported from SVN: r11302]]
parent
5de5af51
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
test/materialtest.cc
+38
-7
38 additions, 7 deletions
test/materialtest.cc
with
38 additions
and
7 deletions
test/materialtest.cc
+
38
−
7
View file @
6935f934
...
@@ -9,10 +9,10 @@
...
@@ -9,10 +9,10 @@
#include
<dune/grid/uggrid.hh>
#include
<dune/grid/uggrid.hh>
#include
<dune/grid/geometrygrid/grid.hh>
#include
<dune/grid/geometrygrid/grid.hh>
#include
<dune/grid/io/file/amirameshreader.hh>
#include
<dune/fufem/makesphere.hh>
#include
<dune/fufem/makesphere.hh>
#include
<dune/fufem/makering.hh>
#include
<dune/fufem/functions/basisgridfunction.hh>
#include
<dune/fufem/functions/basisgridfunction.hh>
#include
<dune/fufem/functions/deformationfunction.hh>
#include
<dune/fufem/functions/deformationfunction.hh>
#include
<dune/fufem/functionspacebases/p1nodalbasis.hh>
#include
<dune/fufem/functionspacebases/p1nodalbasis.hh>
...
@@ -23,15 +23,17 @@
...
@@ -23,15 +23,17 @@
#include
<dune/elasticity/materials/geomexactstvenantkirchhoffmaterial.hh>
#include
<dune/elasticity/materials/geomexactstvenantkirchhoffmaterial.hh>
#include
<dune/elasticity/assemblers/neohookeassembler.hh>
#include
<dune/elasticity/assemblers/neohookeassembler.hh>
const
int
dim
=
3
;
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
dim
>
>
VectorType
;
typedef
Dune
::
BCRSMatrix
<
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
>
MatrixType
;
template
<
class
Basis
,
class
Material
>
template
<
class
Basis
,
class
Material
>
bool
checkHessian
(
const
Basis
&
basis
,
Material
&
material
,
double
eps
)
bool
checkHessian
(
const
Basis
&
basis
,
Material
&
material
,
double
eps
)
{
{
const
int
dim
=
Basis
::
GridView
::
dimension
;
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
dim
>
>
VectorType
;
typedef
Dune
::
BCRSMatrix
<
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
>
MatrixType
;
VectorType
conf
(
basis
.
getGridView
().
size
(
dim
));
VectorType
conf
(
basis
.
getGridView
().
size
(
dim
));
conf
=
0
;
conf
=
0
;
typedef
BasisGridFunction
<
Basis
,
VectorType
>
GridFunc
;
typedef
BasisGridFunction
<
Basis
,
VectorType
>
GridFunc
;
...
@@ -44,7 +46,7 @@ bool checkHessian(const Basis& basis, Material& material,double eps)
...
@@ -44,7 +46,7 @@ bool checkHessian(const Basis& basis, Material& material,double eps)
MatrixType
exactHessian
;
MatrixType
exactHessian
;
OperatorAssembler
<
Basis
,
Basis
>
opAss
(
basis
,
basis
);
OperatorAssembler
<
Basis
,
Basis
>
opAss
(
basis
,
basis
);
opAss
.
assemble
(
locHessian
,
exactHessian
);
opAss
.
assemble
(
locHessian
,
exactHessian
);
/*
/*
Dune::NeoHookeAssembler<Basis,Basis,6> neoAss(basis,basis);
Dune::NeoHookeAssembler<Basis,Basis,6> neoAss(basis,basis);
neoAss.setEandNu(1e5,0.3);
neoAss.setEandNu(1e5,0.3);
...
@@ -120,6 +122,10 @@ bool checkHessian(const Basis& basis, Material& material,double eps)
...
@@ -120,6 +122,10 @@ bool checkHessian(const Basis& basis, Material& material,double eps)
template
<
class
Basis
,
class
Material
>
template
<
class
Basis
,
class
Material
>
bool
checkLinearization
(
const
Basis
&
basis
,
Material
&
material
,
double
eps
)
bool
checkLinearization
(
const
Basis
&
basis
,
Material
&
material
,
double
eps
)
{
{
const
int
dim
=
Basis
::
GridView
::
dimension
;
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
dim
>
>
VectorType
;
typedef
Dune
::
BCRSMatrix
<
Dune
::
FieldMatrix
<
double
,
dim
,
dim
>
>
MatrixType
;
VectorType
conf
(
basis
.
getGridView
().
size
(
dim
));
VectorType
conf
(
basis
.
getGridView
().
size
(
dim
));
conf
=
0
;
conf
=
0
;
...
@@ -188,12 +194,12 @@ int main (int argc, char *argv[]) try
...
@@ -188,12 +194,12 @@ int main (int argc, char *argv[]) try
eps
=
atof
(
argv
[
1
]);
eps
=
atof
(
argv
[
1
]);
std
::
cout
<<
"eps "
<<
eps
<<
std
::
endl
;
std
::
cout
<<
"eps "
<<
eps
<<
std
::
endl
;
typedef
UGGrid
<
dim
>
GridType
;
typedef
UGGrid
<
3
>
GridType
;
GridType
*
grid
=
new
GridType
;
GridType
*
grid
=
new
GridType
;
// make sphere grid
// make sphere grid
FieldVector
<
double
,
dim
>
center
(
0
);
FieldVector
<
double
,
3
>
center
(
0
);
double
radius
=
1
;
double
radius
=
1
;
makeSphere
(
*
grid
,
center
,
radius
);
makeSphere
(
*
grid
,
center
,
radius
);
...
@@ -239,6 +245,31 @@ int main (int argc, char *argv[]) try
...
@@ -239,6 +245,31 @@ int main (int argc, char *argv[]) try
checkLinearization
(
p1Basis
,
material
,
eps
);
checkLinearization
(
p1Basis
,
material
,
eps
);
checkHessian
(
p1Basis
,
material
,
eps
);
checkHessian
(
p1Basis
,
material
,
eps
);
std
::
cout
<<
"Checking 2D case!
\n
"
;
typedef
UGGrid
<
2
>
GridType2
;
GridType2
*
grid2
=
new
GridType2
;
FieldVector
<
double
,
2
>
cent2
(
0
);
makeRingSegment2D
(
cent2
,
0.2
,
1
,
0
,
1.5
,
*
grid2
,
10
,
false
);
grid2
->
setRefinementType
(
GridType2
::
COPY
);
for
(
int
i
=
0
;
i
<
1
;
i
++
)
grid2
->
globalRefine
(
1
);
// Create the materials
typedef
P1NodalBasis
<
GridType2
::
LeafGridView
>
P1Basis2
;
P1Basis2
p1Basis2
(
grid2
->
leafView
());
// make a material
typedef
NeoHookeMaterial
<
P1Basis2
>
MaterialType2
;
MaterialType2
material2
;
material2
.
setup
(
1e5
,
0.3
,
p1Basis2
);
checkLinearization
(
p1Basis2
,
material2
,
eps
);
checkHessian
(
p1Basis2
,
material2
,
eps
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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