From 02db1e6d746b0d8ef98320525b5798be02101f7f Mon Sep 17 00:00:00 2001 From: Davor Dundovic <33790330+ddundo@users.noreply.github.com> Date: Tue, 12 Mar 2024 12:40:37 +0100 Subject: [PATCH] Fix time in plots (#136) Closes #120. Fix annotated time shown in plot.py --- goalie/plot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/goalie/plot.py b/goalie/plot.py index 4bdd3f91..f7b9e2d6 100644 --- a/goalie/plot.py +++ b/goalie/plot.py @@ -1,6 +1,7 @@ """ Driver functions for plotting solution data. """ + from firedrake.pyplot import tricontourf, triplot # noqa import matplotlib.pyplot as plt @@ -42,8 +43,8 @@ def plot_snapshots(solutions, time_partition, field, label, **kwargs): tc.append(tricontourf(sol, axes=ax, **kwargs)) if not steady: time = ( - i * P.end_time / cols - + j * P.num_timesteps_per_export[i] * P.timesteps[i] + P.subintervals[i][0] + + (j + 1) * P.timesteps[i] * P.num_timesteps_per_export[i] ) ax.annotate(f"t={time:.2f}", (0.05, 0.05), color="white") tcs.append(tc) @@ -80,8 +81,8 @@ def plot_indicator_snapshots(indicators, time_partition, field, **kwargs): tc.append(tricontourf(indi, axes=ax, **kwargs)) if not steady: time = ( - i * P.end_time / cols - + j * P.num_timesteps_per_export[i] * P.timesteps[i] + P.subintervals[i][0] + + (j + 1) * P.timesteps[i] * P.num_timesteps_per_export[i] ) ax.annotate(f"t={time:.2f}", (0.05, 0.05), color="white") tcs.append(tc)