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
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Ansgar Burchardt
dune-elasticity
Commits
df1b3de6
Commit
df1b3de6
authored
6 years ago
by
Jonathan Youett
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup and reduce typedefs
parent
2922693c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/elasticity/materials/mooneyrivlinmaterial.hh
+20
-26
20 additions, 26 deletions
dune/elasticity/materials/mooneyrivlinmaterial.hh
dune/elasticity/materials/neohookeanmaterial.hh
+18
-24
18 additions, 24 deletions
dune/elasticity/materials/neohookeanmaterial.hh
with
38 additions
and
50 deletions
dune/elasticity/materials/mooneyrivlinmaterial.hh
+
20
−
26
View file @
df1b3de6
...
...
@@ -48,25 +48,19 @@ public:
using
typename
Base
::
GridType
;
using
typename
Base
::
GlobalBasis
;
using
typename
Base
::
Lfe
;
using
typename
Base
::
LocalLinearization
;
using
typename
Base
::
LocalHessian
;
using
typename
Base
::
VectorType
;
using
typename
Base
::
ReturnType
;
using
typename
Base
::
GridFunction
;
using
field_type
=
typename
Base
::
ReturnType
;
using
Base
::
dim
;
using
AdolCBase
=
Adolc
::
LocalEnergy
<
GridType
,
Lfe
,
dim
>
;
using
Element
=
typename
GridType
::
template
Codim
<
0
>
::
Entity
;
using
AdolcCoefficients
=
typename
AdolCBase
::
CoefficientVectorType
;
using
AdolcEnergy
=
typename
AdolCBase
::
ReturnType
;
using
AdolcFieldType
=
typename
AdolCBase
::
ReturnType
;
using
MonRivLinearization
=
MooneyRivlinFunctionalAssembler
<
GridType
,
Lfe
>
;
using
MonRivHessian
=
MooneyRivlinOperatorAssembler
<
GridType
,
Lfe
,
Lfe
>
;
private:
using
ctype
=
typename
GridType
::
ctype
;
static
constexpr
int
dim
=
GridType
::
dimension
;
static
constexpr
int
dimworld
=
GridType
::
dimensionworld
;
using
MonRivLinearisation
=
MooneyRivlinFunctionalAssembler
<
GridType
,
Lfe
>
;
using
MonRivHessian
=
MooneyRivlinOperatorAssembler
<
GridType
,
Lfe
,
Lfe
>
;
public:
MooneyRivlinMaterial
(
int
k
=
3
)
:
...
...
@@ -77,7 +71,7 @@ public:
}
template
<
class
BasisT
>
MooneyRivlinMaterial
(
BasisT
&&
basis
,
c
type
E
,
c
type
nu
,
int
k
=
3
)
:
MooneyRivlinMaterial
(
BasisT
&&
basis
,
field_
type
E
,
field_
type
nu
,
int
k
=
3
)
:
Base
(
std
::
forward
<
BasisT
>
(
basis
)),
E_
(
E
),
nu_
(
nu
),
k_
(
k
)
{
setupCoefficients
();
...
...
@@ -85,7 +79,7 @@ public:
}
template
<
class
BasisT
>
void
setup
(
BasisT
&&
basis
,
c
type
E
,
c
type
nu
,
int
k
=
3
)
void
setup
(
BasisT
&&
basis
,
field_
type
E
,
field_
type
nu
,
int
k
=
3
)
{
this
->
setBasis
(
std
::
forward
<
BasisT
>
(
basis
));
...
...
@@ -94,12 +88,12 @@ public:
constructAssemblers
();
}
void
getMaterialParameters
(
c
type
&
E
,
c
type
&
nu
)
{
void
getMaterialParameters
(
field_
type
&
E
,
field_
type
&
nu
)
{
E
=
E_
;
nu
=
nu_
;
}
//! Evaluate the strain energy
ReturnT
ype
energy
(
std
::
shared_ptr
<
GridFunction
>
displace
)
const
field_t
ype
energy
(
std
::
shared_ptr
<
GridFunction
>
displace
)
const
{
ctype
energy
=
0
;
const
auto
&
leafView
=
this
->
basis
().
getGridView
().
grid
().
leafGridView
();
...
...
@@ -200,13 +194,13 @@ public:
}
//! Return the local assembler of the first derivative of the strain energy
LocalLinearization
&
firstDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
typename
Base
::
LocalLinearization
&
firstDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
localLinearization_
->
setConfiguration
(
displace
);
return
*
localLinearization_
;
}
//! Return the local assembler of the second derivative of the strain energy
LocalHessian
&
secondDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
typename
Base
::
LocalHessian
&
secondDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
localHessian_
->
setConfiguration
(
displace
);
return
*
localHessian_
;
}
...
...
@@ -215,23 +209,23 @@ private:
//! Compute coefficients s.t. polyconvexity holds
void
setupCoefficients
()
{
c
type
lambda
=
E_
*
nu_
/
((
1
+
nu_
)
*
(
1
-
2
*
nu_
));
c
type
mu
=
E_
/
(
2
*
(
1
+
nu_
));
field_
type
lambda
=
E_
*
nu_
/
((
1
+
nu_
)
*
(
1
-
2
*
nu_
));
field_
type
mu
=
E_
/
(
2
*
(
1
+
nu_
));
// Choose coefficients in such a way that we have polyconvexity
// First/Second derivative of the compressible function part of gamma (=-kJ^(-k-1)) at 1.0
c
type
ld1
=
-
k_
;
c
type
ld2
=
k_
*
(
k_
+
1
);
field_
type
ld1
=
-
k_
;
field_
type
ld2
=
k_
*
(
k_
+
1
);
if
(
ld1
>=
0
||
ld2
<=
0
)
std
::
cout
<<
"Coerciveness failed
\n
"
;
// Check if lame constants admit coerciveness
c
type
rho
=
-
ld1
/
(
ld2
-
ld1
);
field_
type
rho
=
-
ld1
/
(
ld2
-
ld1
);
if
(
(
(
rho
<
0.5
&&
lambda
<
(
1.0
/
rho
-
2.0
)
*
mu
)
||
lambda
<=
0
||
mu
<=
0
))
std
::
cout
<<
"Coerciveness failed
\n
"
;
//const
c
type somePositiveConstant = - mu_ + rho*(lambda_+2.*mu_);
//const
field_
type somePositiveConstant = - mu_ + rho*(lambda_+2.*mu_);
//if(somePositiveConstant <= 0)
e_
=
(
lambda
+
2.0
*
mu
)
/
(
ld2
-
ld1
);
...
...
@@ -249,7 +243,7 @@ private:
a_
=
b_
+
mu
;
// last check if I didn't miss a condition
c
type
alpha
=
0.5
*
(
mu
-
b_
);
field_
type
alpha
=
0.5
*
(
mu
-
b_
);
if
(
alpha
<=
0
||
b_
<=
0
||
d_
<=
0
)
std
::
cout
<<
"Coerciveness failed
\n
"
;
}
...
...
@@ -267,13 +261,13 @@ private:
std
::
shared_ptr
<
MonRivHessian
>
localHessian_
;
//! Elasticity modulus
c
type
E_
;
field_
type
E_
;
//! Shear modulus
c
type
nu_
;
field_
type
nu_
;
//! Exponent of the compressibility function (>= 2)
int
k_
;
//! Material parameters
c
type
a_
;
c
type
b_
;
c
type
c_
;
c
type
d_
;
c
type
e_
;
field_
type
a_
;
field_
type
b_
;
field_
type
c_
;
field_
type
d_
;
field_
type
e_
;
};
#endif
This diff is collapsed.
Click to expand it.
dune/elasticity/materials/neohookeanmaterial.hh
+
18
−
24
View file @
df1b3de6
...
...
@@ -45,15 +45,13 @@ class NeoHookeanMaterial : public Material<Basis>,
Material
<
Basis
>::
GridType
::
dimension
>
{
public:
typedef
Material
<
Basis
>
Base
;
typedef
typename
Base
::
GridType
GridType
;
typedef
typename
Base
::
GlobalBasis
GlobalBasis
;
typedef
typename
Base
::
Lfe
Lfe
;
typedef
typename
Base
::
LocalLinearization
LocalLinearization
;
typedef
typename
Base
::
LocalHessian
LocalHessian
;
typedef
typename
Base
::
VectorType
VectorType
;
typedef
typename
Base
::
GridFunction
GridFunction
;
typedef
typename
Base
::
ReturnType
ReturnType
;
using
Base
=
Material
<
Basis
>
;
using
typename
Base
::
GridType
;
using
typename
Base
::
GlobalBasis
;
using
typename
Base
::
Lfe
;
using
typename
Base
::
GridFunction
;
using
field_type
=
typename
Base
::
ReturnType
;
using
Base
::
dim
;
using
AdolCBase
=
Adolc
::
LocalEnergy
<
GridType
,
Lfe
,
dim
>
;
using
Element
=
typename
GridType
::
template
Codim
<
0
>
::
Entity
;
...
...
@@ -62,12 +60,8 @@ public:
using
AdolcFieldType
=
typename
AdolCBase
::
ReturnType
;
private:
using
Base
::
dim
;
typedef
typename
GridType
::
ctype
ctype
;
typedef
NeoHookeFunctionalAssembler
<
GridType
,
Lfe
>
NeoLinearization
;
typedef
NeoHookeOperatorAssembler
<
GridType
,
Lfe
,
Lfe
>
NeoHessian
;
typedef
typename
GridType
::
template
Codim
<
0
>
::
Geometry
::
LocalCoordinate
LocalCoordinate
;
typedef
typename
GridType
::
template
Codim
<
0
>
::
LeafIterator
ElementIterator
;
using
NeoLinearisation
=
NeoHookeFunctionalAssembler
<
GridType
,
Lfe
>
;
using
NeoHessian
=
NeoHookeOperatorAssembler
<
GridType
,
Lfe
,
Lfe
>
;
public:
NeoHookeanMaterial
()
:
...
...
@@ -87,7 +81,7 @@ public:
}
template
<
class
BasisT
>
void
setup
(
BasisT
&&
basis
,
ReturnType
E
,
ReturnT
ype
nu
)
void
setup
(
BasisT
&&
basis
,
field_type
E
,
field_t
ype
nu
)
{
lambda_
=
E
*
nu
/
((
1
+
nu
)
*
(
1
-
2
*
nu
));
...
...
@@ -100,10 +94,10 @@ public:
}
//! Evaluate the strain energy
ReturnT
ype
energy
(
std
::
shared_ptr
<
GridFunction
>
displace
)
const
field_t
ype
energy
(
std
::
shared_ptr
<
GridFunction
>
displace
)
const
{
ReturnT
ype
energy
=
0
;
const
auto
&
leafView
=
this
->
basis
().
getGridView
()
.
grid
().
leafGridView
()
;
field_t
ype
energy
=
0
;
const
auto
&
leafView
=
this
->
basis
().
getGridView
();
for
(
const
auto
&
e
:
elements
(
leafView
))
{
...
...
@@ -129,7 +123,7 @@ public:
const
ctype
integrationElement
=
geometry
.
integrationElement
(
quadPos
);
// evaluate displacement gradient at the quadrature point
typename
BasisGridFunction
<
Basis
,
VectorType
>::
DerivativeType
localDispGrad
;
typename
BasisGridFunction
<
Basis
,
typename
Base
::
VectorType
>::
DerivativeType
localDispGrad
;
if
(
displace
->
isDefinedOn
(
e
))
displace
->
evaluateDerivativeLocal
(
e
,
quadPos
,
localDispGrad
);
...
...
@@ -219,14 +213,14 @@ public:
}
//! Return the local assembler of the first derivative of the strain energy
LocalLinearization
&
firstDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
typename
Base
::
LocalLinearization
&
firstDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
localLinearization_
->
setConfiguration
(
displace
);
return
*
localLinearization_
;
}
//! Return the local assembler of the second derivative of the strain energy
LocalHessian
&
secondDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
typename
Base
::
LocalHessian
&
secondDerivative
(
std
::
shared_ptr
<
GridFunction
>
displace
)
{
localHessian_
->
setConfiguration
(
displace
);
return
*
localHessian_
;
...
...
@@ -240,9 +234,9 @@ private:
std
::
shared_ptr
<
NeoHessian
>
localHessian_
;
//! First Lame constant
ReturnT
ype
lambda_
;
field_t
ype
lambda_
;
//! Second Lame constant
ReturnT
ype
mu_
;
field_t
ype
mu_
;
};
#endif
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