Peano
Loading...
Searching...
No Matches
convergence-study Namespace Reference

Data Structures

class  Workers
 Number of scheme workers that are still running, and the lock to protect it. More...

Functions

 patch_size_of (volumes_per_axis)
 The patch size does not influence the solution.
 exact_solution (x, t, component)
 Component 0, ..., 3 of the scalar field: sin(2 pi x + m pi/4) transported along the characteristics.
 name_of (study, volumes_per_axis)
 build_and_run (study, volumes_per_axis, threads, work_directory)
 Generate, compile and run gauge-wave-with-scalar-field.py.
 measure_error (directory, volumes_per_axis)
 Maximum error of the four scalar fields along y=z=0.5 in the last snapshot.
 estimated_order (coarse, fine)
 Order from two meshes whose volume sizes differ by a factor of three.
 plot (results, studies, output_file)
 table (results, studies, meshes)
 check_orders (results, studies, meshes)
 The studies whose order between the two finest meshes is outside the expected range.
 exact_lapse (x, t)
 Lapse of the gauge wave, i.e.
 mesh_cells (volumes_per_axis)
 Number of mesh cells (patches) of a run.
 available_memory_in_kilobytes ()
 footprint_of (process)
 Resident memory in kilobytes of a process and its children (/usr/bin/time forks the executable).
 watch_memory (process, name)
 Wait for a process, but kill it if the machine runs out of memory.
 plot (results, schemes, meshes, output_file)
 Max error over the volume size.
 store ()
 run_scheme (scheme)
 One worker per scheme, all of them at the same time.
 study (scheme)

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))
float EndTime = 0.1
float Amplitude = 0.1
str PatchFile = "solution-ScalarField.peano-patch-file"
list Meshes = [9, 27, 81]
 Number of volumes per axis.
list Studies
 The scheme of both solvers, and the couplings that are studied for it.
dict ExpectedOrders
 Minimum estimated order between the two finest meshes.
dict MaximumOrders = {("rk4fd4", "outer-multiplicative"): 1.6}
 Orders which the couplings must not exceed (they would indicate that the exact solution is wrong).
 parser
 required
 True
 help
 default
 nargs
 type
 int
 args = parser.parse_args()
list studies = [tuple(s.split(":")) for s in args.studies]
 meshes = sorted(args.meshes)
 work_directory = os.path.abspath(args.work_directory)
 exist_ok
 results_file = os.path.join(work_directory, "results.json")
dict results = {}
 f
 indent
 output_directory
 markdown = table(results, studies, meshes)
 failures = check_orders(results, studies, meshes)
list Schemes = ["fv", "rk1fd4", "rk2fd4", "rk3fd4", "rk4fd4"]
int StagnationCells = 27
 Peano refines the root cell at least once, i.e.
 LargeRunSlots = threading.Semaphore(2)
 Runs on fine meshes are memory hungry, too.
 BuildSlots = threading.Semaphore(3)
 Compiling is memory hungry, i.e.
int MemoryFloor = 1500000
 Minimum memory (kilobytes) that has to stay available on the machine.
dict Footprints = {}
 Memory footprints (kilobytes) of the runs that currently run.
 choices
list todo
 alive
 max_workers
 HERE = os.path.dirname(os.path.abspath(__file__))
dict MINIMUM_ORDERS
 Orders the scheme has to reach at least, i.e.
list VOLUME_SIZES = ["0.0075", "0.0025", "0.00083"]
 work = os.path.abspath(args.work_directory)
list failed = [scheme for scheme in args.schemes if study(scheme) != 0]

Function Documentation

◆ available_memory_in_kilobytes()

convergence-study.available_memory_in_kilobytes ( )

Definition at line 138 of file convergence-study.py.

References exact_lapse(), int, measure_error(), name_of(), patch_size_of(), and watch_memory().

Referenced by watch_memory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_and_run()

convergence-study.build_and_run ( scheme,
volumes_per_axis,
threads,
work_directory )

Generate, compile and run gauge-wave-with-scalar-field.py.

Generate, compile and run gauge-wave.py.

Returns
dict Runtime, memory footprint, threads and the error against the exact solution at the last snapshot.

Definition at line 103 of file convergence-study.py.

References int, measure_error(), name_of(), and patch_size_of().

Referenced by run_scheme().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_orders()

convergence-study.check_orders ( results,
studies,
meshes )

The studies whose order between the two finest meshes is outside the expected range.

Return the list of schemes whose order between the two finest meshes is too low.

Definition at line 266 of file convergence-study.py.

References estimated_order(), and name_of().

Here is the call graph for this function:

◆ estimated_order()

convergence-study.estimated_order ( coarse,
fine )

Order from two meshes whose volume sizes differ by a factor of three.

Definition at line 205 of file convergence-study.py.

Referenced by check_orders(), and plot().

Here is the caller graph for this function:

◆ exact_lapse()

convergence-study.exact_lapse ( x,
t )

Lapse of the gauge wave, i.e.

sqrt(H) with H = 1 - A sin(2 pi (x-t))

Definition at line 124 of file convergence-study.py.

Referenced by available_memory_in_kilobytes().

Here is the caller graph for this function:

◆ exact_solution()

convergence-study.exact_solution ( x,
t,
component )

Component 0, ..., 3 of the scalar field: sin(2 pi x + m pi/4) transported along the characteristics.

Definition at line 91 of file convergence-study.py.

Referenced by measure_error().

Here is the caller graph for this function:

◆ footprint_of()

convergence-study.footprint_of ( process)

Resident memory in kilobytes of a process and its children (/usr/bin/time forks the executable).

Definition at line 281 of file convergence-study.py.

References int.

Referenced by watch_memory().

Here is the caller graph for this function:

◆ measure_error()

convergence-study.measure_error ( directory,
volumes_per_axis )

Maximum error of the four scalar fields along y=z=0.5 in the last snapshot.

Maximum error of the lapse along y=z=0.5 in the last snapshot.

Peano's PointProbe samples the unknowns in the centre of each volume.

Returns
time stamp of the snapshot, error

Peano's PointProbe samples the lapse in the centre of each volume.

Returns
time stamp of the snapshot, error

Definition at line 168 of file convergence-study.py.

References exact_solution().

Referenced by available_memory_in_kilobytes(), and build_and_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mesh_cells()

convergence-study.mesh_cells ( volumes_per_axis)

Number of mesh cells (patches) of a run.

Definition at line 129 of file convergence-study.py.

References patch_size_of().

Referenced by run_scheme().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name_of()

convergence-study.name_of ( study,
volumes_per_axis )

Definition at line 98 of file convergence-study.py.

Referenced by available_memory_in_kilobytes(), build_and_run(), check_orders(), plot(), run_scheme(), and table().

Here is the caller graph for this function:

◆ patch_size_of()

convergence-study.patch_size_of ( volumes_per_axis )

The patch size does not influence the solution.

Peano refines the root cell at least once, i.e. the coarsest mesh with 9 volumes per axis needs patches of size 3. All other meshes use patches of size 9.

Definition at line 61 of file convergence-study.py.

Referenced by available_memory_in_kilobytes(), build_and_run(), and mesh_cells().

Here is the caller graph for this function:

◆ plot() [1/2]

convergence-study.plot ( results,
schemes,
meshes,
output_file )

Max error over the volume size.

The gray lines are guides for the orders 1 to 4. The Runge-Kutta schemes of order three and four yield almost the same error, as the error of the fourth-order spatial discretisation dominates. We therefore use different markers.

Definition at line 332 of file convergence-study.py.

References estimated_order(), and name_of().

Here is the call graph for this function:

◆ plot() [2/2]

convergence-study.plot ( results,
studies,
output_file )

Definition at line 210 of file convergence-study.py.

◆ run_scheme()

convergence-study.run_scheme ( scheme)

One worker per scheme, all of them at the same time.

Each worker runs its meshes from coarse to fine. The runs on the coarse meshes do not scale and run with one thread. They are done long before the runs on the fine meshes get going, i.e. the biggest setups do not start at the same time. The cores are shared among the workers that still run.

Definition at line 481 of file convergence-study.py.

References build_and_run(), mesh_cells(), name_of(), and store().

Here is the call graph for this function:

◆ store()

convergence-study.store ( )

Definition at line 464 of file convergence-study.py.

Referenced by run_scheme().

Here is the caller graph for this function:

◆ study()

convergence-study.study ( scheme)

Definition at line 68 of file convergence-study.py.

◆ table()

convergence-study.table ( results,
studies,
meshes )

Definition at line 247 of file convergence-study.py.

References name_of().

Here is the call graph for this function:

◆ watch_memory()

convergence-study.watch_memory ( process,
name )

Wait for a process, but kill it if the machine runs out of memory.

Several runs go on at the same time. If less than MemoryFloor is available on the machine, the run with the biggest footprint of all runs is killed. The study then continues without that data point. Runs on fine meshes allocate their memory early, i.e. we do not waste hours before we learn that a run does not fit.

Returns
None if the process terminated on its own, otherwise the footprint in kilobytes when it was killed.

Definition at line 300 of file convergence-study.py.

References available_memory_in_kilobytes(), and footprint_of().

Referenced by available_memory_in_kilobytes().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ alive

convergence-study.alive

Definition at line 510 of file convergence-study.py.

◆ Amplitude

float convergence-study.Amplitude = 0.1

Definition at line 53 of file convergence-study.py.

◆ args

convergence-study.args = parser.parse_args()

Definition at line 302 of file convergence-study.py.

◆ BuildSlots

convergence-study.BuildSlots = threading.Semaphore(3)

Compiling is memory hungry, i.e.

only a few builds run at the same time

Definition at line 114 of file convergence-study.py.

◆ choices

convergence-study.choices

Definition at line 439 of file convergence-study.py.

◆ default

convergence-study.default

Definition at line 291 of file convergence-study.py.

◆ EndTime

float convergence-study.EndTime = 0.1

Definition at line 52 of file convergence-study.py.

◆ exist_ok

convergence-study.exist_ok

Definition at line 307 of file convergence-study.py.

◆ ExpectedOrders

dict convergence-study.ExpectedOrders
Initial value:
1= {
2 ("rk4fd4", "outer-multiplicative"): 0.8,
3 ("rk4fd4", "inner-additive"): 3.2,
4 ("rk4fd4", "inner-multiplicative"): 3.2,
5 ("fv", "outer-multiplicative"): 0.7,
6 ("fv", "inner-additive"): 0.7,
7 ("fv", "inner-multiplicative"): 0.7,
8}

Minimum estimated order between the two finest meshes.

Minimum estimated order between the two finest meshes that the schemes have to reach.

The outer coupling freezes the spacetime within the time step (first order). The inner couplings with rk4fd4 keep the order of the time integrator, which the fourth-order discretisation in space can not exceed. Finite Volumes are first order. The values include a safety margin.

The Runge-Kutta schemes are limited by the order of their time integration, the Finite Volume scheme by its first-order spatial discretisation. The values include a safety margin.

Definition at line 79 of file convergence-study.py.

◆ f

convergence-study.f

Definition at line 321 of file convergence-study.py.

◆ failed

list convergence-study.failed = [scheme for scheme in args.schemes if study(scheme) != 0]

Definition at line 111 of file convergence-study.py.

◆ failures

Definition at line 330 of file convergence-study.py.

◆ Footprints

dict convergence-study.Footprints = {}

Memory footprints (kilobytes) of the runs that currently run.

Definition at line 278 of file convergence-study.py.

◆ help

convergence-study.help

Definition at line 288 of file convergence-study.py.

◆ HERE

convergence-study.HERE = os.path.dirname(os.path.abspath(__file__))

Definition at line 24 of file convergence-study.py.

◆ Here

convergence-study.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 40 of file convergence-study.py.

◆ indent

convergence-study.indent

Definition at line 321 of file convergence-study.py.

◆ int

convergence-study.int

◆ LargeRunSlots

convergence-study.LargeRunSlots = threading.Semaphore(2)

Runs on fine meshes are memory hungry, too.

Only a few of them run at once; main() sets the number.

Definition at line 111 of file convergence-study.py.

◆ markdown

convergence-study.markdown = table(results, studies, meshes)

Definition at line 325 of file convergence-study.py.

◆ max_workers

convergence-study.max_workers

Definition at line 512 of file convergence-study.py.

◆ MaximumOrders

