Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65909913
mindlin.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jun 7, 00:55
Size
11 KB
Mime Type
text/x-c++
Expires
Sun, Jun 9, 00:55 (2 d)
Engine
blob
Format
Raw Data
Handle
18144930
Attached To
rTAMAAS tamaas
mindlin.cpp
View Options
/**
* @file
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "mindlin.hh"
#include "elasto_plastic_model.hh"
#include "influence.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
/* -------------------------------------------------------------------------- */
namespace
influence
{
template
<
UInt
dim
>
class
ElasticHelper
{
public
:
ElasticHelper
(
Real
mu
,
Real
nu
)
:
mu
(
mu
),
nu
(
nu
),
lambda
(
2
*
mu
*
nu
/
(
1
-
2
*
nu
))
{}
template
<
typename
ST
>
Matrix
<
Complex
,
dim
,
dim
>
operator
()(
StaticMatrix
<
Complex
,
ST
,
dim
,
dim
>&
gradu
)
const
{
auto
trace
{
gradu
.
trace
()};
Matrix
<
Complex
,
dim
,
dim
>
sigma
;
for
(
UInt
i
=
0
;
i
<
dim
;
++
i
)
for
(
UInt
j
=
0
;
j
<
dim
;
++
j
)
sigma
(
i
,
j
)
=
(
i
==
j
)
*
lambda
*
trace
+
mu
*
(
gradu
(
i
,
j
)
+
gradu
(
j
,
i
));
return
sigma
;
}
protected
:
const
Real
mu
,
nu
,
lambda
;
};
template
<
UInt
dim
>
class
MindlinBoussinesqHelper
{
public
:
template
<
typename
OutType
,
typename
SourceType
,
typename
BoussType
>
static
void
apply
(
OutType
&&
out
,
SourceType
&&
source
,
BoussType
&&
boussinesq
,
const
ElasticHelper
<
dim
>&
el
,
VectorProxy
<
const
Real
,
dim
-
1
>&
q
,
Real
y_3
)
{
Vector
<
Real
,
dim
>
normal
{{{
0
,
0
,
1
}}};
auto
traction
{
el
(
source
)
*
normal
};
out
+=
boussinesq
.
applyU0
(
traction
,
q
)
*
KelvinIntegrator
<
0
>::
g0
<
true
>
(
q
.
l2norm
()
*
y_3
);
out
+=
(
boussinesq
.
applyU1
(
traction
,
q
)
*
KelvinIntegrator
<
0
>::
g1
<
true
>
(
q
.
l2norm
()
*
y_3
));
}
};
}
// namespace influence
template
<>
void
Mindlin
<
model_type
::
volume_2d
,
3
>::
apply
(
GridBase
<
Real
>&
source
,
GridBase
<
Real
>&
out
)
const
{
Real
nu
=
model
->
getPoissonRatio
(),
mu
=
model
->
getShearModulus
();
influence
::
Kelvin
<
trait
::
dimension
,
1
>
kelvin
(
mu
,
nu
);
influence
::
Kelvin
<
trait
::
dimension
,
2
>
kelvin_strain
(
mu
,
nu
);
influence
::
Boussinesq
<
trait
::
dimension
,
0
>
boussinesq
(
mu
,
nu
);
influence
::
ElasticHelper
<
trait
::
dimension
>
elasticity
(
mu
,
nu
);
auto
apply
=
[
&
](
UInt
i
,
decltype
(
source_buffers
)
&
source_buffers
,
decltype
(
disp_buffer
)
&
displacement
)
{
constexpr
UInt
dim
=
trait
::
dimension
;
const
Real
L
=
this
->
model
->
getSystemSize
().
front
();
const
UInt
N
=
this
->
model
->
getDiscretization
().
front
();
const
Real
dl
=
L
/
(
N
-
1
);
// Compute displacements u_i
displacement
=
0
;
/// Compute surface strains only once (dirty)
if
(
i
==
0
)
{
surface_strains
=
0
;
// Computing integral for first element
Loop
::
stridedLoop
(
[
&
kelvin_strain
,
dl
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
f
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
influence
::
KelvinIntegrator
<
1
>::
integrate
<
0
>
(
gradu
,
f
,
kelvin_strain
,
q
,
0
,
dl
);
},
surface_strains
,
source_buffers
[
0
],
this
->
wavevectors
);
// Computing integral for rest
for
(
UInt
j
=
1
;
j
<
N
;
++
j
)
{
Real
dij
=
j
*
dl
;
Loop
::
stridedLoop
(
[
&
kelvin_strain
,
dij
,
dl
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
f
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
// Cutoff
if
(
-
q
.
l2norm
()
*
std
::
abs
(
dij
)
<
std
::
log
(
1e-2
))
return
;
influence
::
KelvinIntegrator
<
1
>::
integrate
<
1
>
(
gradu
,
f
,
kelvin_strain
,
q
,
dij
,
dl
);
},
surface_strains
,
source_buffers
[
j
],
this
->
wavevectors
);
}
surface_strains
*=
-
1.
;
}
// Computing influence of Kelvin kernel
for
(
UInt
j
:
Loop
::
range
(
N
))
{
const
Real
dij
=
j
*
dl
-
i
*
dl
;
// don't factorize!
auto
&
source
=
source_buffers
[
j
];
#define POTENTIAL(yj_xi) \
Loop::stridedLoop( \
[&kelvin, dij, dl](VectorProxy<Complex, dim>&& u, \
MatrixProxy<Complex, dim, dim>&& f, \
VectorProxy<const Real, dim - 1>&& q) { \
/* Cutoff */
\
if (-q.l2norm() * std::abs(dij) < std::log(1e-2)) \
return; \
influence::KelvinIntegrator<1>::integrate<yj_xi>(u, f, kelvin, q, dij, \
dl); \
}, \
displacement, source, this->wavevectors)
if
(
j
>
i
)
{
POTENTIAL
(
1
);
}
else
if
(
j
==
i
)
{
POTENTIAL
(
0
);
}
else
{
POTENTIAL
(
-
1
);
}
#undef POTENTIAL
}
// Correcting for the tractions on the surface
Real
xi
=
i
*
dl
;
Loop
::
stridedLoop
(
[
&
boussinesq
,
&
elasticity
,
xi
](
VectorProxy
<
Complex
,
dim
>&&
u
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
if
(
-
q
.
l2norm
()
*
std
::
abs
(
xi
)
<
std
::
log
(
1e-2
))
return
;
influence
::
MindlinBoussinesqHelper
<
trait
::
dimension
>::
apply
(
u
,
gradu
,
boussinesq
,
elasticity
,
q
,
xi
);
},
displacement
,
surface_strains
,
this
->
wavevectors
);
// Setting fundamental frequency to zero
VectorProxy
<
Complex
,
dim
>
u_fundamental
(
displacement
(
0
));
u_fundamental
=
0
;
};
this
->
fourierApply
(
apply
,
source
,
out
);
}
/* -------------------------------------------------------------------------- */
template
<>
void
Mindlin
<
model_type
::
volume_2d
,
4
>::
apply
(
GridBase
<
Real
>&
source
,
GridBase
<
Real
>&
out
)
const
{
Real
nu
=
model
->
getPoissonRatio
(),
mu
=
model
->
getShearModulus
();
influence
::
Kelvin
<
trait
::
dimension
,
2
>
kelvin
(
mu
,
nu
);
influence
::
Boussinesq
<
trait
::
dimension
,
1
>
boussinesq_grad
(
mu
,
nu
);
influence
::
ElasticHelper
<
trait
::
dimension
>
elasticity
(
mu
,
nu
);
auto
apply
=
[
&
](
UInt
i
,
decltype
(
source_buffers
)
&
source_buffers
,
decltype
(
disp_buffer
)
&
gradu
)
{
constexpr
UInt
dim
=
trait
::
dimension
;
const
Real
L
=
this
->
model
->
getSystemSize
().
front
();
const
UInt
N
=
this
->
model
->
getDiscretization
().
front
();
const
Real
dl
=
L
/
(
N
-
1
);
// Compute displacement gradients
gradu
=
0
;
/// Compute surface strains only once (dirty)
if
(
i
==
0
)
{
surface_strains
=
0
;
// Computing integral for first element
Loop
::
stridedLoop
(
[
&
kelvin
,
dl
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
f
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
influence
::
KelvinIntegrator
<
1
>::
integrate
<
0
>
(
gradu
,
f
,
kelvin
,
q
,
0
,
dl
);
},
surface_strains
,
source_buffers
[
0
],
this
->
wavevectors
);
// Computing integral for rest
for
(
UInt
j
=
1
;
j
<
N
;
++
j
)
{
Real
dij
=
j
*
dl
;
Loop
::
stridedLoop
(
[
&
kelvin
,
dij
,
dl
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
f
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
// Cutoff
if
(
-
q
.
l2norm
()
*
std
::
abs
(
dij
)
<
std
::
log
(
1e-2
))
return
;
influence
::
KelvinIntegrator
<
1
>::
integrate
<
1
>
(
gradu
,
f
,
kelvin
,
q
,
dij
,
dl
);
},
surface_strains
,
source_buffers
[
j
],
this
->
wavevectors
);
}
surface_strains
*=
-
1.
;
}
// Computing influence of Kelvin kernel
for
(
UInt
j
:
Loop
::
range
(
N
))
{
const
Real
dij
=
j
*
dl
-
i
*
dl
;
// don't factorize!
auto
&
source
=
source_buffers
[
j
];
#define POTENTIAL(yj_xi) \
Loop::stridedLoop( \
[&kelvin, dij, dl](MatrixProxy<Complex, dim, dim>&& u, \
MatrixProxy<Complex, dim, dim>&& f, \
VectorProxy<const Real, dim - 1>&& q) { \
/* Cutoff */
\
if (-q.l2norm() * std::abs(dij) < std::log(1e-2)) \
return; \
influence::KelvinIntegrator<1>::integrate<yj_xi>(u, f, kelvin, q, dij, \
dl); \
}, \
gradu, source, this->wavevectors)
if
(
j
>
i
)
{
POTENTIAL
(
1
);
}
else
if
(
j
==
i
)
{
POTENTIAL
(
0
);
// Additional free term from discontinous Kelvin gradient
Loop
::
stridedLoop
(
[
&
kelvin
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
u
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
f
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
u
+=
kelvin
.
applyDiscontinuityTerm
(
q
,
f
);
},
gradu
,
source
,
this
->
wavevectors
);
}
else
{
POTENTIAL
(
-
1
);
}
#undef POTENTIAL
}
gradu
*=
-
1.
;
// Correcting for the tractions on the surface
Real
xi
=
i
*
dl
;
Loop
::
stridedLoop
(
[
&
boussinesq_grad
,
&
elasticity
,
xi
](
MatrixProxy
<
Complex
,
dim
,
dim
>&&
gradu
,
MatrixProxy
<
Complex
,
dim
,
dim
>&&
surface_gradu
,
VectorProxy
<
const
Real
,
dim
-
1
>&&
q
)
{
if
(
-
q
.
l2norm
()
*
std
::
abs
(
xi
)
<
std
::
log
(
1e-2
))
return
;
influence
::
MindlinBoussinesqHelper
<
trait
::
dimension
>::
apply
(
gradu
,
surface_gradu
,
boussinesq_grad
,
elasticity
,
q
,
xi
);
},
gradu
,
surface_strains
,
this
->
wavevectors
);
// Setting fundamental frequency to zero
MatrixProxy
<
Complex
,
dim
,
dim
>
gradu_fundamental
(
gradu
(
0
));
gradu_fundamental
=
0
;
};
this
->
fourierApply
(
apply
,
source
,
out
);
}
/* -------------------------------------------------------------------------- */
template
<
model_type
type
,
UInt
tensor_order
>
void
Mindlin
<
type
,
tensor_order
>::
apply
(
GridBase
<
Real
>&
source
,
GridBase
<
Real
>&
out
)
const
{
TAMAAS_EXCEPTION
(
"The requested operator has not been implemented"
);
}
/* -------------------------------------------------------------------------- */
/* Template instanciation */
/* -------------------------------------------------------------------------- */
template
class
Mindlin
<
model_type
::
volume_2d
,
3
>
;
template
class
Mindlin
<
model_type
::
volume_2d
,
4
>
;
/* -------------------------------------------------------------------------- */
__END_TAMAAS__
Event Timeline
Log In to Comment