restrict c_max when using h2 operators

This commit is contained in:
Magnus Ulimoen 2020-05-04 17:59:49 +02:00
parent 2f98fae1c6
commit 366c030942
1 changed files with 10 additions and 1 deletions

View File

@ -132,7 +132,16 @@ impl System {
/// Suggested maximum dt for this problem /// Suggested maximum dt for this problem
fn max_dt(&self) -> Float { fn max_dt(&self) -> Float {
let c_max = 1.0; let c_max = if self.operators.iter().any(|op| {
op.as_ref().either(
|op| op.is_h2xi() || op.is_h2eta(),
|op| op.is_h2xi() || op.is_h2eta(),
)
}) {
0.5
} else {
1.0
};
let mut max_dt: Float = Float::INFINITY; let mut max_dt: Float = Float::INFINITY;
for (field, metrics) in self.fnow.iter().zip(self.metrics.iter()) { for (field, metrics) in self.fnow.iter().zip(self.metrics.iter()) {