dict convergence-study.MaximumOrders = {("rk4fd4", "outer-multiplicative"): 1.6}

Orders which the couplings must not exceed (they would indicate that the exact solution is wrong).

Definition at line 88 of file convergence-study.py.

◆ MemoryFloor

int convergence-study.MemoryFloor = 1500000

Minimum memory (kilobytes) that has to stay available on the machine.

Definition at line 275 of file convergence-study.py.

◆ Meshes

list convergence-study.Meshes = [9, 27, 81]

Number of volumes per axis.

The meshes are regular and refined by factors of three. Peano refines the root cell at least once, i.e. the coarsest mesh needs patches of size 3.

The meshes are regular and refined by factors of three, and the patch size is 9.

Definition at line 58 of file convergence-study.py.

◆ meshes

convergence-study.meshes = sorted(args.meshes)

Definition at line 305 of file convergence-study.py.

◆ MINIMUM_ORDERS

dict convergence-study.MINIMUM_ORDERS
Initial value:
1= {
2 "fv": 0.8,
3 "fv-optimistic": 0.8,
4 "rk1fd4": 0.8,
5 "rk2fd4": 1.8,
6 "rk3fd4": 2.8,
7 "rk4fd4": 3.5,
8}

Orders the scheme has to reach at least, i.e.

slightly below the formal ones

Definition at line 26 of file convergence-study.py.

◆ nargs

convergence-study.nargs

Definition at line 296 of file convergence-study.py.

◆ output_directory

convergence-study.output_directory

Definition at line 323 of file convergence-study.py.

◆ parser

convergence-study.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Convergence study of the gauge wave with a scalar field"
3 )

Definition at line 285 of file convergence-study.py.

◆ PatchFile

str convergence-study.PatchFile = "solution-ScalarField.peano-patch-file"

Definition at line 54 of file convergence-study.py.

◆ PeanoRoot

convergence-study.PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))

Definition at line 41 of file convergence-study.py.

◆ required

convergence-study.required

Definition at line 288 of file convergence-study.py.

◆ results

dict convergence-study.results = {}

Definition at line 309 of file convergence-study.py.

◆ results_file

convergence-study.results_file = os.path.join(work_directory, "results.json")

Definition at line 308 of file convergence-study.py.

◆ Schemes

convergence-study.Schemes = ["fv", "rk1fd4", "rk2fd4", "rk3fd4", "rk4fd4"]

Definition at line 86 of file convergence-study.py.

◆ StagnationCells

int convergence-study.StagnationCells = 27

Peano refines the root cell at least once, i.e.

there are at least 27 mesh cells. Runs up to this number of mesh cells do not scale to many cores.

Definition at line 94 of file convergence-study.py.

◆ Studies

list convergence-study.Studies
Initial value:
1= [
2 ("rk4fd4", "outer-multiplicative"),
3 ("rk4fd4", "inner-additive"),
4 ("rk4fd4", "inner-multiplicative"),
5 ("fv", "outer-multiplicative"),
6 ("fv", "inner-additive"),
7 ("fv", "inner-multiplicative"),
8]

The scheme of both solvers, and the couplings that are studied for it.

Definition at line 66 of file convergence-study.py.

◆ studies

list convergence-study.studies = [tuple(s.split(":")) for s in args.studies]

Definition at line 304 of file convergence-study.py.

◆ todo

list convergence-study.todo
Initial value:
1= [
2 (s, v)
3 for s in args.schemes
4 for v in meshes
5 if name_of(s, v) not in results or "skipped" in results[name_of(s, v)]
6 ]

Definition at line 469 of file convergence-study.py.

◆ True

convergence-study.True

Definition at line 288 of file convergence-study.py.

◆ type

convergence-study.type

Definition at line 300 of file convergence-study.py.

◆ VOLUME_SIZES

list convergence-study.VOLUME_SIZES = ["0.0075", "0.0025", "0.00083"]

Definition at line 34 of file convergence-study.py.

◆ work

convergence-study.work = os.path.abspath(args.work_directory)

Definition at line 64 of file convergence-study.py.

◆ work_directory

convergence-study.work_directory = os.path.abspath(args.work_directory)

Definition at line 306 of file convergence-study.py.