From 366c030942141c0148b82ea21a6f84aa0abe5c36 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 4 May 2020 17:59:49 +0200 Subject: [PATCH] restrict c_max when using h2 operators --- multigrid/src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/multigrid/src/main.rs b/multigrid/src/main.rs index b5f01aa..80cff29 100644 --- a/multigrid/src/main.rs +++ b/multigrid/src/main.rs @@ -132,7 +132,16 @@ impl System { /// Suggested maximum dt for this problem 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; for (field, metrics) in self.fnow.iter().zip(self.metrics.iter()) {