Theseus
Compressible flow solver
Loading...
Searching...
No Matches
StabilityEstimate.hpp
Go to the documentation of this file.
1// Copyright (c) 2025-2026 Board of Trustees of the University of Illinois
2//
3// SPDX-License-Identifier: BSD-3-Clause
4#pragma once
5
6#include "mfem.hpp"
7#include "theseus_kernels.hpp"
8#include <algorithm>
9
10namespace Theseus
11{
12 MFEM_HOST_DEVICE inline mfem::real_t MappedDirectionalAcousticRate(
13 const mfem::real_t velocity_dot_metric,
14 const mfem::real_t metric_norm_squared,
15 const mfem::real_t sound_speed,
16 const mfem::real_t inverse_jacobian)
17 {
18 return (Kernels::rabs(velocity_dot_metric)
19 + sound_speed*Kernels::rsqrt(metric_norm_squared))
20 * inverse_jacobian;
21 }
22
24 {
25 mfem::real_t advective_rate = 0.0;
26 mfem::real_t surface_rate = 0.0;
27 mfem::real_t diffusive_rate = 0.0;
28
29 mfem::real_t TotalRate() const
30 {
31 return std::max(advective_rate, surface_rate) + diffusive_rate;
32 }
33
34 mfem::real_t CFL(const mfem::real_t step) const
35 {
36 return step * TotalRate();
37 }
38 };
39
40 // Spectral radii of the unit-speed, unit-cell, periodic 1-D upwind DGSEM
41 // advection operator. A five-percent margin covers the finite periodic
42 // calibration grid and small implementation differences. Higher orders use
43 // a conservative continuation of the observed O((p+1)^2) envelope.
44 inline mfem::real_t ReferenceAdvectionSpectralScale(const int order)
45 {
46 constexpr mfem::real_t calibrated[] = {
47 0.0, 2.19706891727, 5.41995189335, 9.64849524786,
48 14.7297419321, 20.5984751391, 27.2141622680, 34.5459214016,
49 42.5691944324, 51.2637780299, 60.6126232210, 70.6010566044,
50 81.2162499718
51 };
52 if (order > 0 && order < int(sizeof(calibrated) / sizeof(calibrated[0])))
53 return mfem::real_t(1.05) * calibrated[order];
54 const mfem::real_t points = std::max(1, order + 1);
55 return mfem::real_t(0.65) * points * points;
56 }
57
58 // Spectral radii of G*G for the periodic, unit-cell scalar BR1 operator,
59 // where G is the DGSEM auxiliary-gradient operator with central traces.
60 // The margin is larger than for advection because the compressible viscous
61 // operator couples primitive gradients through state-dependent transport and
62 // because physical boundary closures need not have the periodic spectrum.
63 inline mfem::real_t ReferenceBR1DiffusionSpectralScale(const int order)
64 {
65 constexpr mfem::real_t calibrated[] = {
66 0.0, 4.0, 25.5969429388, 82.9000427145, 203.470468982,
67 426.230394541, 799.733889878, 1383.0975821, 2244.38177282,
68 3461.2550528, 5121.29136549, 7321.77632194, 10169.7148876
69 };
70 if (order > 0 && order < int(sizeof(calibrated) / sizeof(calibrated[0])))
71 return mfem::real_t(1.25) * calibrated[order];
72 const mfem::real_t points = std::max(1, order + 1);
73 return mfem::real_t(0.5) * points * points * points * points;
74 }
75}
MFEM_HOST_DEVICE mfem::real_t rsqrt(mfem::real_t x)
Definition theseus_kernels.hpp:19
MFEM_HOST_DEVICE mfem::real_t rabs(mfem::real_t x)
Definition theseus_kernels.hpp:22
Definition AxisymmetricGeometry.hpp:15
MFEM_HOST_DEVICE mfem::real_t MappedDirectionalAcousticRate(const mfem::real_t velocity_dot_metric, const mfem::real_t metric_norm_squared, const mfem::real_t sound_speed, const mfem::real_t inverse_jacobian)
Definition StabilityEstimate.hpp:12
mfem::real_t ReferenceAdvectionSpectralScale(const int order)
Definition StabilityEstimate.hpp:44
mfem::real_t ReferenceBR1DiffusionSpectralScale(const int order)
Definition StabilityEstimate.hpp:63
Definition StabilityEstimate.hpp:24
mfem::real_t advective_rate
Definition StabilityEstimate.hpp:25
mfem::real_t surface_rate
Definition StabilityEstimate.hpp:26
mfem::real_t CFL(const mfem::real_t step) const
Definition StabilityEstimate.hpp:34
mfem::real_t diffusive_rate
Definition StabilityEstimate.hpp:27
mfem::real_t TotalRate() const
Definition StabilityEstimate.hpp:29