Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F88765371
test_cohesive_parallel_intrinsic.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
Sun, Oct 20, 14:06
Size
4 KB
Mime Type
text/x-c
Expires
Tue, Oct 22, 14:06 (1 d, 16 h)
Engine
blob
Format
Raw Data
Handle
21815800
Attached To
rAKA akantu
test_cohesive_parallel_intrinsic.cc
View Options
/**
* @file test_cohesive_parallel_intrinsic.cc
*
* @author Marco Vocialta <marco.vocialta@epfl.ch>
*
*
* @brief parallel test for intrinsic cohesive elements
*
* @section LICENSE
*
* Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
*/
/* -------------------------------------------------------------------------- */
#include "solid_mechanics_model_cohesive.hh"
/* -------------------------------------------------------------------------- */
using
namespace
akantu
;
int
main
(
int
argc
,
char
*
argv
[])
{
initialize
(
"material.dat"
,
argc
,
argv
);
const
UInt
max_steps
=
350
;
UInt
spatial_dimension
=
2
;
Mesh
mesh
(
spatial_dimension
);
StaticCommunicator
&
comm
=
StaticCommunicator
::
getStaticCommunicator
();
Int
psize
=
comm
.
getNbProc
();
Int
prank
=
comm
.
whoAmI
();
akantu
::
MeshPartition
*
partition
=
NULL
;
if
(
prank
==
0
)
{
// Read the mesh
mesh
.
read
(
"mesh.msh"
);
// /// insert cohesive elements
// CohesiveElementInserter inserter(mesh);
// inserter.setLimit('x', -0.26, -0.24);
// inserter.insertIntrinsicElements();
/// partition the mesh
partition
=
new
MeshPartitionScotch
(
mesh
,
spatial_dimension
);
// debug::setDebugLevel(dblDump);
partition
->
partitionate
(
psize
);
// debug::setDebugLevel(dblWarning);
}
SolidMechanicsModelCohesive
model
(
mesh
);
model
.
initParallel
(
partition
);
model
.
initFull
();
model
.
limitInsertion
(
_x
,
-
0.26
,
-
0.24
);
model
.
insertIntrinsicElements
();
debug
::
setDebugLevel
(
dblDump
);
std
::
cout
<<
mesh
<<
std
::
endl
;
debug
::
setDebugLevel
(
dblWarning
);
Real
time_step
=
model
.
getStableTimeStep
()
*
0.8
;
model
.
setTimeStep
(
time_step
);
// std::cout << "Time step: " << time_step << std::endl;
model
.
assembleMassLumped
();
Array
<
Real
>
&
position
=
mesh
.
getNodes
();
Array
<
Real
>
&
velocity
=
model
.
getVelocity
();
Array
<
bool
>
&
boundary
=
model
.
getBlockedDOFs
();
// Array<Real> & displacement = model.getDisplacement();
// const Array<Real> & residual = model.getResidual();
UInt
nb_nodes
=
mesh
.
getNbNodes
();
Real
epsilon
=
std
::
numeric_limits
<
Real
>::
epsilon
();
for
(
UInt
n
=
0
;
n
<
nb_nodes
;
++
n
)
{
if
(
std
::
abs
(
position
(
n
,
0
)
-
1.
)
<
epsilon
)
boundary
(
n
,
0
)
=
true
;
}
model
.
synchronizeBoundaries
();
model
.
updateResidual
();
model
.
setBaseName
(
"intrinsic_parallel"
);
model
.
addDumpFieldVector
(
"displacement"
);
model
.
addDumpField
(
"velocity"
);
model
.
addDumpField
(
"acceleration"
);
model
.
addDumpField
(
"residual"
);
model
.
addDumpField
(
"stress"
);
model
.
addDumpField
(
"strain"
);
model
.
addDumpField
(
"partitions"
);
model
.
addDumpField
(
"force"
);
model
.
dump
();
model
.
setBaseNameToDumper
(
"cohesive elements"
,
"cohesive_elements_parallel_intrinsic"
);
model
.
addDumpFieldVectorToDumper
(
"cohesive elements"
,
"displacement"
);
model
.
dump
(
"cohesive elements"
);
/// initial conditions
Real
loading_rate
=
.2
;
for
(
UInt
n
=
0
;
n
<
nb_nodes
;
++
n
)
{
velocity
(
n
,
0
)
=
loading_rate
*
position
(
n
,
0
);
}
/// Main loop
for
(
UInt
s
=
1
;
s
<=
max_steps
;
++
s
)
{
model
.
solveStep
();
if
(
s
%
20
==
0
)
{
model
.
dump
();
model
.
dump
(
"cohesive elements"
);
if
(
prank
==
0
)
std
::
cout
<<
"passing step "
<<
s
<<
"/"
<<
max_steps
<<
std
::
endl
;
}
// // update displacement
// for (UInt n = 0; n < nb_nodes; ++n) {
// if (position(n, 1) + displacement(n, 1) > 0) {
// displacement(n, 0) -= 0.01;
// }
// }
// Real Ed = dynamic_cast<MaterialCohesive&> (model.getMaterial(1)).getDissipatedEnergy();
// Real Er = dynamic_cast<MaterialCohesive&> (model.getMaterial(1)).getReversibleEnergy();
// edis << s << " "
// << Ed << std::endl;
// erev << s << " "
// << Er << std::endl;
}
// edis.close();
// erev.close();
Real
Ed
=
model
.
getEnergy
(
"dissipated"
);
Real
Edt
=
2
*
sqrt
(
2
);
if
(
prank
==
0
)
{
std
::
cout
<<
Ed
<<
" "
<<
Edt
<<
std
::
endl
;
if
(
std
::
abs
((
Ed
-
Edt
)
/
Edt
)
>
0.01
||
std
::
isnan
(
Ed
))
{
std
::
cout
<<
"The dissipated energy is incorrect"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
}
finalize
();
if
(
prank
==
0
)
std
::
cout
<<
"OK: Test passed!"
<<
std
::
endl
;
return
EXIT_SUCCESS
;
}
Event Timeline
Log In to Comment