Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::postprocessing Namespace Reference

Functions

std::vector< double > computeOrder (const std::vector< double > &err, const std::vector< double > &h)
 Estimate convergence orders from a sequence of errors and mesh sizes.
void printConvergenceTable (const std::vector< double > &h_vec, const std::vector< std::pair< std::string, std::vector< double > > > &series, const std::string &output_dir="", const std::string &filename_stem="convergence")
 Print a unified convergence table for one or more named error series.
template<typename MeshType, typename FeSpaceType>
Eigen::MatrixXd projectSolution (const dofs::DofHandler< MeshType > &dof_handler, const assemble::CellManager< MeshType, FeSpaceType > &cell_manager, const la::Vector &solution)
 Evaluate a solution vector on the vertices of a mesh.
template<typename MeshType, typename FeSpaceType>
datastructure::CrsMap< double, typename MeshType::index_t > projectSolutionSubmesh (const geometry::MeshExporterSubmesh< MeshType > &mesh_exporter, const dofs::DofHandler< MeshType > &dof_handler, const assemble::CellManager< MeshType, FeSpaceType > &cell_manager, const la::Vector &solution)
 Evaluate a finite element solution on the vertices of the mesh sub-triangulation used for visualization.

Function Documentation

◆ computeOrder()

std::vector< double > vulpes::postprocessing::computeOrder ( const std::vector< double > & err,
const std::vector< double > & h )
inline

Estimate convergence orders from a sequence of errors and mesh sizes.

For consecutive refinement levels i and i+1, the order is computed as log(err[i] / err[i+1]) / log(h[i] / h[i+1]).

Parameters
errError values, one per refinement level (size >= 1).
hMesh diameters corresponding to each level (same size as err).
Returns
Vector of orders, size = err.size() - 1 (empty for a single level).
Exceptions
std::invalid_argumentif sizes are mismatched or zero.

◆ printConvergenceTable()

void vulpes::postprocessing::printConvergenceTable ( const std::vector< double > & h_vec,
const std::vector< std::pair< std::string, std::vector< double > > > & series,
const std::string & output_dir = "",
const std::string & filename_stem = "convergence" )
inline

Print a unified convergence table for one or more named error series.

Each entry in series is a (column_name, error_vector) pair. Convergence orders are computed internally between consecutive refinement levels. Format: scientific notation (3 sig-figs) for errors, fixed (2 d.p.) for orders, "---" on the first row where no order is available.

Parameters
h_vecMesh diameters, one per refinement level.
seriesNamed error series to display. All vectors must match h_vec.
output_dirIf non-empty, the table is also saved as a CSV in this directory (created if it does not exist).
filename_stemBase name of the CSV file without extension.

◆ projectSolution()

template<typename MeshType, typename FeSpaceType>
Eigen::MatrixXd vulpes::postprocessing::projectSolution ( const dofs::DofHandler< MeshType > & dof_handler,
const assemble::CellManager< MeshType, FeSpaceType > & cell_manager,
const la::Vector & solution )

Evaluate a solution vector on the vertices of a mesh.

The solution is a la::Vector containing the coefficients of the finite element basis. The basis can be nodal or modal.

Template Parameters
MeshTypeMesh type.
FeSpaceTypeFinite element space type.
Parameters
dof_handlerCell-to-dof connectivity.
cell_managerMesh and finite element cell data.
solutionCoefficients of the finite element basis.
Returns
Matrix of size block_size x number_of_vertices.
Warning
Full-mesh projection is not supported for parallel meshes.

◆ projectSolutionSubmesh()

template<typename MeshType, typename FeSpaceType>
datastructure::CrsMap< double, typename MeshType::index_t > vulpes::postprocessing::projectSolutionSubmesh ( const geometry::MeshExporterSubmesh< MeshType > & mesh_exporter,
const dofs::DofHandler< MeshType > & dof_handler,
const assemble::CellManager< MeshType, FeSpaceType > & cell_manager,
const la::Vector & solution )

Evaluate a finite element solution on the vertices of the mesh sub-triangulation used for visualization.

The solution is a la::Vector containing the coefficients of the finite element basis. The basis can be nodal or modal. For each original mesh cell, the solution is evaluated at the vertices of the corresponding VTK subgrid.

Template Parameters
MeshTypeMesh type.
FeSpaceTypeFinite element space type.
Parameters
mesh_exporterSubmesh exporter containing the generated VTK subgrids.
dof_handlerCell-to-dof connectivity.
cell_managerMesh, mappings, and finite element cell data.
solutionCoefficients of the finite element basis.
Returns
CRS map containing one row per exported cell/subgrid. Each row stores the projected values on that subgrid, flattened as vertex_id * block_size + component.
Note
In parallel, only owned cells are projected. The function assumes that the dofs of owned cells are locally owned by the rank, as expected for the DG/modal workflow.