Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65830715
axisymmetric_mesh1d.hpp
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
Thu, Jun 6, 12:36
Size
5 KB
Mime Type
text/x-c++
Expires
Sat, Jun 8, 12:36 (2 d)
Engine
blob
Format
Raw Data
Handle
18133845
Attached To
rSPECMICP SpecMiCP / ReactMiCP
axisymmetric_mesh1d.hpp
View Options
/*-------------------------------------------------------------------------------
Copyright (c) 2014,2015 F. Georget <fabieng@princeton.edu>, Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------*/
#ifndef SPECMICP_DFPM_MESHES_AXISYMMETRICMESH1D_HPP
#define SPECMICP_DFPM_MESHES_AXISYMMETRICMESH1D_HPP
//! \file axisymmetric_mesh1d.hpp
//! \brief An axisymmetric 1D mesh
#include "../../types.hpp"
#include "mesh1d.hpp"
namespace
specmicp
{
namespace
mesh
{
//! \brief A generic Axisymmetric 1D mesh
class
SPECMICP_DLL_PUBLIC
AxisymmetricMesh1D:
public
Mesh1D
{
public
:
const
index_t
radius
=
0
;
const
index_t
cell_vol_0
=
1
;
const
index_t
cell_vol_1
=
2
;
//! \brief Build an axisymmetric 1D mesh
//!
//! \param radius is a vector of the position of the nodes
//! \param height is the height of the sample (or depth)
AxisymmetricMesh1D
(
Vector
radius
,
scalar_t
height
);
//! \brief Return the radius of an element
scalar_t
get_radius
(
index_t
element
,
index_t
enode
)
{
return
m_data
(
get_node
(
element
,
enode
),
radius
);
}
//! \brief Return the radius of the face
scalar_t
get_radius_face
(
index_t
element
)
{
return
m_face_radius
(
element
);
}
//! \brief Return the position (meaning may vary with the mesh) of the node
scalar_t
get_position
(
index_t
node
)
{
return
m_data
(
node
,
radius
);}
//! \brief Return the length of an element
scalar_t
get_dx
(
index_t
element
)
{
return
get_radius
(
element
,
0
)
-
get_radius
(
element
,
1
);}
//! \brief Return the area of the face at the middle of an element
scalar_t
get_face_area
(
index_t
element
)
{
return
2
*
M_PI
*
m_face_radius
(
element
)
*
m_height
;}
//! \brief Return the volume of an element
scalar_t
get_volume_element
(
index_t
element
)
{
return
(
m_data
(
get_node
(
element
,
0
),
cell_vol_1
)
+
m_data
(
get_node
(
element
,
1
),
cell_vol_0
));}
//! \brief Return the volume of a cell (element of the dual mesh)
scalar_t
get_volume_cell
(
index_t
node
)
{
return
(
m_data
(
node
,
cell_vol_0
)
+
m_data
(
node
,
cell_vol_1
));}
//! \brief Return the volume of a cell inside an element
virtual
scalar_t
get_volume_cell_element
(
index_t
element
,
index_t
enode
)
{
if
(
enode
==
0
)
return
m_data
(
get_node
(
element
,
enode
),
cell_vol_1
);
else
return
m_data
(
get_node
(
element
,
enode
),
cell_vol_0
);
}
private
:
scalar_t
m_height
;
Matrix
m_data
;
Vector
m_face_radius
;
};
//! \brief Geometry information for a uniform axisymmetric mesh
//!
//! If (dx==-1) it is computed from the radius and the number of nodes
struct
UniformAxisymmetricMesh1DGeometry
{
index_t
nb_nodes
;
//!< Number of nodes in the mesh
scalar_t
radius
;
//!< Outside radius of the cylinder
scalar_t
dx
{
-
1
};
//!< Discretization step
scalar_t
height
;
//!< Height of the cylinder
};
//! \brief Return a shared_ptr to an axisymmetric mesh
//!
//! \param radius is a vector of the position of the nodes
//! \param height is the height of the sample (or depth)
Mesh1DPtr
SPECMICP_DLL_PUBLIC
axisymmetric_mesh1d
(
Vector
radius
,
scalar_t
height
);
//! \brief Factory method to build a pointer to a uniform axisymmetric 1D mesh
//!
//! Note: this method buil an AxisymmetricMesh1D instance while
//! the specmicp::mesh::axisymmetric_uniform_mesh1d method build a
//! specmicp::mesh::AxisymmetricUniformMesh1D instance.
Mesh1DPtr
SPECMICP_DLL_PUBLIC
uniform_axisymmetric_mesh1d
(
const
UniformAxisymmetricMesh1DGeometry
&
geometry
);
}
// end namespace mesh
}
// end namespace specmicp
#endif
// SPECMICP_DFPM_MESHES_AXISYMMETRICMESH1D_HPP
Event Timeline
Log In to Comment