Peano 4
Loading...
Searching...
No Matches
CCZ4Solver.py
Go to the documentation of this file.
1import peano4
2import exahype2
3import dastgen2
4
5from abc import abstractmethod
6
7
8class AbstractCCZ4Solver(object):
9 """!
10
11 Abstract base class for any CCZ4 solver
12
13 Each CCZ4 solver inherits from this abstract base class which really only
14 defines some generic stuff such as the unknowns and includes that every
15 single solver will use.
16
17 The solver should, more or less, work out of the box, but you have to do
18 three things if you use a subclass:
19
20 1. If you use a CCZ4 solver, you will still have to add all the libraries to
21 your Peano project such that the Makefile picks them up. For this, the
22 solver offers an add_makefile_parameters().
23
24 2. You have to set the initial conditions via
25
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 my_solver.set_implementation(initial_conditions = " " "
28 for (int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) Q[i] = 0.0;
29 ::applications::exahype2::ccz4::gaugeWave(Q, volumeCentre, 0);
30 " " ")
31 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33 At this point, different CCZ4 solver variants might require different
34 syntax. The term volumeCentre for example above is only defined in a
35 finite volume ontext.
36
37 3. Finally, you have to add domain-specific constants to the project.
38 For this, call add_all_solver_constants(). See the comment below.
39
40 Further to that, you might want to have to set boundary conditions. By
41 default, we do not set any boundary conditions. This works fine if
42 periodic boundary conditions are used. But once you switch off periodic
43 boundary conditions, you have to tell the solver how to treat the boundary.
44 This is typically done via set_implementation(), too.
45
46 ## More complex scenarios
47
48 Setting particular implementations via set_implementation() is not always
49 convenient or possible. You might want to add new functions to your classes,
50 do something in the solver constructor, and so forth. If so, feel free to
51 modify the file MySolverName.cpp which the tool generates. In this context,
52 you might want to pass in
53
54 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 my_solver.set_implementation(initial_conditions = exahype2.solvers.PDETerms.User_Defined_Implementation,
56 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
57 boundary_conditions=exahype2.solvers.PDETerms.User_Defined_Implementation
58 )
59
60 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61
62 which ensures that you get the right hook-in methods generated when you
63 invoke the Python script for the first time. These methods will contain
64 todo comments for you. Subsequent runs of the Python API should not
65 overwrite the solver implementation.
66
67 ## Constants
68
69 Each CCZ4 solver requires a minimal set of constants. These are represented
70 by integer_constants and double_constants. Please augment these dictionaries.
71 Eventually, you have to submit all the constants via add_all_solver_constants().
72
73 """
74
75 """!
76
77 Dictionary which specifies the unknown names plus their cardinality
78
79 Has to be class attribute, as we need it in the constructor, i.e. before the
80 abstract object is created.
81
82 """
83 _FO_formulation_unknowns = {
84 "G": 6,
85 "K": 6,
86 "theta": 1,
87 "Z": 3,
88 "lapse": 1,
89 "shift": 3,
90 "b": 3,
91 "dLapse": 3,
92 "dxShift": 3,
93 "dyShift": 3,
94 "dzShift": 3,
95 "dxG": 6,
96 "dyG": 6,
97 "dzG": 6,
98 "traceK": 1,
99 "phi": 1,
100 "P": 3,
101 "K0": 1
102 }
103
104 """!
105
106 Primary unknowns of the CCZ4 formulation which are there in the initial
107 formulation. All the other variables are auxiliary variables, i.e. ones
108 introduced to return to a first-order formulation. Unfortunately, the
109 ordering in _FO_formulation_unknows is motivated by the original papers
110 and not by the fact which quantities are original ones and which one are
111 helper or auxiliary variables.
112
113 """
114 _SO_formulation_unknowns = {
115 "G",
116 "K",
117 "theta",
118 "Z",
119 "lapse",
120 "shift",
121 "b",
122 "traceK",
123 "phi",
124 }
125
126 Default_Time_Step_Size_Relaxation = 0.1
127
128 def __init__(self):
129 """!
130
131 Constructor
132
133 Initialise the two dictionaries with default values (which work).
134
135 """
137 "CCZ4LapseType": 0,
138 "CCZ4SO": 0,
139 }
141 "CCZ4ds": 1.0,
142 "CCZ4c": 1.0,
143 "CCZ4e": 1.0,
144 "CCZ4f": 0.75,
145 "CCZ4bs": 0.0,
146 "CCZ4sk": 0.0,
147 "CCZ4xi": 1.0,
148 "CCZ4itau": 1.0,
149 "CCZ4eta": 1.0,
150 "CCZ4k1": 0.1,
151 "CCZ4k2": 0.0,
152 "CCZ4k3": 0.5,
153 "CCZ4GLMc": 1.2,
154 "CCZ4GLMd": 2.0,
155 "CCZ4mu": 0.2
156 }
157
164 """!
165
166 Add the headers for the compute kernels and initial condition implementations
167
168 Usually called by the subclass constructor.
169
170 """
171 self.add_user_action_set_includes(
172 """
173#include "CCZ4Kernels.h"
174#include "SecondOrderAuxiliaryVariablesReconstruction.h"
175"""
176 )
177 self.add_user_solver_includes(
178 """
179#include "CCZ4Kernels.h"
180#include "InitialValues.h"
181#include "SecondOrderAuxiliaryVariablesReconstruction.h"
182#include <cstring>
183"""
184 )
185
187 """!
188
189 Add domain-specific constants
190
191 I need a couple of constants. I could either replace them directly
192 within the Python snippets below, but I prefer here to go a different
193 way and to export them as proper C++ constants.
194
195 There are two ways to inject solver constants into Peano: We can either
196 add them to the Makefile as global const expressions, or we can add
197 them to the ExaHyPE2 solver. The latter is the route we go down here,
198 as these constants logically belong to the solver and not to the project.
199
200 This operation uses the parent class' add_solver_constants(). You still
201 can use this operation to add further parameters. Or you can, as a user,
202 always add new entries to integer_constants or double_constants and then
203 call this routine rather than adding individual constants one by one.
204
205 """
206 for key, value in self.integer_constants.items():
207 self.add_solver_constants(
208 "static constexpr int {} = {};".format(key, value)
209 )
210 for key, value in self.double_constants.items():
211 self.add_solver_constants(
212 "static constexpr double {} = {};".format(key, value)
213 )
214
215 def add_makefile_parameters(self, peano4_project, path_of_ccz4_application):
216 """!
217
218 Add include path and minimal required cpp files to makefile
219
220 If you have multiple CCZ4 solvers, i.e. different solvers of CCZ4 or multiple
221 instances of the CCZ4 type, please call this operation only once on one of
222 your solvers. At the moment, I add hte following cpp files to the setup:
223
224 - InitialValues.cpp
225 - CCZ4Kernels.cpp
226 - SecondOrderAuxiliaryVariablesReconstruction.cpp
227
228 You can always add further files via
229 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230 peano4_project.output.makefile.add_cpp_file( "mypath/myfile.cpp" )
231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232
233 """
234 if path_of_ccz4_application[-1] != "/":
235 path_of_ccz4_application += "/"
236
237 peano4_project.output.makefile.add_cpp_file(
238 path_of_ccz4_application + "InitialValues.cpp"
239 )
240 peano4_project.output.makefile.add_cpp_file(
241 path_of_ccz4_application + "CCZ4Kernels.cpp"
242 )
243 peano4_project.output.makefile.add_cpp_file(
244 path_of_ccz4_application + "SecondOrderAuxiliaryVariablesReconstruction.cpp"
245 )
246 peano4_project.output.makefile.add_header_search_path(path_of_ccz4_application)
247
248 @abstractmethod
250 self,
251 name,
252 coordinates,
253 project,
254 number_of_entries_between_two_db_flushes,
255 data_delta_between_two_snapsots,
256 time_delta_between_two_snapsots,
257 clear_database_after_flush,
258 tracer_unknowns=None,
259 ):
260 """!
261
262 Add tracer to project
263
264 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
265 some of the arguments. Most of them are simply piped through to this
266 class.
267
268 The tracer is given a name and initial coordinates (list of three-tuples).
269 We need to know the underlying project as well, as we have to add the
270 tracing to the time stepping and the database update to the plotting.
271 ~~~~~~~~~~~~~~~~~~~~~~~
272 project.add_action_set_to_timestepping(my_interpolation)
273 project.add_action_set_to_timestepping(exahype2.tracer.DumpTracerIntoDatabase(
274 particle_set=tracer_particles,
275 solver=self,
276 filename=name + "-" + self._name,
277 number_of_entries_between_two_db_flushes=number_of_entries_between_two_db_flushes,
278 output_precision=10,
279 data_delta_between_two_snapsots = data_delta_between_two_snapsots,
280 time_delta_between_two_snapsots = time_delta_between_two_snapsots,
281 clear_database_after_flush = True,
282 ))
283 ~~~~~~~~~~~~~~~~~~~~~~~
284
285 """
286 assert "should not be called"
287 pass
288
289
292):
293 """!
294
295 CCZ4 solver using finite volumes and global adaptive time stepping incl enclave tasking
296
297 Please consult CCZ4Solver_FV_GlobalAdaptiveTimeStepWithEnclaveTasking.
298
299 """
300
302 self,
303 name,
304 patch_size,
305 min_volume_h,
306 max_volume_h,
307 use_heap_storage,
308 pde_terms_without_state
309 ):
310 AbstractCCZ4Solver.__init__(self)
311 exahype2.solvers.fv.rusanov.GlobalAdaptiveTimeStep.__init__(
312 self,
313 name=name,
314 patch_size=patch_size,
315 unknowns=sum(self._FO_formulation_unknowns.values()),
316 auxiliary_variables=0,
317 min_volume_h=min_volume_h,
318 max_volume_h=max_volume_h,
319 time_step_relaxation=AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation,
320 )
322
324 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
325 ncp=construct_FV_ncp(),
326 flux=exahype2.solvers.PDETerms.None_Implementation,
327 source_term=construct_FV_source_term(),
328 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
329 eigenvalues=construct_FV_eigenvalues(),
330 )
331
333
335 self,
336 name,
337 coordinates,
338 project,
339 number_of_entries_between_two_db_flushes,
340 data_delta_between_two_snapsots,
341 time_delta_between_two_snapsots,
342 clear_database_after_flush,
343 tracer_unknowns,
344 ):
345 """!
346
347 Add tracer to project
348
349 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
350 some of the arguments. Most of them are simply piped through to this
351 class.
352
353 project: exahype2.Project
354
355 """
357 name,
358 coordinates,
359 project,
360 self,
361 number_of_entries_between_two_db_flushes,
362 data_delta_between_two_snapsots,
363 time_delta_between_two_snapsots,
364 clear_database_after_flush,
365 tracer_unknowns,
366 )
367
368
370 AbstractCCZ4Solver,
372):
373 """!
374
375 CCZ4 solver using finite volumes and global adaptive time stepping incl enclave tasking
376
377 The constructor of this classs is straightforward and realises the standard
378 steps of any numerical implementation of the CCZ4 scheme:
379
380 1. Init the actual numerical scheme. This happens through the constructor
381 of the base class.
382
383 2. Add the header files that we need, i.e. those files which contain the
384 actual CCZ4 implementation.
385
386 3. Add some constants that any CCZ4 C++ code requires.
387
388 4. Set the actual implementation, i.e. link the generic PDE terms to the
389 CCZ4-specific function calls.
390
391 5. Add the CCZ4-specific postprocessing.
392
393 """
394
395 def __init__(self,
396 name,
397 patch_size,
398 min_volume_h,
399 max_volume_h,
400 use_heap_storage,
401 pde_terms_without_state,
402 ):
403 """!
404
405 Construct solver with enclave tasking and adaptive time stepping
406
407
408 ## Attributes
409
410 use_heap_storage: Boolean
411 By default, we place the patches on the heap but administer them through
412 a smart pointer. You can switch this default and enforce a "proper"
413 storage of the data on the heap. This usually introduces more memory
414 movements, though you might end up with a better memory alignment, i.e.
415 memory closer to the compute kernels.
416
417
418
419 """
420 AbstractCCZ4Solver.__init__(self)
421 exahype2.solvers.fv.rusanov.GlobalAdaptiveTimeStepWithEnclaveTasking.__init__(
422 self,
423 name=name,
424 patch_size=patch_size,
425 unknowns=sum(self._FO_formulation_unknowns.values()),
426 auxiliary_variables=0,
427 min_volume_h=min_volume_h,
428 max_volume_h=max_volume_h,
429 time_step_relaxation=AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation,
430 pde_terms_without_state=pde_terms_without_state
431 )
433
434 if use_heap_storage:
436 exahype2.solvers.fv.Storage.Heap, exahype2.solvers.fv.Storage.Heap
437 )
438 else:
440 exahype2.solvers.fv.Storage.SmartPointers,
441 exahype2.solvers.fv.Storage.SmartPointers,
442 )
443
445 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
446 ncp=construct_FV_ncp(),
447 flux=exahype2.solvers.PDETerms.None_Implementation,
448 source_term=construct_FV_source_term(),
449 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
450 eigenvalues=construct_FV_eigenvalues(),
451 )
452
454
456 self,
457 name,
458 coordinates,
459 project,
460 number_of_entries_between_two_db_flushes,
461 data_delta_between_two_snapsots,
462 time_delta_between_two_snapsots,
463 clear_database_after_flush,
464 tracer_unknowns,
465 ):
466 """!
467
468 Add tracer to project
469
470 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
471 some of the arguments. Most of them are simply piped through to this
472 class.
473
474
475 project: exahype2.Project
476
477 """
479 name,
480 coordinates,
481 project,
482 self,
483 number_of_entries_between_two_db_flushes,
484 data_delta_between_two_snapsots,
485 time_delta_between_two_snapsots,
486 clear_database_after_flush,
487 tracer_unknowns,
488 )
489
490
492 return """
493 double deltaQSerialised[NumberOfUnknowns*3];
494 for (int i=0; i<NumberOfUnknowns; i++) {
495 deltaQSerialised[i+0*NumberOfUnknowns] = 0.0;
496 deltaQSerialised[i+1*NumberOfUnknowns] = 0.0;
497 deltaQSerialised[i+2*NumberOfUnknowns] = 0.0;
498
499 deltaQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
500 }
501 ::applications::exahype2::ccz4::ncp(BTimesDeltaQ, Q, deltaQSerialised, normal%Dimensions, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
502"""
503
504
506 return """
507 double deltaQSerialised[NumberOfUnknowns*3];
508 for (int i=0; i<NumberOfUnknowns; i++) {
509 deltaQSerialised[i+0*NumberOfUnknowns] = 0.0;
510 deltaQSerialised[i+1*NumberOfUnknowns] = 0.0;
511 deltaQSerialised[i+2*NumberOfUnknowns] = 0.0;
512
513 deltaQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
514 }
515 ::applications::exahype2::ccz4::ncp(BTimesDeltaQ, Q, deltaQSerialised, normal%Dimensions, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
516"""
517
518
520 return """
521 tarch::memset(S, 0.0, NumberOfUnknowns*sizeof(double));
522 ::applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3, CCZ4SO);
523"""
524
525
527 return """
528 tarch::memset(S, 0.0, NumberOfUnknowns*sizeof(double));
529 ::applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3, CCZ4SO);
530"""
531
532
534 return """
535 return ::applications::exahype2::ccz4::maxEigenvalue(Q, normal%Dimensions, CCZ4e, CCZ4ds, CCZ4GLMc, CCZ4GLMd );
536"""
537
538
540 return """
541 return ::applications::exahype2::ccz4::maxEigenvalue(Q, normal%Dimensions, CCZ4e, CCZ4ds, CCZ4GLMc, CCZ4GLMd );
542"""
543
544
546 return """
547{
548 constexpr int itmax = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
549 int index = 0;
550 for (int i=0;i<itmax;i++)
551 {
552 applications::exahype2::ccz4::enforceCCZ4constraints( newQ+index );
553 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
554 }
555 }
556"""
557
558
560 return """
561{
562 constexpr int itmax = {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}};
563 int index = 0;
564 for (int i=0;i<itmax;i++)
565 {
566 applications::exahype2::ccz4::enforceCCZ4constraints( newQ+index );
567 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
568 }
569 }
570"""
571
572
574 name,
575 coordinates,
576 project,
577 solver,
578 number_of_entries_between_two_db_flushes,
579 data_delta_between_two_snapsots,
580 time_delta_between_two_snapsots,
581 clear_database_after_flush,
582 tracer_unknowns,
583):
584 """!
585
586 Add tracer to project
587
588 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
589 some of the arguments. Most of them are simply piped through to this
590 class.
591
592 I realise this as a separate routine, as we need it for all FV flavours
593
594 """
595 number_of_attributes = (
596 (solver.unknowns + solver.auxiliary_variables)
597 if tracer_unknowns == None
598 else len(tracer_unknowns)
599 )
600 tracer_particles = project.add_tracer(
601 name=name, attribute_count=number_of_attributes
602 )
604 particle_set=tracer_particles, coordinates=coordinates
605 )
606 init_action_set.descend_invocation_order = 0
607 project.add_action_set_to_initialisation(init_action_set)
608
609 project_on_tracer_properties_kernel = ""
610 if tracer_unknowns == None:
611 project_on_tracer_properties_kernel = (
612 "::exahype2::fv::projectAllValuesOntoParticle_piecewiseLinear"
613 )
614 # project_on_tracer_properties_kernel = "::exahype2::fv::projectAllValuesOntoParticle_piecewiseLinear_explicit_Euler"
615 elif len(tracer_unknowns) == 1:
616 project_on_tracer_properties_kernel = (
617 "::exahype2::fv::projectValueOntoParticle_piecewiseLinear<{},{}>".format(
618 i, tracer_unknowns.index(i)
619 )
620 )
621 else:
622 project_on_tracer_properties_kernel = (
623 "::exahype2::fv::projectValuesOntoParticle_piecewiseLinear<{}>".format(
624 tracer_unknowns
625 )
626 .replace("[", "")
627 .replace("]", "")
628 )
629
630 tracing_action_set = exahype2.tracer.FiniteVolumesTracing(
631 tracer_particles,
632 solver,
633 project_on_tracer_properties_kernel=project_on_tracer_properties_kernel,
634 )
635 tracing_action_set.descend_invocation_order = solver._action_set_update_cell.descend_invocation_order + 1
636 project.add_action_set_to_timestepping(tracing_action_set)
637 project.add_action_set_to_initialisation(tracing_action_set)
638
639 dump_into_database_action_set = exahype2.tracer.DumpTracerIntoDatabase(
640 particle_set=tracer_particles,
641 solver=solver,
642 filename=name + "-" + solver._name,
643 number_of_entries_between_two_db_flushes=number_of_entries_between_two_db_flushes,
644 output_precision=10,
645 data_delta_between_two_snapsots = data_delta_between_two_snapsots,
646 time_delta_between_two_snapsots = time_delta_between_two_snapsots,
647 clear_database_after_flush = clear_database_after_flush,
648 )
649 dump_into_database_action_set.descend_invocation_order = solver._action_set_update_cell.descend_invocation_order + 2
650 project.add_action_set_to_timestepping(dump_into_database_action_set)
651
652
654 name,
655 coordinates,
656 project,
657 solver,
658 number_of_entries_between_two_db_flushes,
659 data_delta_between_two_snapsots,
660 time_delta_between_two_snapsots,
661 clear_database_after_flush,
662 tracer_unknowns,
663):
664 """!
665
666 I realise this as a separate routine, as we need it for all FD4 flavours
667
668 This is a wrapper around all the tracer handling. It adds the tracer to the
669 exahype2.Project, but it also instantiates the solution to tracer mapping
670 as well as the database bookkeeping.
671
672 @param tracer_unknowns: Integer
673 You can set this variable to None. In this case, all variables are
674 dumped.
675
676 """
677 number_of_attributes = (
678 (solver.unknowns + solver.auxiliary_variables)
679 if tracer_unknowns == None
680 else len(tracer_unknowns)
681 )
682 tracer_particles = project.add_tracer(
683 name=name, attribute_count=number_of_attributes
684 )
685 project.add_action_set_to_initialisation(
687 particle_set=tracer_particles, coordinates=coordinates
688 )
689 )
690 project_on_tracer_properties_kernel = ""
691 if tracer_unknowns == None:
692 project_on_tracer_properties_kernel = (
693 "::exahype2::fv::projectAllValuesOntoParticle_piecewiseLinear"
694 )
695 elif len(tracer_unknowns) == 1:
696 project_on_tracer_properties_kernel = (
697 "::exahype2::fv::projectValueOntoParticle_piecewiseLinear<{},{}>".format(
698 i, tracer_unknowns.index(i)
699 )
700 )
701 else:
702 project_on_tracer_properties_kernel = (
703 "::exahype2::fv::projectValuesOntoParticle_piecewiseLinear<{}>".format(
704 tracer_unknowns
705 )
706 .replace("[", "")
707 .replace("]", "")
708 )
709
710 tracing_action_set = exahype2.tracer.FiniteVolumesTracing(
711 tracer_particles,
712 solver,
713 project_on_tracer_properties_kernel=project_on_tracer_properties_kernel,
714 )
715 tracing_action_set.descend_invocation_order = (
716 solver._action_set_compute_final_linear_combination.descend_invocation_order + 1
717 )
718 project.add_action_set_to_timestepping(tracing_action_set)
719 project.add_action_set_to_initialisation(tracing_action_set)
720
721 dump_into_database_action_set = exahype2.tracer.DumpTracerIntoDatabase(
722 particle_set=tracer_particles,
723 solver=solver,
724 filename=name + "-" + solver._name,
725 number_of_entries_between_two_db_flushes=number_of_entries_between_two_db_flushes,
726 output_precision=10,
727 data_delta_between_two_snapsots = data_delta_between_two_snapsots,
728 time_delta_between_two_snapsots = time_delta_between_two_snapsots,
729 clear_database_after_flush = clear_database_after_flush,
730 )
731 dump_into_database_action_set.descend_invocation_order = (
732 solver._action_set_compute_final_linear_combination.descend_invocation_order + 2
733 )
734 project.add_action_set_to_timestepping(dump_into_database_action_set)
735
736
738 AbstractCCZ4Solver,
740):
741 """!
742
743 CCZ4 solver using fourth-order finite differences and global adaptive time stepping incl enclave tasking
744
745 The constructor of this classs is straightforward and realises the standard
746 steps of any numerical implementation of the CCZ4 scheme:
747
748 1. Init the actual numerical scheme. This happens through the constructor
749 of the base class.
750
751 2. Add the header files that we need, i.e. those files which contain the
752 actual CCZ4 implementation.
753
754 3. Add some constants that any CCZ4 C++ code requires.
755
756 4. Set the actual implementation, i.e. link the generic PDE terms to the
757 CCZ4-specific function calls.
758
759 5. Add the CCZ4-specific postprocessing.
760
761 6. Switch to higher-order interpolation and restriction.
762
763 """
764
766 self,
767 name,
768 patch_size,
769 rk_order,
770 min_meshcell_h,
771 max_meshcell_h,
772 use_heap_storage,
773 pde_terms_without_state,
774 second_order=False
775 ):
776 """!
777
778 Constructor
779
780 Calibrate the default time step size calibration with 1/16 to take into
781 account that we have a higher-order numerical scheme.
782
783
784 ## Attributes
785
786 use_heap_storage: Boolean
787 By default, we place the patches on the heap but administer them through
788 a smart pointer. You can switch this default and enforce a "proper"
789 storage of the data on the heap. This usually introduces more memory
790 movements, though you might end up with a better memory alignment, i.e.
791 memory closer to the compute kernels.
792
793
794 """
795 AbstractCCZ4Solver.__init__(self)
796 if (second_order):
797 AbstractCCZ4Solver.enable_second_order(self)
798 exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking.__init__(
799 self,
800 name=name,
801 patch_size=patch_size,
802 rk_order=rk_order,
803 unknowns=sum(self._FO_formulation_unknowns.values()),
804 auxiliary_variables=0,
805 min_meshcell_h=min_meshcell_h,
806 max_meshcell_h=max_meshcell_h,
808 pde_terms_without_state = pde_terms_without_state,
809 )
810
812
813 if use_heap_storage:
815 exahype2.solvers.rkfd.Storage.Heap, exahype2.solvers.rkfd.Storage.Heap
816 )
817 else:
819 exahype2.solvers.rkfd.Storage.SmartPointers,
820 exahype2.solvers.rkfd.Storage.SmartPointers,
821 )
822
824 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
825 ncp=construct_FD4_ncp(),
826 flux=exahype2.solvers.PDETerms.None_Implementation,
827 source_term=construct_FD4_source_term(),
828 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
829 eigenvalues=construct_FD4_eigenvalues(),
830 )
831
833
834 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_interpolation(
835 self, "TP_linear_with_linear_extrap_normal_interp"
836 )
837 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_restriction(
838 self, "TP_average_normal_extrap"
839 )
840
842 self,
843 name,
844 coordinates,
845 project,
846 number_of_entries_between_two_db_flushes,
847 data_delta_between_two_snapsots,
848 time_delta_between_two_snapsots,
849 clear_database_after_flush,
850 tracer_unknowns,
851 ):
852 """!
853
854 Add tracer to project
855
856 This is a delegate to add_tracer_to_FD4_solver() which passes the
857 object in as first argument.
858
859 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
860 some of the arguments. Most of them are simply piped through to this
861 class.
862
863 @param project: exahype2.Project
864
865 @param tracer_unknowns: Integer
866 You can set this variable to None. In this case, all variables are
867 dumped.
868
869 """
871 name,
872 coordinates,
873 project,
874 self,
875 number_of_entries_between_two_db_flushes,
876 data_delta_between_two_snapsots,
877 time_delta_between_two_snapsots,
878 clear_database_after_flush,
879 tracer_unknowns,
880 )
881
882
885):
886 """!
887
888 CCZ4 solver using fourth-order finite differences and global adaptive time stepping without enclave tasking
889
890 Consult CCZ4Solver_FD4_GlobalAdaptiveTimeStepWithEnclaveTasking please.
891
892 """
893
895 self,
896 name,
897 patch_size,
898 rk_order,
899 min_meshcell_h,
900 max_meshcell_h,
901 second_order=False
902 ):
903 """!
904
905 Constructor
906
907 Calibrate the default time step size calibration with 1/16 to take into
908 account that we have a higher-order numerical scheme.
909
910 """
911 AbstractCCZ4Solver.__init__(self)
912 if (second_order):
913 AbstractCCZ4Solver.enable_second_order(self)
914 exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStep.__init__(
915 self,
916 name=name,
917 patch_size=patch_size,
918 rk_order=rk_order,
919 unknowns=sum(self._FO_formulation_unknowns.values()),
920 auxiliary_variables=0,
921 min_meshcell_h=min_meshcell_h,
922 max_meshcell_h=max_meshcell_h,
924 ,
925 )
926
928
930 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
931 ncp=construct_FD4_ncp(),
932 flux=exahype2.solvers.PDETerms.None_Implementation,
933 source_term=construct_FD4_source_term(),
934 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
935 eigenvalues=construct_FD4_eigenvalues(),
936 )
937
939
940 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_interpolation(
941 self, "TP_linear_with_linear_extrap_normal_interp"
942 )
943 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_restriction(
944 self, "TP_average_normal_extrap"
945 )
946
948 self,
949 name,
950 coordinates,
951 project,
952 number_of_entries_between_two_db_flushes,
953 data_delta_between_two_snapsots,
954 time_delta_between_two_snapsots,
955 clear_database_after_flush,
956 tracer_unknowns,
957 ):
958 """!
959
960 Add tracer to project
961
962 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
963 some of the arguments. Most of them are simply piped through to this
964 class.
965
966 project: exahype2.Project
967
968 """
970 name,
971 coordinates,
972 project,
973 self,
974 number_of_entries_between_two_db_flushes,
975 data_delta_between_two_snapsots,
976 time_delta_between_two_snapsots,
977 clear_database_after_flush = clear_database_after_flush,
978 tracer_unknowns = tracer_unknowns,
979 )
980
981
983 AbstractCCZ4Solver,
985):
986 """!
987
988 Variation of classic FD4 which relies on second order PDE formulation
989
990 The traditional ExaHyPE CCZ4 formulation is the first order formulation
991 introduced by Dumbser et al. In this formulation, the second order terms
992 in CCZ4 are substituted with helper variables which represent first order
993 derivatives. While formally straightforward, keeping the whole system
994 consistent and stricly hyperbolic is a different challenge.
995
996 In this revised version, we have to evolve the primary quantities of CCZ4
997 and also the helper variables, which blows the overall system up to 59
998 equations in its simplest form. The work by Dumbser and others suggest that
999 this is a consistent and stable approach, but limited work is actually
1000 published on proper physical simulations. We therefore also implemented a
1001 second order PDE version within ExaHyPE.
1002
1003 This second order variant is not really second order from the start.
1004 Instead, we use the first order formulation, and we reconstruct the helper
1005 term via finite differences prior to the compute kernel application. That is,
1006 the compute kernels see variables representing first order derivatives, and
1007 they also evolve these guys. Afterwards, we throw away the evolved quantities
1008 and reconstruct them from the primary unknowns prior to the next time step.
1009
1010 This might not be super efficient (it would be faster to stick to the
1011 second order formulation right from the start), but it allows us to reuse
1012 the compute kernels written for the first order PDE formulation.
1013
1014 ## Data layout
1015
1016 We have now a smaller number of real unknowns, i.e. only those guys who
1017 belong to the "original" second-order formulation. The remaining quantities
1018 compared to a first-order formulation are technically material or auxiliary
1019 quantities. We model them as such, which allows ExaHyPE`s data management
1020 to deal more efficiently with them.
1021
1022
1023 reconstruction_type: "4thOrder", "centralDifferences", "leftDifference", "rightDifference"
1024
1025 """
1026
1028 self,
1029 name,
1030 patch_size,
1031 rk_order,
1032 min_meshcell_h,
1033 max_meshcell_h,
1034 reconstruction_type,
1035 use_heap_storage=False,
1036 ):
1037 """!
1038
1039 Constructor
1040
1041 Calibrate the default time step size calibration with 1/16 to take into
1042 account that we have a higher-order numerical scheme.
1043
1044
1045
1046 ## Attributes
1047
1048 use_heap_storage: Boolean
1049 By default, we place the patches on the heap but administer them through
1050 a smart pointer. You can switch this default and enforce a "proper"
1051 storage of the data on the heap. This usually introduces more memory
1052 movements, though you might end up with a better memory alignment, i.e.
1053 memory closer to the compute kernels.
1054
1055
1056 """
1057 AbstractCCZ4Solver.__init__(self)
1058 exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking.__init__(
1059 self,
1060 name=name,
1061 patch_size=patch_size,
1062 rk_order=rk_order,
1064 auxiliary_variables=sum(self._FO_formulation_unknowns.values())
1066 min_meshcell_h=min_meshcell_h,
1067 max_meshcell_h=max_meshcell_h,
1068 time_step_relaxation=AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation
1069 / 16.0,
1070 )
1071
1073
1074 if use_heap_storage:
1075 self.switch_to_heap_storage(Storage.Heap, Storage.Heap)
1076 else:
1077 self.switch_to_heap_storage(Storage.SmartPointers, Storage.SmartPointers)
1078
1080 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
1081 ncp="""
1082 double deltaQSerialised[NumberOfUnknowns*3];
1083 for (int i=0; i<NumberOfUnknowns; i++) {
1084 deltaQSerialised[i+0*NumberOfUnknowns] = 0.0;
1085 deltaQSerialised[i+1*NumberOfUnknowns] = 0.0;
1086 deltaQSerialised[i+2*NumberOfUnknowns] = 0.0;
1087
1088 deltaQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
1089 }
1090 ::applications::exahype2::ccz4::ncpSecondOrderFormulation(BTimesDeltaQ, Q, deltaQSerialised, normal%Dimensions, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
1091""",
1092 flux=exahype2.solvers.PDETerms.None_Implementation,
1093 source_term="""
1094 tarch::memset(S, 0.0, NumberOfUnknowns*sizeof(double));
1095 ::applications::exahype2::ccz4::sourceSecondOrderFormulation(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3);
1096""",
1097 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
1098 eigenvalues="""
1099 // do we only set Q
1100 return ::applications::exahype2::ccz4::maxEigenvalueSecondOrderFormulation(Q, normal%Dimensions, CCZ4e, CCZ4ds, CCZ4GLMc, CCZ4GLMd );
1101""",
1102 )
1103
1105{
1106 constexpr int itmax = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
1107 int index = 0;
1108 for (int i=0;i<itmax;i++)
1109 {
1110 applications::exahype2::ccz4::enforceCCZ4constraintsSecondOrderFormulation( newQ+index );
1111 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
1112 }
1113 }
1114"""
1115
1116 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_interpolation(
1117 self, "TP_linear_with_linear_extrap_normal_interp"
1118 )
1119 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_restriction(
1120 self, "TP_average_normal_extrap"
1121 )
1122
1124 """
1125::exahype2::CellData reconstructedPatchData(
1126 oldQWithHalo,
1127 marker.x(),
1128 marker.h(),
1129 timeStamp,
1130 timeStepSize,
1131 nullptr // targetPatch
1132);
1133::applications::exahype2::ccz4::recomputeAuxiliaryVariablesFD4_"""
1134 + reconstruction_type
1135 + """(
1136 reconstructedPatchData,
1137 {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}},
1138 3, // haloSize,
1139 {{NUMBER_OF_UNKNOWNS}},
1140 {{NUMBER_OF_AUXILIARY_VARIABLES}}
1141);
1142"""
1143 )
1144
1146 self,
1147 name,
1148 coordinates,
1149 project,
1150 number_of_entries_between_two_db_flushes,
1151 data_delta_between_two_snapsots,
1152 time_delta_between_two_snapsots,
1153 clear_database_after_flush,
1154 tracer_unknowns,
1155 ):
1156 """!
1157
1158 Add tracer to project
1159
1160 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
1161 some of the arguments. Most of them are simply piped through to this
1162 class.
1163
1164 project: exahype2.Project
1165
1166 """
1167 number_of_attributes = (
1169 if tracer_unknowns == None
1170 else len(tracer_unknowns)
1171 )
1172 tracer_particles = project.add_tracer(
1173 name=name, attribute_count=number_of_attributes
1174 )
1176 particle_set=tracer_particles, coordinates=coordinates
1177 )
1178 init_action_set.descend_invocation_order = 0
1179 project.add_action_set_to_initialisation(init_action_set)
1180
1181 project_on_tracer_properties_kernel = ""
1182 if tracer_unknowns == None:
1183 project_on_tracer_properties_kernel = (
1184 "::exahype2::fv::projectAllValuesOntoParticle_piecewiseLinear"
1185 )
1186 elif len(tracer_unknowns) == 1:
1187 project_on_tracer_properties_kernel = "::exahype2::fv::projectValueOntoParticle_piecewiseLinear<{},{}>".format(
1188 i, tracer_unknowns.index(i)
1189 )
1190 else:
1191 project_on_tracer_properties_kernel = (
1192 "::exahype2::fv::projectValuesOntoParticle_piecewiseLinear<{}>".format(
1193 tracer_unknowns
1194 )
1195 .replace("[", "")
1196 .replace("]", "")
1197 )
1198
1199 tracing_action_set = exahype2.tracer.FiniteVolumesTracing(
1200 tracer_particles,
1201 self,
1202 project_on_tracer_properties_kernel=project_on_tracer_properties_kernel,
1203 )
1204 tracing_action_set.descend_invocation_order = (
1205 self._action_set_compute_final_linear_combination.descend_invocation_order + 1
1206 )
1207 project.add_action_set_to_timestepping(tracing_action_set)
1208 project.add_action_set_to_initialisation(tracing_action_set)
1209
1210 dump_into_database_action_set = exahype2.tracer.DumpTracerIntoDatabase(
1211 particle_set=tracer_particles,
1212 solver=self,
1213 filename=name + "-" + self._name_name_name,
1214 number_of_entries_between_two_db_flushes=number_of_entries_between_two_db_flushes,
1215 output_precision=10,
1216 data_delta_between_two_snapsots = data_delta_between_two_snapsots,
1217 time_delta_between_two_snapsots = time_delta_between_two_snapsots,
1218 clear_database_after_flush = True,
1219 )
1220 dump_into_database_action_set.descend_invocation_order = (
1221 self._action_set_compute_final_linear_combination.descend_invocation_order + 2
1222 )
1223 project.add_action_set_to_timestepping(dump_into_database_action_set)
1224
1225
1227 AbstractCCZ4Solver,
1229):
1230 """!
1231
1232 CCZ4 solver using Runge-Kutta Discontinuous Galerkin and global adaptive time stepping incl enclave tasking
1233
1234 The constructor of this classs is straightforward and realises the standard
1235 steps of any numerical implementation of the CCZ4 scheme:
1236
1237 1. Init the actual numerical scheme. This happens through the constructor
1238 of the base class.
1239
1240 2. Add the header files that we need, i.e. those files which contain the
1241 actual CCZ4 implementation.
1242
1243 3. Add some constants that any CCZ4 C++ code requires.
1244
1245 4. Set the actual implementation, i.e. link the generic PDE terms to the
1246 CCZ4-specific function calls.
1247
1248 5. Add the CCZ4-specific postprocessing.
1249
1250 6. Switch to higher-order interpolation and restriction.
1251
1252 """
1253
1255 self,
1256 name,
1257 rk_order,
1258 polynomials,
1259 min_cell_h,
1260 max_cell_h,
1261 use_heap_storage=False,
1262 ):
1263 """!
1264
1265 Construct solver with enclave tasking
1266
1267
1268
1269
1270 ## Attributes
1271
1272 use_heap_storage: Boolean
1273 By default, we place the patches on the heap but administer them through
1274 a smart pointer. You can switch this default and enforce a "proper"
1275 storage of the data on the heap. This usually introduces more memory
1276 movements, though you might end up with a better memory alignment, i.e.
1277 memory closer to the compute kernels.
1278
1279
1280 """
1281 AbstractCCZ4Solver.__init__(self)
1282 exahype2.solvers.rkdg.rusanov.GlobalAdaptiveTimeStepWithEnclaveTasking.__init__(
1283 self,
1284 name=name,
1285 rk_order=rk_order,
1286 polynomials=polynomials,
1287 face_projections=exahype2.solvers.rkdg.FaceProjections.Solution,
1288 unknowns=sum(self._FO_formulation_unknowns.values()),
1289 auxiliary_variables=0,
1290 min_cell_h=min_cell_h,
1291 max_cell_h=max_cell_h,
1292 time_step_relaxation=AbstractCCZ4Solver.Default_Time_Step_Size_Relaxation,
1293 )
1294
1296
1297 if use_heap_storage:
1299 exahype2.solvers.rkdg.Storage.Heap, exahype2.solvers.rkdg.Storage.Heap
1300 )
1301 else:
1303 exahype2.solvers.rkdg.Storage.SmartPointers,
1304 exahype2.solvers.rkdg.Storage.SmartPointers,
1305 )
1306
1308 boundary_conditions=exahype2.solvers.PDETerms.Empty_Implementation,
1309 ncp="""
1310 double dQdxSerialised[NumberOfUnknowns*3];
1311 for (int i=0; i<NumberOfUnknowns; i++) {
1312 dQdxSerialised[i+0*NumberOfUnknowns] = 0.0;
1313 dQdxSerialised[i+1*NumberOfUnknowns] = 0.0;
1314 dQdxSerialised[i+2*NumberOfUnknowns] = 0.0;
1315
1316 dQdxSerialised[i+normal*NumberOfUnknowns] = dQdx[i];
1317 }
1318 ::applications::exahype2::ccz4::ncp(BgradQ, Q, dQdxSerialised, normal%Dimensions, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
1319""",
1320 flux=exahype2.solvers.PDETerms.None_Implementation,
1321 source_term="""
1322 tarch::memset(S, 0.0, NumberOfUnknowns*sizeof(double));
1323 ::applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3);
1324""",
1325 refinement_criterion=exahype2.solvers.PDETerms.Empty_Implementation,
1326 eigenvalues="""
1327 return ::applications::exahype2::ccz4::maxEigenvalue(Q, normal%Dimensions, CCZ4e, CCZ4ds, CCZ4GLMc, CCZ4GLMd );
1328""",
1329 )
1330
1332{
1333 constexpr int itmax = ({{DG_ORDER}}+1) * ({{DG_ORDER}}+1) * ({{DG_ORDER}}+1);
1334 int index = 0;
1335 for (int i=0;i<itmax;i++)
1336 {
1337 applications::exahype2::ccz4::enforceCCZ4constraints( newQ+index );
1338 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
1339 }
1340 }
1341"""
1342
1344 self,
1345 name,
1346 coordinates,
1347 project,
1348 number_of_entries_between_two_db_flushes,
1349 data_delta_between_two_snapsots,
1350 time_delta_between_two_snapsots,
1351 clear_database_after_flush,
1352 tracer_unknowns,
1353 ):
1354 """!
1355
1356 Add tracer to project
1357
1358 Consult exahype2.tracer.DumpTracerIntoDatabase for an explanation of
1359 some of the arguments. Most of them are simply piped through to this
1360 class.
1361
1362 At this point, we have not yet created the Peano 4 project. Therefore, we
1363 have not yet befilled the time stepping action set.
1364
1365 project: exahype2.Project
1366
1367 """
1368 number_of_attributes = (
1370 if tracer_unknowns == None
1371 else len(tracer_unknowns)
1372 )
1373 tracer_particles = project.add_tracer(
1374 name=name, attribute_count=number_of_attributes
1375 )
1377 particle_set=tracer_particles, coordinates=coordinates
1378 )
1379 init_action_set.descend_invocation_order = 0
1380 project.add_action_set_to_initialisation(init_action_set)
1381
1382 assert tracer_unknowns == None
1383
1385 tracer_particles,
1386 solver=self,
1387 project_on_tracer_properties_kernel="::exahype2::dg::projectAllValuesOntoParticle",
1388 )
1389 tracing_action_set.descend_invocation_order = (
1391 + 1
1392 )
1393 project.add_action_set_to_timestepping(tracing_action_set)
1394 project.add_action_set_to_initialisation(tracing_action_set)
1395
1396 dump_into_database_action_set = exahype2.tracer.DumpTracerIntoDatabase(
1397 particle_set=tracer_particles,
1398 solver=self,
1399 filename=name + "-" + self._name_name_name,
1400 number_of_entries_between_two_db_flushes = number_of_entries_between_two_db_flushes,
1401 output_precision=10,
1402 data_delta_between_two_snapsots = data_delta_between_two_snapsots,
1403 time_delta_between_two_snapsots = time_delta_between_two_snapsots,
1404 clear_database_after_flush = clear_database_after_flush,
1405 )
1406 dump_into_database_action_set.descend_invocation_order = (
1408 + 1
1409 )
1410 project.add_action_set_to_timestepping(dump_into_database_action_set)
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ our matrix elements will nabla phi_i dx f By this will be a sparse as these basis functions are chosen to not overlap with each other almost everywhere In other they have only local support We can read off the right hand side values
Abstract base class for any CCZ4 solver.
Definition CCZ4Solver.py:8
__init__(self)
Constructor.
_add_standard_includes(self)
Add the headers for the compute kernels and initial condition implementations.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns=None)
Add tracer to project.
add_all_solver_constants(self)
Add domain-specific constants.
add_makefile_parameters(self, peano4_project, path_of_ccz4_application)
Add include path and minimal required cpp files to makefile.
CCZ4 solver using fourth-order finite differences and global adaptive time stepping incl enclave task...
__init__(self, name, patch_size, rk_order, min_meshcell_h, max_meshcell_h, use_heap_storage, pde_terms_without_state, second_order=False)
Constructor.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
CCZ4 solver using fourth-order finite differences and global adaptive time stepping without enclave t...
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
__init__(self, name, patch_size, rk_order, min_meshcell_h, max_meshcell_h, second_order=False)
Constructor.
Variation of classic FD4 which relies on second order PDE formulation.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
__init__(self, name, patch_size, rk_order, min_meshcell_h, max_meshcell_h, reconstruction_type, use_heap_storage=False)
Constructor.
CCZ4 solver using finite volumes and global adaptive time stepping incl enclave tasking.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
__init__(self, name, patch_size, min_volume_h, max_volume_h, use_heap_storage, pde_terms_without_state)
Construct solver with enclave tasking and adaptive time stepping.
CCZ4 solver using finite volumes and global adaptive time stepping incl enclave tasking.
__init__(self, name, patch_size, min_volume_h, max_volume_h, use_heap_storage, pde_terms_without_state)
Constructor.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
CCZ4 solver using Runge-Kutta Discontinuous Galerkin and global adaptive time stepping incl enclave t...
__init__(self, name, rk_order, polynomials, min_cell_h, max_cell_h, use_heap_storage=False)
Construct solver with enclave tasking.
add_tracer(self, name, coordinates, project, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
set_implementation(self, boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
postprocess_updated_patch(self)
Definition FV.py:1502
switch_to_heap_storage(self, Storage cell_data_storage, Storage face_data_storage)
By default, we hold all data on the call stacks.
Definition FV.py:1611
postprocess_updated_patch(self, kernel)
Define a postprocessing routine over the data.
Definition FV.py:1507
set_implementation(self, boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, memory_location=None, use_split_loop=False, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, memory_location=None, use_split_loop=False, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
postprocess_updated_cell_after_final_linear_combination(self, kernel)
Define a postprocessing routine over the data.
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, point_source=None, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
switch_to_heap_storage(self, Storage cell_data_storage, Storage face_data_storage)
By default, we hold all data on the call stacks.
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, point_source=None, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
switch_to_heap_storage(self, Storage cell_data_storage, Storage face_data_storage)
By default, we hold all data on the call stacks.
preprocess_reconstructed_patch(self, kernel)
Please consult exahype2.solvers.fv.FV.preprocess_reconstructed_patch() for a documentation on this ro...
set_implementation(self, flux, ncp, source_term, eigenvalues, boundary_conditions, refinement_criterion, initial_conditions, memory_location, additional_action_set_includes, additional_user_includes)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
set_implementation(self, flux=None, ncp=None, source_term=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, memory_location=None, additional_action_set_includes="", additional_user_includes="", KOSigma=None)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
set_implementation(self, flux=None, ncp=None, source_term=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, memory_location=None, additional_action_set_includes="", additional_user_includes="", KOSigma=None)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
Particle tracing over the Finite Volumes solver.
construct_FD4_ncp()
add_tracer_to_FV_solver(name, coordinates, project, solver, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
Add tracer to project.
construct_FV_source_term()
construct_FV_eigenvalues()
add_tracer_to_FD4_solver(name, coordinates, project, solver, number_of_entries_between_two_db_flushes, data_delta_between_two_snapsots, time_delta_between_two_snapsots, clear_database_after_flush, tracer_unknowns)
I realise this as a separate routine, as we need it for all FD4 flavours.
construct_FD4_postprocessing_kernel()
construct_FD4_source_term()
construct_FV_postprocessing_kernel()
construct_FD4_eigenvalues()