Peano
Loading...
Searching...
No Matches
523_higher-order-fd Namespace Reference

Functions

 create_scheme (name, solver)
 The numerical scheme, grid construction and plotter of one run.
 
 build_and_run (name, directory, peano_installation, end_time)
 Generate, compile and run one setup within directory.
 
 probe (directory, point, output_file)
 Probe all snapshots at one point.
 
 profile (directory)
 Probe lapse and phi in the centre of each volume or grid cell along the line y=z=h/2, i.e.
 
 radius (x)
 
 time_steps (directory)
 Number of time steps and average wall clock time per time step.
 
 plot_over_time_and_profile (runs, names, file_name)
 Lapse next to the puncture over time (left) and along the x-axis at the last snapshot all runs share (right)
 
 plot_fourier_analysis ()
 Fourier analysis of the fourth-order central differences and of the Kreiss-Oliger dissipation.
 

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 
 PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", "..", ".."))
 
str PatchFile = "solution-CCZ4.peano-patch-file"
 
float Mass = 1.0
 
float DomainOffset = -9.0
 
float DomainSize = 18.0
 
int CellsPerAxis = 9
 
int PatchSize = 10
 
int VolumesPerAxis = CellsPerAxis * PatchSize
 
float H = DomainSize / VolumesPerAxis
 
int Threads = 4
 
float TimeInBetweenPlots = 0.5
 
 DissipationSubset = list(range(0, 23)) + [53, 54]
 Unknowns which the restricted Kreiss-Oliger dissipation damps: Q0-Q22 (G, K, theta, Z, lapse, shift, b) and Q53-Q54 (traceK, phi)
 
dict Runs
 The runs: name -> (Kreiss-Oliger sigma or None, lopsided advection, quantities of the dissipation or None for all).
 
dict Style
 Colours, markers and labels per run, so all pictures use the same ones.
 
 parser
 
 default
 
 help
 
 type
 
 float
 
 nargs
 
 args = parser.parse_args()
 
 work_directory
 
dict runs = {}
 
 directory = os.path.join(os.path.abspath(work_directory), name)
 
 runtime
 
 success
 
 x
 
 t
 
 lapse
 
 phi
 
int centre = VolumesPerAxis // 2
 
 statistics = time_steps(directory)
 
list ko_runs = [name for name in Style if name.startswith("fd4-ko") and name in runs]
 
list lopsided_runs
 

Function Documentation

◆ build_and_run()

523_higher-order-fd.build_and_run (   name,
  directory,
  peano_installation,
  end_time 
)

Generate, compile and run one setup within directory.

Returns the runtime of the executable in seconds and whether it terminated successfully. If the directory holds the result of a previous run, we do not rerun but return the stored values.

Definition at line 160 of file 523_higher-order-fd.py.

References create_scheme(), float, and exagrype.api.initialvalues.single_black_hole().

Here is the call graph for this function:

◆ create_scheme()

523_higher-order-fd.create_scheme (   name,
  solver 
)

The numerical scheme, grid construction and plotter of one run.

Definition at line 113 of file 523_higher-order-fd.py.

Referenced by build_and_run().

Here is the caller graph for this function:

◆ plot_fourier_analysis()

523_higher-order-fd.plot_fourier_analysis ( )

Fourier analysis of the fourth-order central differences and of the Kreiss-Oliger dissipation.

A Fourier mode exp(i k x) on a grid with spacing h is characterised by theta = k h between 0 (smooth) and pi (changes sign from grid cell to grid cell). The left picture shows the wave number which the fourth-order central difference "sees", i.e. theta_eff = (8 sin theta - sin 2 theta) / 6, against the exact one. The right picture shows the rate h/sigma * lambda with which the Kreiss-Oliger term sigma/(64 h) * (Q_{i-3} - 6 Q_{i-2} + ... + Q_{i+3}) damps the mode along one axis, i.e. (4 sin^2(theta/2))^3 / 64.

Definition at line 371 of file 523_higher-order-fd.py.

◆ plot_over_time_and_profile()

523_higher-order-fd.plot_over_time_and_profile (   runs,
  names,
  file_name 
)

