Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78346768
boundary_functions.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
Mon, Aug 19, 23:19
Size
2 KB
Mime Type
text/x-c
Expires
Wed, Aug 21, 23:19 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19996325
Attached To
rAKA akantu
boundary_functions.cc
View Options
/**
* @file boundary_functions.cc
*
* @author David Simon Kammer <david.kammer@epfl.ch>
*
* @date creation: Tue Feb 20 2018
* @date last modification: Fri Jul 19 2019
*
* @brief functions for boundaries
*
*
* @section LICENSE
*
* Copyright (©) 2015-2021 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 "boundary_functions.hh"
#include "communicator.hh"
#include "element_group.hh"
#include "node_group.hh"
#include "solid_mechanics_model.hh"
/* -------------------------------------------------------------------------- */
namespace
akantu
{
/* -------------------------------------------------------------------------- */
Real
integrateResidual
(
const
std
::
string
&
sub_boundary_name
,
const
SolidMechanicsModel
&
model
,
UInt
dir
)
{
Real
int_res
=
0.
;
const
Mesh
&
mesh
=
model
.
getMesh
();
const
Array
<
Real
>
&
residual
=
model
.
getInternalForce
();
const
ElementGroup
&
boundary
=
mesh
.
getElementGroup
(
sub_boundary_name
);
for
(
const
auto
&
node
:
boundary
.
getNodeGroup
().
getNodes
())
{
bool
is_local_node
=
mesh
.
isLocalOrMasterNode
(
node
);
if
(
is_local_node
)
{
int_res
+=
residual
(
node
,
dir
);
}
}
mesh
.
getCommunicator
().
allReduce
(
int_res
,
SynchronizerOperation
::
_sum
);
return
int_res
;
}
/* -------------------------------------------------------------------------- */
void
boundaryFix
(
Mesh
&
mesh
,
const
std
::
vector
<
std
::
string
>
&
sub_boundary_names
)
{
for
(
auto
&&
eg
:
sub_boundary_names
)
{
if
(
mesh
.
elementGroupExists
(
eg
))
{
mesh
.
createElementGroup
(
eg
,
mesh
.
getSpatialDimension
()
-
1
);
// empty element group
}
}
}
}
// namespace akantu
Event Timeline
Log In to Comment