Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include quadrature point data in checkpoints #819

Open
btalamini opened this issue Oct 6, 2022 · 0 comments · May be fixed by #1258
Open

Include quadrature point data in checkpoints #819

btalamini opened this issue Oct 6, 2022 · 0 comments · May be fixed by #1258
Assignees
Labels
bug Something isn't working discretization Discretization, numerics, and physics output Related to simulation output

Comments

@btalamini
Copy link
Member

btalamini commented Oct 6, 2022

We need to include quadrature data in restart files. We can't use the mfem::QuadratureFunction interface because this only works for struct-of-arrays, while serac uses array-of-structs. Instead, we should use a serialize the quadrature data object and use named buffers in Axom.

/**
* @brief A class for storing and access user-defined types at quadrature points
*
* @tparam the data type to be stored at each quadrature point
*
* @note users are not intended to create these objects directly, instead
* they should use the PhysicsModule::createQuadratureDataBuffer()
*/
template <typename T>
struct QuadratureData {
/// @brief a list of integers, one associated with each type of mfem::Geometry
using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
/**
* @brief Initialize a new quadrature data buffer, optionally with some initial value
*
* @param elements the number of elements of each geometry
* @param qpts_per_element how many quadrature points are present in each kind of element
* @param value (optional) value used to initialize the buffer
*/
QuadratureData(geom_array_t elements, geom_array_t qpts_per_element, T value = T{})
{
constexpr std::array geometries = {mfem::Geometry::SEGMENT, mfem::Geometry::TRIANGLE, mfem::Geometry::SQUARE,
mfem::Geometry::TETRAHEDRON, mfem::Geometry::CUBE};
for (auto geom : geometries) {
if (elements[uint32_t(geom)] > 0) {
data[geom] = axom::Array<T, 2>(elements[uint32_t(geom)], qpts_per_element[uint32_t(geom)]);
data[geom].fill(value);
}
}
}
/**
* @brief return the 2D array of quadrature point values for elements of the specified geometry
* @param geom which element geometry's data to return
*/
axom::ArrayView<T, 2> operator[](mfem::Geometry::Type geom) { return axom::ArrayView<T, 2>(data.at(geom)); }
/// @brief a 3D array indexed by (which geometry, which element, which quadrature point)
std::map<mfem::Geometry::Type, axom::Array<T, 2> > data;
};

https://github.com/LLNL/axom/blob/09ab17b68b67eacf45a9624e1909a1d700b1985a/src/axom/sidre/core/MFEMSidreDataCollection.hpp#L280-L301

https://github.com/LLNL/axom/blob/09ab17b68b67eacf45a9624e1909a1d700b1985a/src/axom/sidre/core/MFEMSidreDataCollection.hpp#L507

@jamiebramwell jamiebramwell added bug Something isn't working discretization Discretization, numerics, and physics output Related to simulation output labels Oct 24, 2022
@jamiebramwell jamiebramwell self-assigned this Oct 24, 2022
@white238 white238 linked a pull request Oct 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discretization Discretization, numerics, and physics output Related to simulation output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants