Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81238610
test_group_update.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, Sep 4, 22:18
Size
2 KB
Mime Type
text/x-c
Expires
Fri, Sep 6, 22:18 (2 d)
Engine
blob
Format
Raw Data
Handle
20528604
Attached To
rAKA akantu
test_group_update.cc
View Options
#include <non_linear_solver.hh>
#include <solid_mechanics_model_cohesive.hh>
using
namespace
akantu
;
int
main
(
int
argc
,
char
*
argv
[])
{
initialize
(
"material.dat"
,
argc
,
argv
);
Int
spatial_dimension
=
2
;
Mesh
mesh
(
spatial_dimension
);
mesh
.
read
(
"bar.msh"
);
// Create model
SolidMechanicsModelCohesive
model
(
mesh
);
model
.
initFull
(
_analysis_method
=
_static
,
_is_extrinsic
=
true
);
// Configure solver
auto
&
solver
=
model
.
getNonLinearSolver
(
"static"
);
solver
.
set
(
"max_iterations"
,
100
);
solver
.
set
(
"threshold"
,
1e-10
);
solver
.
set
(
"convergence_type"
,
SolveConvergenceCriteria
::
_residual
);
model
.
initNewSolver
(
_explicit_lumped_mass
);
// Dynamic insertion of cohesive elements
model
.
updateAutomaticInsertion
();
auto
dt_crit
=
model
.
getStableTimeStep
();
// Critical time step
auto
dt
=
dt_crit
*
0.1
;
// Adopted time step
auto
time_simulation
=
6.0e-6
;
// Total time of simulation (s)
auto
n_steps
=
int
(
time_simulation
/
dt
);
// Number of time steps
// Apply Dirichlet BC to block displacements at y direction on top and
// bottom
model
.
applyBC
(
BC
::
Dirichlet
::
FixedValue
(
0.
,
_y
),
"YBlocked"
);
// Constant velocity boundary condition
// Applied strain rate(s - 1)
auto
strain_rate
=
1e5
;
// Applied velocity at the boundary
auto
vel
=
strain_rate
*
(
mesh
.
getUpperBounds
()(
_x
)
-
mesh
.
getLowerBounds
()(
_x
))
/
2
;
model
.
applyBC
(
BC
::
Dirichlet
::
IncrementValue
(
-
vel
*
dt
,
_x
),
"left"
);
model
.
applyBC
(
BC
::
Dirichlet
::
IncrementValue
(
vel
*
dt
,
_x
),
"right"
);
// VTK plot setup
model
.
setBaseName
(
"bar"
);
model
.
addDumpFieldVector
(
"displacement"
);
// VTK plot setup for Cohesive model
model
.
setBaseNameToDumper
(
"cohesive elements"
,
"cohesive"
);
model
.
addDumpFieldVectorToDumper
(
"cohesive elements"
,
"displacement"
);
for
(
auto
_
[[
gnu
::
unused
]]
:
arange
(
n_steps
))
{
// Apply velocity at the extremities
model
.
applyBC
(
BC
::
Dirichlet
::
IncrementValue
(
-
vel
*
dt
,
_x
),
"left"
);
model
.
applyBC
(
BC
::
Dirichlet
::
IncrementValue
(
vel
*
dt
,
_x
),
"right"
);
model
.
dump
();
model
.
dump
(
"cohesive elements"
);
// Run simulation
model
.
checkCohesiveStress
();
model
.
solveStep
(
"explicit_lumped"
);
}
}
Event Timeline
Log In to Comment