-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from bendudson/paper-inputs
WIP: Inputs for Hermes-3 paper
- Loading branch information
Showing
39 changed files
with
1,506 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Analyse convergence towards steady state | ||
|
||
paths = [".", "pvode"] | ||
labels = ["NK", "PVODE"] | ||
linestyles = ["-", "--"] | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
from boutdata import collect | ||
|
||
cumulative_calls = [] | ||
times = [] | ||
source_mags = [] | ||
|
||
for path in paths: | ||
try: | ||
# Number of calls | ||
ncalls = collect("ncalls", path=path) # number of calls each output | ||
|
||
cumulative_calls.append(np.cumsum(ncalls)) # Summed over outputs | ||
|
||
t_array = collect("t_array", path=path) | ||
wci = collect("Omega_ci", path=path) | ||
times.append(t_array / wci) # Seconds | ||
|
||
# density source | ||
m = collect("density_source_multiplier_d+", path=path) | ||
source_mags.append(np.abs(m + 1)) | ||
except: | ||
break | ||
|
||
for calls, source, label, linestyle in zip(cumulative_calls, source_mags, labels, linestyles): | ||
plt.plot(calls, source, label=label, linestyle=linestyle) | ||
|
||
plt.yscale('log') | ||
plt.xlabel('RHS evaluations') | ||
plt.ylabel('Source magnitude [arb]') | ||
plt.legend() | ||
plt.savefig("source_rhsevals.pdf") | ||
plt.show() | ||
|
||
for time, source, label, linestyle in zip(times, source_mags, labels, linestyles): | ||
plt.plot(time, source, label=label, linestyle=linestyle) | ||
plt.yscale('log') | ||
plt.xlabel('Time [s]') | ||
plt.ylabel('Source magnitude [arb]') | ||
plt.legend() | ||
plt.savefig("source_time.pdf") | ||
plt.show() | ||
|
||
# Time derivatives | ||
|
||
for path, calls, label, linestyle in zip(paths, cumulative_calls, labels, linestyles): | ||
for varname, color in [("ddt(Nd+)", 'k'), ("ddt(Pd+)", 'r'), ("ddt(NVd+)",'b')]: | ||
dv = collect(varname, path=path) | ||
dv_rms = np.sqrt(np.sum(dv[:,0,:,0]**2, axis=1)) | ||
plt.plot(calls, dv_rms, label=label + " " + varname, linestyle=linestyle, color=color) | ||
plt.yscale('log') | ||
plt.ylabel("RMS time derivative over domain") | ||
plt.xlabel("RHS evaluations") | ||
plt.legend() | ||
plt.savefig("timederivs_rhsevals.pdf") | ||
plt.show() | ||
|
Oops, something went wrong.