Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79589303
axisymmetric_mesh1d.cpp
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
Tue, Aug 27, 06:11
Size
3 KB
Mime Type
text/x-c
Expires
Thu, Aug 29, 06:11 (2 d)
Engine
blob
Format
Raw Data
Handle
20207860
Attached To
rSPECMICP SpecMiCP / ReactMiCP
axisymmetric_mesh1d.cpp
View Options
/*-------------------------------------------------------------------------------
Copyright (c) 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.
-----------------------------------------------------------------------------*/
#include "axisymmetric_mesh1d.hpp"
namespace specmicp {
namespace mesh {
AxisymmetricMesh1D::AxisymmetricMesh1D(Vector radius, scalar_t height):
Mesh1D(radius.rows()),
m_height(height),
m_data(radius.rows(), 3),
m_face_radius(radius.rows()-1)
{
// radius
m_data.col(0) = radius;
// Radius of the faces
for (index_t element=0; element<nb_elements(); ++element)
{
m_face_radius(element) = (radius(element+1)+radius(element))/2.0;
}
// Volume at the left of the cell
m_data(0, cell_vol_0) = 0.0;
for (index_t node=1; node<nb_nodes(); ++node)
{
m_data(node, cell_vol_0) = M_PI*height*(std::pow(m_face_radius(node-1), 2)
- std::pow(radius(node), 2));
}
// Volume of the cell at the right of the node
for (index_t node=0; node<nb_nodes()-1; ++node)
{
m_data(node, cell_vol_1) = M_PI*height*(std::pow(radius(node), 2)
- std::pow(m_face_radius(node), 2));
}
m_data(nb_nodes()-1, cell_vol_1) = 0.0;
}
Mesh1DPtr SPECMICP_DLL_PUBLIC axisymmetric_mesh1d(Vector radius, scalar_t height)
{
return std::static_pointer_cast<Mesh1D>(
std::make_shared<AxisymmetricMesh1D>(radius, height));
}
Mesh1DPtr SPECMICP_DLL_PUBLIC uniform_axisymmetric_mesh1d(index_t nb_nodes, scalar_t radius, scalar_t dx, scalar_t height)
{
Vector radius_s(nb_nodes);
for (index_t node=0; node<nb_nodes; ++node)
{
radius_s(node) = radius - node*dx;
}
return std::static_pointer_cast<Mesh1D>(
std::make_shared<AxisymmetricMesh1D>(radius_s, height));
}
} //end namespace mesh
} //end namespace specmicp
Event Timeline
Log In to Comment