Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78649302
bem_grid.hh
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
Thu, Aug 22, 04:28
Size
6 KB
Mime Type
text/x-c++
Expires
Sat, Aug 24, 04:28 (2 d)
Engine
blob
Format
Raw Data
Handle
20080769
Attached To
rTAMAAS tamaas
bem_grid.hh
View Options
/**
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016 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/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef __BEM_GRID_HH__
#define __BEM_GRID_HH__
/* -------------------------------------------------------------------------- */
#include "grid.hh"
#include "surface.hh"
#include "legacy_types.hh"
/* -------------------------------------------------------------------------- */
namespace
tamaas
{
/**
* @brief abstract class for BEMs that use multi component fields
*/
class
BemGrid
{
public
:
/// Constructor
BemGrid
(
Surface
<
Real
>&
surface
);
/// Destructor
virtual
~
BemGrid
();
public
:
/* ------------------------------------------------------------------------ */
/* Actual computations */
/* ------------------------------------------------------------------------ */
/// Compute normal vectors to surface
void
computeSurfaceNormals
();
/// Compute influence coefficients
void
computeInfluence
();
/// Compute a Lipschitz constant of gradient
void
computeInfluenceLipschitz
();
/// Apply influence fonctions (p -> u)
void
applyInfluenceFunctions
(
Grid
<
Real
,
2
>&
input
,
Grid
<
Real
,
2
>&
output
);
/// Apply inverse influence fonctions (u -> p)
void
applyInverseInfluenceFunctions
(
Grid
<
Real
,
2
>&
input
,
Grid
<
Real
,
2
>&
output
);
/// Compute true tractions
virtual
void
computeTrueTractions
()
=
0
;
/// Compute true displacements
virtual
void
computeTrueDisplacements
()
=
0
;
/// Compute equilibrium
virtual
void
computeEquilibrium
(
Real
tol
,
const
Grid
<
Real
,
1
>&
p_target
)
=
0
;
/// Compute displacements
void
computeDisplacementsFromTractions
();
/// Compute tractions
void
computeTractionsFromDisplacements
();
/// Compute gaps
void
computeGaps
(
Grid
<
Real
,
2
>&
disp
);
/* ------------------------------------------------------------------------ */
/* Field related computations */
/* ------------------------------------------------------------------------ */
/// Project point friction cone
static
inline
void
projectOnFrictionCone
(
legacy
::
VectorProxy
<
Real
>&
p
,
Real
mu
);
/// Project field friction cone
static
void
projectOnFrictionCone
(
Grid
<
Real
,
2
>&
field
,
Real
mu
);
/// Project on mean value space
static
void
enforceMeanValue
(
Grid
<
Real
,
2
>&
field
,
const
Grid
<
Real
,
1
>&
target
);
/// Compute error relative to target mean value
static
Real
computeMeanValueError
(
Grid
<
Real
,
2
>&
field
,
const
Grid
<
Real
,
1
>&
target
);
/// Compute error vector
static
void
computeMeanValueError
(
Grid
<
Real
,
2
>&
field
,
const
Grid
<
Real
,
1
>&
target
,
Grid
<
Real
,
1
>&
error_vec
);
/* ------------------------------------------------------------------------ */
/* Getters */
/* ------------------------------------------------------------------------ */
/// Get influence
const
GridHermitian
<
Real
,
2
>&
getInfluence
()
const
{
return
influence
;
}
/// Get normals
const
Grid
<
Real
,
2
>&
getSurfaceNormals
()
const
{
return
surface_normals
;
}
/// Get tractions
const
Grid
<
Real
,
2
>&
getTractions
()
const
{
return
tractions
;
}
/// Get displacements
const
Grid
<
Real
,
2
>&
getDisplacements
()
const
{
return
displacements
;
}
/// Get true tractions
const
Grid
<
Real
,
2
>&
getTrueTractions
()
const
;
/// Get true displacements
const
Grid
<
Real
,
2
>&
getTrueDisplacements
()
const
;
/// Get gaps
const
Grid
<
Real
,
2
>&
getGaps
()
const
{
return
gaps
;
}
/* ------------------------------------------------------------------------ */
/* Setters */
/* ------------------------------------------------------------------------ */
/// Elasticity parameters
void
setElasticity
(
Real
E_
,
Real
nu_
)
{
E
=
E_
;
nu
=
nu_
;
}
/// Friction coefficient
void
setMu
(
Real
mu_
)
{
mu
=
mu_
;
}
/// Max iterations
void
setMaxIterations
(
UInt
n
)
{
max_iter
=
n
;
}
/// Dump frequency
void
setDumpFrequency
(
UInt
n
)
{
dump_freq
=
n
;
}
protected
:
/// Elasticity constants
Real
E
,
nu
;
/// Friction coefficient
Real
mu
;
/// Lipschitz constant of functional gradient
Real
lipschitz
;
/// Max iterations
UInt
max_iter
;
/// Surface
Surface
<
Real
>
surface
;
/// Normal vectors
Grid
<
Real
,
2
>
surface_normals
;
/// Influcence matrices
GridHermitian
<
Real
,
2
>
influence
;
/// Tractions
Grid
<
Real
,
2
>
tractions
;
/// Displacements
Grid
<
Real
,
2
>
displacements
;
/// Gap
Grid
<
Real
,
2
>
gaps
;
/// True tractions
Grid
<
Real
,
2
>*
true_tractions
;
/// True displacements
Grid
<
Real
,
2
>*
true_displacements
;
/// Spectral tractions
GridHermitian
<
Real
,
2
>
spectral_tractions
;
/// Spectral displacements
GridHermitian
<
Real
,
2
>
spectral_displacements
;
/// Dump frequency
UInt
dump_freq
;
};
/* -------------------------------------------------------------------------- */
/* Inline definitions */
/* -------------------------------------------------------------------------- */
inline
void
BemGrid
::
projectOnFrictionCone
(
legacy
::
VectorProxy
<
Real
>&
p
,
Real
mu
)
{
Real
pt
=
std
::
sqrt
(
p
(
0
)
*
p
(
0
)
+
p
(
1
)
*
p
(
1
));
Real
pn
=
p
(
2
);
Real
x
=
(
pn
+
mu
*
pt
)
/
(
1
+
mu
*
mu
);
if
(
pt
<=
mu
*
pn
&&
pn
>=
0
)
// inside friction cone
return
;
else
if
(
mu
*
pt
<=
std
::
abs
(
pn
)
&&
pn
<
0
)
// inside "project to origin" cone (undefined normal)
// else if (pn < 0) // project to origin all points with pn < 0
p
=
0
;
else
{
// projectable on cone
p
(
0
)
*=
mu
/
pt
*
x
;
p
(
1
)
*=
mu
/
pt
*
x
;
p
(
2
)
=
x
;
}
}
/* -------------------------------------------------------------------------- */
}
// namespace tamaas
#endif
// __BEM_GRID_HH__
Event Timeline
Log In to Comment