Lapse next to the puncture over time (left) and along the x-axis at the last snapshot all runs share (right)

Definition at line 319 of file 523_higher-order-fd.py.

References radius().

Here is the call graph for this function:

◆ probe()

523_higher-order-fd.probe (   directory,
  point,
  output_file 
)

Probe all snapshots at one point.

Returns the time stamps, the lapse and the conformal factor phi.

Definition at line 242 of file 523_higher-order-fd.py.

References float.

◆ profile()

523_higher-order-fd.profile (   directory)

Probe lapse and phi in the centre of each volume or grid cell along the line y=z=h/2, i.e.

through the centres next to the puncture

Returns the x coordinates, the time stamps and two 2d arrays lapse[snapshot,x] and phi[snapshot,x].

Definition at line 268 of file 523_higher-order-fd.py.

◆ radius()

523_higher-order-fd.radius (   x)

Definition at line 295 of file 523_higher-order-fd.py.

Referenced by plot_over_time_and_profile().

Here is the caller graph for this function:

◆ time_steps()

523_higher-order-fd.time_steps (   directory)

Number of time steps and average wall clock time per time step.

Both stem from the final report of peano4::DefaultStepReport in run.log, i.e. from the line "TimeStep: ...s (avg=...,#measurements=...". Returns None if the run did not terminate regularly.

Definition at line 299 of file 523_higher-order-fd.py.

References float.

Variable Documentation

◆ args

523_higher-order-fd.args = parser.parse_args()

Definition at line 447 of file 523_higher-order-fd.py.

◆ CellsPerAxis

int 523_higher-order-fd.CellsPerAxis = 9

Definition at line 72 of file 523_higher-order-fd.py.

◆ centre

int 523_higher-order-fd.centre = VolumesPerAxis // 2

Definition at line 463 of file 523_higher-order-fd.py.

◆ default

523_higher-order-fd.default

Definition at line 430 of file 523_higher-order-fd.py.

◆ directory

523_higher-order-fd.directory = os.path.join(os.path.abspath(work_directory), name)

Definition at line 457 of file 523_higher-order-fd.py.

◆ DissipationSubset

523_higher-order-fd.DissipationSubset = list(range(0, 23)) + [53, 54]

Unknowns which the restricted Kreiss-Oliger dissipation damps: Q0-Q22 (G, K, theta, Z, lapse, shift, b) and Q53-Q54 (traceK, phi)

Definition at line 81 of file 523_higher-order-fd.py.

◆ DomainOffset

float 523_higher-order-fd.DomainOffset = -9.0

Definition at line 70 of file 523_higher-order-fd.py.

◆ DomainSize

float 523_higher-order-fd.DomainSize = 18.0

Definition at line 71 of file 523_higher-order-fd.py.

◆ float

523_higher-order-fd.float

Definition at line 439 of file 523_higher-order-fd.py.

Referenced by build_and_run(), probe(), and time_steps().

◆ H

float 523_higher-order-fd.H = DomainSize / VolumesPerAxis

Definition at line 75 of file 523_higher-order-fd.py.

◆ help

523_higher-order-fd.help

Definition at line 431 of file 523_higher-order-fd.py.

◆ Here

523_higher-order-fd.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 52 of file 523_higher-order-fd.py.

◆ ko_runs

list 523_higher-order-fd.ko_runs = [name for name in Style if name.startswith("fd4-ko") and name in runs]

Definition at line 503 of file 523_higher-order-fd.py.

◆ lapse

523_higher-order-fd.lapse

Definition at line 461 of file 523_higher-order-fd.py.

◆ lopsided_runs

list 523_higher-order-fd.lopsided_runs
Initial value:
1= [
2 name for name in Style if name.startswith("fd4-lop") and name in runs
3 ]

Definition at line 510 of file 523_higher-order-fd.py.

◆ Mass

float 523_higher-order-fd.Mass = 1.0

Definition at line 69 of file 523_higher-order-fd.py.

◆ nargs

523_higher-order-fd.nargs

Definition at line 443 of file 523_higher-order-fd.py.

◆ parser

