|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include "specfem/assembly/element_types.hpp" |
| 4 | +#include "specfem/assembly/info/impl/bounding_box.hpp" |
| 5 | +#include "specfem/assembly/info/impl/bounds.hpp" |
| 6 | +#include "specfem/assembly/mesh.hpp" |
| 7 | +#include "specfem/assembly/properties.hpp" |
| 8 | +#include "specfem/element.hpp" |
| 9 | +#include "specfem_setup.hpp" |
| 10 | + |
| 11 | +namespace specfem::assembly { |
| 12 | + |
| 13 | +/** |
| 14 | + * @brief Computes and stores mesh statistics and numerical stability |
| 15 | + * parameters. |
| 16 | + * |
| 17 | + * Analyzes the assembled mesh to extract spatial bounds, material property |
| 18 | + * ranges, and element geometry statistics. Estimates the minimum resolvable |
| 19 | + * period and suggests a time step based on the CFL condition. |
| 20 | + * |
| 21 | + * The minimum period estimation follows Komatitsch et al. (2005): |
| 22 | + * "average number of points per minimum wavelength in an element should be |
| 23 | + * around 5." |
| 24 | + * |
| 25 | + * @tparam DimensionTag Spatial dimension (dim2 or dim3) |
| 26 | + * |
| 27 | + * @note The minimum period is an empirical estimate, not a sharp cutoff. |
| 28 | + * Synthetics become progressively less accurate for shorter periods. |
| 29 | + */ |
| 30 | +template <specfem::element::dimension_tag DimensionTag> struct Info { |
| 31 | + constexpr static auto dimension_tag = DimensionTag; ///< Dimension tag |
| 32 | + |
| 33 | + Info() = default; |
| 34 | + |
| 35 | + /** |
| 36 | + * @brief Construct mesh info by analyzing mesh geometry and material |
| 37 | + * properties. |
| 38 | + * |
| 39 | + * @param mesh Assembled mesh containing element geometry and GLL points |
| 40 | + * @param properties Material properties at all mesh points |
| 41 | + * @param element_types Element classification by medium and property type |
| 42 | + */ |
| 43 | + Info(const specfem::assembly::mesh<dimension_tag> &mesh, |
| 44 | + const specfem::assembly::properties<dimension_tag> &properties, |
| 45 | + const specfem::assembly::element_types<dimension_tag> &element_types); |
| 46 | + |
| 47 | + info::impl::BoundingBox<dimension_tag> domain_bounds; ///< Spatial extent of |
| 48 | + ///< the mesh domain |
| 49 | + info::impl::Bounds element_size; ///< Element corner-to-corner distances |
| 50 | + info::impl::Bounds gll_distance; ///< Distances between adjacent GLL points |
| 51 | + info::impl::Bounds vp; ///< P-wave velocity range |
| 52 | + info::impl::Bounds vs; ///< S-wave velocity range |
| 53 | + info::impl::Bounds v; ///< Combined wave velocity range |
| 54 | + info::impl::Bounds rho; ///< Density range |
| 55 | + info::impl::Bounds vp_vs_ratio; ///< Vp/Vs ratio range |
| 56 | + |
| 57 | + type_real suggested_time_step; ///< Time step satisfying CFL condition |
| 58 | + type_real largest_minimum_period; ///< Maximum of minimum resolvable periods |
| 59 | + ///< across elements |
| 60 | + |
| 61 | + /** |
| 62 | + * @brief Generate formatted string representation of mesh statistics. |
| 63 | + * @return Multi-line string with labeled mesh properties |
| 64 | + */ |
| 65 | + std::string string() const; |
| 66 | +}; |
| 67 | + |
| 68 | +} // namespace specfem::assembly |
| 69 | + |
| 70 | +#include "specfem/assembly/info.tpp" |
0 commit comments