Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81736982
residual.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
Sat, Sep 7, 16:43
Size
4 KB
Mime Type
text/x-c++
Expires
Mon, Sep 9, 16:43 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
20613490
Attached To
rTAMAAS tamaas
residual.hh
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/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef RESIDUAL_HH
#define RESIDUAL_HH
/* -------------------------------------------------------------------------- */
#include "boussinesq.hh"
#include "isotropic_hardening.hh"
#include "mindlin.hh"
#include "model_type.hh"
/* -------------------------------------------------------------------------- */
#include <unordered_set>
/* -------------------------------------------------------------------------- */
namespace
tamaas
{
/* -------------------------------------------------------------------------- */
/**
* @brief Residual manager
*/
class
Residual
{
public
:
/// Constructor
Residual
(
Model
*
model
)
:
model
(
model
)
{}
/// Destructor
virtual
~
Residual
()
=
default
;
// Pure virtual methods
public
:
/// Compute the residual vector for a given strain increment
virtual
void
computeResidual
(
GridBase
<
Real
>&
strain_increment
)
=
0
;
/// Apply tangent
virtual
void
applyTangent
(
GridBase
<
Real
>&
output
,
GridBase
<
Real
>&
input
,
GridBase
<
Real
>&
current_strain_increment
)
=
0
;
/// Compute the stresses for a given strain increment
virtual
void
computeStress
(
GridBase
<
Real
>&
strain_increment
)
=
0
;
/// Update the plastic state
virtual
void
updateState
(
GridBase
<
Real
>&
converged_strain_increment
)
=
0
;
/// Get residual vector
virtual
const
GridBase
<
Real
>&
getVector
()
const
=
0
;
/// Get plastic strain
virtual
const
GridBase
<
Real
>&
getPlasticStrain
()
const
=
0
;
/// Get stresses
virtual
const
GridBase
<
Real
>&
getStress
()
const
=
0
;
/// Compute displacement
virtual
void
computeResidualDisplacement
(
GridBase
<
Real
>&
strain_increment
)
=
0
;
// Accessors
public
:
Model
&
getModel
()
{
return
*
model
;
}
protected
:
Model
*
model
;
};
/**
* @brief Templated residual manager
*/
template
<
model_type
type
>
class
ResidualTemplate
:
public
Residual
{
using
trait
=
model_type_traits
<
type
>
;
static
constexpr
UInt
dim
=
trait
::
dimension
;
public
:
ResidualTemplate
(
Model
*
model
,
Real
sigma_0
,
Real
h
);
// Implementation
public
:
/// Compute the residual vector for a given strain increment
void
computeResidual
(
GridBase
<
Real
>&
strain_increment
)
override
;
/// Apply tangent
void
applyTangent
(
GridBase
<
Real
>&
output
,
GridBase
<
Real
>&
input
,
GridBase
<
Real
>&
current_strain_increment
)
override
;
/// Compute the stresses for a given strain increment
void
computeStress
(
GridBase
<
Real
>&
strain_increment
)
override
;
/// Update the plastic state
void
updateState
(
GridBase
<
Real
>&
converged_strain_increment
)
override
;
/// Compute displacement
void
computeResidualDisplacement
(
GridBase
<
Real
>&
strain_increment
)
override
;
// Accessors
public
:
/// Get residual vector
const
GridBase
<
Real
>&
getVector
()
const
override
{
return
residual
;
}
/// Get plastic strain
const
GridBase
<
Real
>&
getPlasticStrain
()
const
override
{
return
hardening
.
getPlasticStrain
();
}
/// Get stresses
const
GridBase
<
Real
>&
getStress
()
const
override
{
return
stress
;
}
private
:
/// Convenience function
const
IntegralOperator
&
integralOperator
(
const
std
::
string
&
name
)
const
{
return
*
this
->
model
->
getIntegralOperator
(
name
);
}
/// Add non-zero layers of plastic strain into the filter
void
updateFilter
(
Grid
<
Real
,
dim
>&
plastic_strain_increment
);
protected
:
IsotropicHardening
<
type
>
hardening
;
Grid
<
Real
,
dim
>
strain
,
stress
,
residual
,
tmp
;
std
::
unordered_set
<
UInt
>
plastic_layers
;
std
::
function
<
bool
(
UInt
)
>
plastic_filter
;
};
/* -------------------------------------------------------------------------- */
}
// namespace tamaas
#endif
// RESIDUAL_HH
Event Timeline
Log In to Comment