523_higher-order-fd.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Create the PNGs of the tutorial 523_higher-order-fd.ipynb"
3 )

Definition at line 425 of file 523_higher-order-fd.py.

◆ PatchFile

str 523_higher-order-fd.PatchFile = "solution-CCZ4.peano-patch-file"

Definition at line 68 of file 523_higher-order-fd.py.

◆ PatchSize

int 523_higher-order-fd.PatchSize = 10

Definition at line 73 of file 523_higher-order-fd.py.

◆ PeanoRoot

523_higher-order-fd.PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", "..", ".."))

Definition at line 53 of file 523_higher-order-fd.py.

◆ phi

523_higher-order-fd.phi

Definition at line 461 of file 523_higher-order-fd.py.

◆ Runs

dict 523_higher-order-fd.Runs
Initial value:
1= {
2 "fv": (None, False, None),
3 "fd4": (None, False, None),
4 "fd4-ko-0.3": (0.3, False, None),
5 "fd4-ko-1.0": (1.0, False, None),
6 "fd4-ko-8.0": (8.0, False, None),
7 "fd4-lop": (None, True, None),
8 "fd4-lop-ko-8.0": (8.0, True, None),
9 "fd4-lop-ko-8.0-subset": (8.0, True, DissipationSubset),
10}

The runs: name -> (Kreiss-Oliger sigma or None, lopsided advection, quantities of the dissipation or None for all).

The fv run is special.

Definition at line 85 of file 523_higher-order-fd.py.

◆ runs

dict 523_higher-order-fd.runs = {}

Definition at line 455 of file 523_higher-order-fd.py.

◆ runtime

523_higher-order-fd.runtime

Definition at line 458 of file 523_higher-order-fd.py.

◆ statistics

523_higher-order-fd.statistics = time_steps(directory)

Definition at line 464 of file 523_higher-order-fd.py.

◆ Style

dict 523_higher-order-fd.Style
Initial value:
1= {
2 "fv": ("tab:blue", "o", "Finite Volumes"),
3 "fd4": ("tab:red", "s", "FD4, no dissipation"),
4 "fd4-ko-0.3": ("tab:green", "^", r"FD4, KO $\sigma=0.3$"),
5 "fd4-ko-1.0": ("tab:purple", "v", r"FD4, KO $\sigma=1$"),
6 "fd4-ko-8.0": ("tab:orange", "D", r"FD4, KO $\sigma=8$"),
7 "fd4-lop": ("tab:brown", "P", "FD4, lopsided, no dissipation"),
8 "fd4-lop-ko-8.0": ("tab:pink", "X", r"FD4, lopsided, KO $\sigma=8$ (all)"),
9 "fd4-lop-ko-8.0-subset": (
10 "tab:olive",
11 "*",
12 r"FD4, lopsided, KO $\sigma=8$ (Q0-Q22, Q53-Q54)",
13 ),
14}

Colours, markers and labels per run, so all pictures use the same ones.

Definition at line 97 of file 523_higher-order-fd.py.

◆ success

523_higher-order-fd.success

Definition at line 458 of file 523_higher-order-fd.py.

◆ t

523_higher-order-fd.t

Definition at line 461 of file 523_higher-order-fd.py.

◆ Threads

int 523_higher-order-fd.Threads = 4

Definition at line 76 of file 523_higher-order-fd.py.

◆ TimeInBetweenPlots

float 523_higher-order-fd.TimeInBetweenPlots = 0.5

Definition at line 77 of file 523_higher-order-fd.py.

◆ type

523_higher-order-fd.type

Definition at line 439 of file 523_higher-order-fd.py.

◆ VolumesPerAxis

int 523_higher-order-fd.VolumesPerAxis = CellsPerAxis * PatchSize

Definition at line 74 of file 523_higher-order-fd.py.

◆ work_directory

523_higher-order-fd.work_directory
Initial value:
1= args.work_directory or stack.enter_context(
2 tempfile.TemporaryDirectory()
3 )

Definition at line 452 of file 523_higher-order-fd.py.

◆ x

523_higher-order-fd.x

Definition at line 461 of file 523_higher-order-fd.py.