Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91668170
new_local_material.cc
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
Wed, Nov 13, 06:56
Size
3 KB
Mime Type
text/x-c
Expires
Fri, Nov 15, 06:56 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22278813
Attached To
rAKA akantu
new_local_material.cc
View Options
/**
* @file new_local_material.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Nicolas Richart <nicolas.richart@epfl.ch>
* @author Marion Estelle Chambart <marion.chambart@epfl.ch>
*
* @date creation: Fri Apr 20 2012
* @date last modification: Mon Apr 07 2014
*
* @brief test of the class SolidMechanicsModel
*
* @section LICENSE
*
* Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* Akantu 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.
*
* Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include <iostream>
/* -------------------------------------------------------------------------- */
#include "solid_mechanics_model.hh"
#include "local_material_damage.hh"
using
namespace
akantu
;
#define bar_length 10.
#define bar_height 4.
akantu
::
Real
eps
=
1e-10
;
int
main
(
int
argc
,
char
*
argv
[])
{
akantu
::
initialize
(
"material.dat"
,
argc
,
argv
);
UInt
max_steps
=
10000
;
Real
epot
,
ekin
;
const
UInt
spatial_dimension
=
2
;
Mesh
mesh
(
spatial_dimension
);
mesh
.
read
(
"barre_trou.msh"
);
mesh
.
createGroupsFromMeshData
<
std
::
string
>
(
"physical_names"
);
/// model creation
SolidMechanicsModel
model
(
mesh
);
/// model initialization
model
.
initFull
(
SolidMechanicsModelOptions
(
_explicit_lumped_mass
,
true
));
model
.
registerNewCustomMaterials
<
LocalMaterialDamage
>
(
"local_damage"
);
model
.
initMaterials
();
std
::
cout
<<
model
.
getMaterial
(
0
)
<<
std
::
endl
;
Real
time_step
=
model
.
getStableTimeStep
();
model
.
setTimeStep
(
time_step
/
10.
);
/// Dirichlet boundary conditions
model
.
applyBC
(
BC
::
Dirichlet
::
FixedValue
(
0.0
,
_x
),
"Fixed_x"
);
model
.
applyBC
(
BC
::
Dirichlet
::
FixedValue
(
0.0
,
_y
),
"Fixed_y"
);
// Neumann boundary condition
Matrix
<
Real
>
stress
(
2
,
2
);
stress
.
eye
(
3e2
);
model
.
applyBC
(
BC
::
Neumann
::
FromStress
(
stress
),
"Traction"
);
model
.
setBaseName
(
"local_material"
);
model
.
addDumpField
(
"displacement"
);
model
.
addDumpField
(
"velocity"
);
model
.
addDumpField
(
"acceleration"
);
model
.
addDumpField
(
"force"
);
model
.
addDumpField
(
"residual"
);
model
.
addDumpField
(
"grad_u"
);
model
.
addDumpField
(
"stress"
);
model
.
addDumpField
(
"damage"
);
model
.
dump
();
for
(
UInt
s
=
0
;
s
<
max_steps
;
++
s
)
{
model
.
explicitPred
();
model
.
updateResidual
();
model
.
updateAcceleration
();
model
.
explicitCorr
();
epot
=
model
.
getPotentialEnergy
();
ekin
=
model
.
getKineticEnergy
();
if
(
s
%
100
==
0
)
std
::
cout
<<
s
<<
" "
<<
epot
<<
" "
<<
ekin
<<
" "
<<
epot
+
ekin
<<
std
::
endl
;
if
(
s
%
100
==
0
)
model
.
dump
();
}
akantu
::
finalize
();
return
EXIT_SUCCESS
;
}
Event Timeline
Log In to Comment