Custom warp disc simulation#

This simple example shows how to run a simulation of a disc with a custom initial warp

 9 import numpy as np
10
11 import shamrock
12
13 # If we use the shamrock executable to run this script instead of the python interpreter,
14 # we should not initialize the system as the shamrock executable needs to handle specific MPI logic
15 if not shamrock.sys.is_initialized():
16     shamrock.change_loglevel(1)
17     shamrock.sys.init("0:0")

Setup units

23 si = shamrock.UnitSystem()
24 sicte = shamrock.Constants(si)
25 codeu = shamrock.UnitSystem(
26     unit_time=3600 * 24 * 365,
27     unit_length=sicte.au(),
28     unit_mass=sicte.sol_mass(),
29 )
30 ucte = shamrock.Constants(codeu)
31 G = ucte.G()

List parameters

 37 # Resolution
 38 Npart = 1000000
 39
 40 # Sink parameters
 41 center_mass = 1.0
 42 center_racc = 0.1
 43
 44 # Disc parameter
 45 disc_mass = 0.01  # sol mass
 46 rout = 60.0  # au
 47 rin = 1.0  # au
 48 H_r_0 = 0.05
 49 q = 0.5
 50 p = 3.0 / 2.0
 51 r0 = 1.0
 52
 53 # Viscosity parameter
 54 alpha_AV = 1.0e-3 / 0.08
 55 alpha_u = 1.0
 56 beta_AV = 2.0
 57
 58 # Integrator parameters
 59 C_cour = 0.3
 60 C_force = 0.25
 61
 62 # Warp parameters
 63 inclination = 30.0
 64
 65
 66 # Disc profiles
 67 def sigma_profile(r):
 68     sigma_0 = 1.0  # We do not care as it will be renormalized
 69     return sigma_0 * (r / r0) ** (-p)
 70
 71
 72 def kep_profile(r):
 73     return (G * center_mass / r) ** 0.5
 74
 75
 76 def omega_k(r):
 77     return kep_profile(r) / r
 78
 79
 80 def cs_profile(r):
 81     cs_in = (H_r_0 * r0) * omega_k(r0)
 82     return ((r / r0) ** (-q)) * cs_in
 83
 84
 85 def inc_profile(r):  # profile of the inclination angle
 86     if r < 10.0:
 87         effective_inc = 0.0
 88     elif r < 30.0 and r > 10:
 89         lx = 0.1 * (1.0 + np.sin((r - 20) * np.pi / 20.0))
 90         lz = np.sqrt(1 - lx * lx)
 91         effective_inc = np.arccos(lz)
 92
 93     else:
 94         lx = 0.2
 95         lz = np.sqrt(1 - lx * lx)
 96         effective_inc = np.arccos(lz)
 97
 98     return effective_inc
 99
100
101 def psi_profile(r):
102     return 0.0
103
104
105 def k_profile(r):  # profile of the warp direction
106     incl_rad = inc_profile(r) * np.pi / 180.0
107     return (0.0, np.cos(incl_rad), np.sin(incl_rad))

Utility functions and quantities deduced from the base one

113 # Deduced quantities
114 pmass = disc_mass / Npart
115 bmin = (-rout * 2, -rout * 2, -rout * 2)
116 bmax = (rout * 2, rout * 2, rout * 2)
117
118 cs0 = cs_profile(r0)
119
120
121 def rot_profile(r):
122     return ((kep_profile(r) ** 2) - (2 * p + q) * cs_profile(r) ** 2) ** 0.5
123
124
125 def H_profile(r):
126     H = cs_profile(r) / omega_k(r)
127     # fact = (2.**0.5) * 3. # factor taken from phantom, to fasten thermalizing
128     fact = 1.0
129     return fact * H

Start the context The context holds the data of the code We then init the layout of the field (e.g. the list of fields used by the solver)

Attach a SPH model to the data and configure it

143 model = shamrock.get_Model_SPH(context=ctx, vector_type="f64_3", sph_kernel="M4")
144
145 # Generate the default config
146 cfg = model.gen_default_config()
147 # Use disc alpha model viscosity
148 cfg.set_artif_viscosity_ConstantDisc(alpha_u=alpha_u, alpha_AV=alpha_AV, beta_AV=beta_AV)
149 # use the Lodato Price 2007 equation of state
150 cfg.set_eos_locally_isothermalLP07(cs0=cs0, q=q, r0=r0)
151 # Use the given code units
152 cfg.set_units(codeu)
153 # Change particle mass
154 cfg.set_particle_mass(pmass)
155 # Set the CFL
156 cfg.set_cfl_cour(C_cour)
157 cfg.set_cfl_force(C_force)
158
159 # Set the solver config to be the one stored in cfg
160 model.set_solver_config(cfg)
161
162 # Print the solver config
163 model.get_current_config().print_status()
164
165 # We want the patches to split above 10^8 part and merge if smaller than 1 part (e.g. disable patch)
166 model.init_scheduler(int(1e8), 1)
167
168 # Set the simulation box size
169 model.resize_simulation_box(bmin, bmax)
----- SPH Solver configuration -----
[
    {
        "artif_viscosity": {
            "alpha_AV": 0.0125,
            "alpha_u": 1.0,
            "av_type": "constant_disc",
            "beta_AV": 2.0
        },
        "boundary_config": {
            "bc_type": "free"
        },
        "cfl_config": {
            "cfl_cour": 0.3,
            "cfl_force": 0.25,
            "cfl_multiplier_stiffness": 2.0,
            "eta_sink": 0.05
        },
        "combined_dtdiv_divcurlv_compute": false,
        "debug_dump_filename": "",
        "do_debug_dump": false,
        "enable_particle_reordering": false,
        "eos_config": {
            "Tvec": "f64_3",
            "cs0": 0.31394308776061347,
            "eos_type": "locally_isothermal_lp07",
            "q": 0.5,
            "r0": 1.0
        },
        "epsilon_h": 1e-06,
        "ext_force_config": {
            "force_list": []
        },
        "gpart_mass": 1e-08,
        "h_iter_per_subcycles": 50,
        "h_max_subcycles_count": 100,
        "htol_up_coarse_cycle": 1.1,
        "htol_up_fine_cycle": 1.1,
        "kernel_id": "M4<f64>",
        "mhd_config": {
            "mhd_type": "none"
        },
        "particle_killing": [],
        "particle_reordering_step_freq": 1000,
        "save_dt_to_fields": false,
        "self_grav_config": {
            "softening_length": 1e-09,
            "softening_mode": "plummer",
            "type": "none"
        },
        "show_ghost_zone_graph": false,
        "show_neigh_stats": false,
        "smoothing_length_config": {
            "type": "density_based"
        },
        "time_state": {
            "cfl_multiplier": 0.01,
            "dt_sph": 0.0,
            "time": 0.0
        },
        "tree_reduction_level": 3,
        "type_id": "sycl::vec<f64,3>",
        "unit_sys": {
            "unit_current": 1.0,
            "unit_length": 149597870700.0,
            "unit_lumint": 1.0,
            "unit_mass": 1.98847e+30,
            "unit_qte": 1.0,
            "unit_temperature": 1.0,
            "unit_time": 31536000.0
        },
        "use_two_stage_search": true
    }
]
------------------------------------

Add the sink particle

174 # null position and velocity
175 model.add_sink(center_mass, (0, 0, 0), (0, 0, 0), center_racc)

Create the setup

180 setup = model.get_setup()
181 gen_disc = setup.make_generator_disc_mc(
182     part_mass=pmass,
183     disc_mass=disc_mass,
184     r_in=rin,
185     r_out=rout,
186     sigma_profile=sigma_profile,
187     H_profile=H_profile,
188     rot_profile=rot_profile,
189     cs_profile=cs_profile,
190     random_seed=666,
191 )
192
193 # apply the custom warp
194 warp = setup.make_modifier_custom_warp(
195     parent=gen_disc,
196     inc_profile=inc_profile,
197     psi_profile=psi_profile,
198     k_profile=k_profile,
199 )
200 # Print the dot graph of the setup
201 print(warp.get_dot())
digraph G {
rankdir=LR;
node_0 [label="GeneratorMCDisc"];
node_1 [label="ApplyCustomWarp"];
node_0 -> node_1;
node_3 [label="Simulation"];
node_1 -> node_3;
}

Apply the setup

SPH setup: generating particles ...
SPH setup: Nstep = 1000000 ( 1.0e+06 ) Ntotal = 1000000 ( 1.0e+06 ) rate = 1.650961e+05 N.s^-1
SPH setup: the generation step took : 6.141172809 s
SPH setup: final particle count = 1000000 begining injection ...
Info: ---------------------------------------------                   [DataInserterUtility][rank=0]
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 25.81 us   (41.0%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.36 us    (0.4%)
   patch tree reduce : 10.62 us   (1.6%)
   gen split merge   : 972.00 ns  (0.2%)
   split / merge op  : 0/0
   apply split merge : 951.00 ns  (0.1%)
   LB compute        : 612.65 us  (94.9%)
   LB move op cnt    : 0
   LB apply          : 14.05 us   (2.2%)
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.85 us    (64.3%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1333.00 ns (0.3%)
   patch tree reduce : 501.00 ns  (0.1%)
   gen split merge   : 391.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 331.00 ns  (0.1%)
   LB compute        : 389.52 us  (98.1%)
   LB move op cnt    : 0
   LB apply          : 1924.00 ns (0.5%)
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.46 us    (62.6%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1283.00 ns (0.3%)
   patch tree reduce : 481.00 ns  (0.1%)
   gen split merge   : 411.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 331.00 ns  (0.1%)
   LB compute        : 393.50 us  (98.1%)
   LB move op cnt    : 0
   LB apply          : 2.05 us    (0.5%)
Info: ---------------------------------------------                   [DataInserterUtility][rank=0]
SPH setup: injected      1000000 / 1000000 => 100.0% | ranks with patchs = 1 / 1  <- global loop ->
SPH setup: the injection step took : 0.11020441600000001 s
Info: injection perf report:                                                    [SPH setup][rank=0]
+======+====================+=======+=============+=============+=============+
| rank | rank get (sum/max) |  MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+====================+=======+=============+=============+=============+
| 0    |      0.00s / 0.00s | 0.00s |   0.2% 0.0% |   935.14 MB |     5.04 MB |
+------+--------------------+-------+-------------+-------------+-------------+
SPH setup: the setup took : 6.44088288 s

Run a single step to init the integrator and smoothing length of the particles Here the htolerance is the maximum factor of evolution of the smoothing length in each Smoothing length iterations, increasing it affect the performance negatively but increse the convergence rate of the smoothing length this is why we increase it temporely to 1.3 before lowering it back to 1.1 (default value) Note that both change_htolerance can be removed and it will work the same but would converge more slowly at the first timestep

Warning: .change_htolerance(val) is deprecated,                                       [SPH][rank=0]
    -> calling this is replaced internally by .change_htolerances(coarse=val, fine=min(val, 1.1))
    see: https://shamrock-code.github.io/Shamrock/mkdocs/models/sph/smoothing_length_tolerance
---------------- t = 0, dt = 0 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 38.18 us   (3.0%)
   patch tree reduce : 8.44 us    (0.7%)
   gen split merge   : 951.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 1062.00 ns (0.1%)
   LB compute        : 1174.29 us (91.4%)
   LB move op cnt    : 0
   LB apply          : 13.27 us   (1.0%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.79 us    (68.3%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.8074540479960924 unconverged cnt = 1000000
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 1.0496902623949202 unconverged cnt = 1000000
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 1.3645973411133965 unconverged cnt = 1000000
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 1.7739765434474155 unconverged cnt = 999999
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 2.3061695064816403 unconverged cnt = 999999
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 2.9980203584261327 unconverged cnt = 999994
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 3.8974264659539726 unconverged cnt = 999986
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.066654405740165 unconverged cnt = 999965
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 999894
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 999617
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 996421
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 952609
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 724147
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 135019
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 5.444654479445718 unconverged cnt = 726
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3934716120709564e-05,-1.783643673409164e-05,-5.99570339587367e-07)
    sum a = (9.75781955236954e-19,-2.1006417091906648e-19,1.4981895254560437e-20)
    sum e = 0.013536246821452656
    sum de = -9.191630966689244e-21
Info: CFL hydro = 7.19642848135117e-05 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 7.19642848135117e-05 cfl multiplier : 0.01                      [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 2.9175e+04 | 1000000 |      1 | 3.428e+01 | 0.0% |   0.1% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0 (tsim/hr)                                             [sph::Model][rank=0]
Warning: .change_htolerance(val) is deprecated,                                       [SPH][rank=0]
    -> calling this is replaced internally by .change_htolerances(coarse=val, fine=min(val, 1.1))
    see: https://shamrock-code.github.io/Shamrock/mkdocs/models/sph/smoothing_length_tolerance

Manipulating the simulation#

Dump files (path relative to where you have started shamrock)

225 dump_folder = "_to_trash"
226 import os
227
228 os.system("mkdir -p " + dump_folder)
229
230 # VTK dump
231 model.do_vtk_dump(dump_folder + "/init_disc.vtk", True)
232
233 # Shamrock restart dump files
234 model.dump(dump_folder + "/init_disc.sham")
235
236 # Phantom dump
237 dump = model.make_phantom_dump()
238 dump.save_dump(dump_folder + "/init_disc.phdump")
Info: dump to _to_trash/init_disc.vtk                                            [VTK Dump][rank=0]
              - took 203.56 ms, bandwidth = 262.36 MB/s
Info: Dumping state to _to_trash/init_disc.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 16.36 us   (31.3%)
Info: dump to _to_trash/init_disc.sham                                      [Shamrock Dump][rank=0]
              - took 282.63 ms, bandwidth = 404.93 MB/s

Single timestep

---------------- t = 0, dt = 7.19642848135117e-05 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 23.91 us   (2.1%)
   patch tree reduce : 4.30 us    (0.4%)
   gen split merge   : 701.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 901.00 ns  (0.1%)
   LB compute        : 1080.87 us (94.0%)
   LB move op cnt    : 0
   LB apply          : 13.37 us   (1.2%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.98 us    (69.6%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3936202893870782e-05,-1.7835748317164945e-05,-5.995819807005616e-07)
    sum a = (-1.0503208545953324e-18,3.8963515573697816e-19,-2.2764010457459322e-20)
    sum e = 0.013536247045198277
    sum de = 4.642963559225332e-08
Info: CFL hydro = 0.002446943400379064 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.002446943400379064 cfl multiplier : 0.34                      [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.5058e+05 | 1000000 |      1 | 6.641e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.03901087524048951 (tsim/hr)                           [sph::Model][rank=0]
Info: iteration since start : 2                                                       [SPH][rank=0]
Info: time since start : 1782.1948799590002 (s)                                       [SPH][rank=0]

Evolve until a given time (code units)

246 model.evolve_until(0.001)
---------------- t = 7.19642848135117e-05, dt = 0.0009280357151864883 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 20.90 us   (1.7%)
   patch tree reduce : 4.05 us    (0.3%)
   gen split merge   : 691.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 962.00 ns  (0.1%)
   LB compute        : 1174.49 us (95.6%)
   LB move op cnt    : 0
   LB apply          : 13.93 us   (1.1%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 3.13 us    (69.6%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3953886521147126e-05,-1.782755347672335e-05,-5.997204608818661e-07)
    sum a = (1.6263032587282567e-18,5.014435047745458e-19,2.5358048858425616e-20)
    sum e = 0.013536284075170503
    sum de = 6.449358070268862e-07
Info: CFL hydro = 0.004033698305238819 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.004033698305238819 cfl multiplier : 0.56                      [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.4516e+05 | 1000000 |      1 | 6.889e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.48495666079322064 (tsim/hr)                           [sph::Model][rank=0]
Info: iteration since start : 3                                                       [SPH][rank=0]
Info: time since start : 1789.5932516940002 (s)                                       [SPH][rank=0]

True

Get the sinks positions

250 print(model.get_sinks())
[{'pos': (-2.065717359730298e-11, -9.571674293603349e-12, 1.6176240765935853e-13), 'velocity': (-4.1279143632583235e-08, -1.9215685349906975e-08, 3.2352509313430425e-10), 'sph_acceleration': (-4.123851286200948e-05, -1.9299173641009363e-05, 3.2352541355366475e-07), 'ext_acceleration': (0.0, 0.0, 0.0), 'mass': 1.0, 'angular_momentum': (0.0, 0.0, 0.0), 'accretion_radius': 0.1}]

Get the fields as python dictionary of numpy arrays

Warning

Do not do this on a large distributed simulation as this gather all data on MPI rank 0 and will use a lot of memory (and crash if the simulation is too large)

260 print(ctx.collect_data())
Info: collected : 1 patches                                                [PatchScheduler][rank=0]
{'xyz': array([[-46.18081976, -38.71910747,  -1.18240629],
       [-45.84934467, -36.35079718,  -1.0951954 ],
       [-45.90089759, -30.16149923,  -0.51797479],
       ...,
       [ 34.5319474 ,  48.88261936,   0.55061546],
       [ 34.58505746,  49.21023716,   0.84423995],
       [ 49.91803248,  33.88748886,   1.99642314]], shape=(1000000, 3)), 'vxyz': array([[ 0.51838326, -0.61505401, -0.10576831],
       [ 0.50908461, -0.63898036, -0.10386844],
       [ 0.46471919, -0.70559895, -0.09480775],
       ...,
       [-0.65422734,  0.46066018,  0.13350951],
       [-0.65420858,  0.45749044,  0.13350634],
       [-0.45598511,  0.66621004,  0.09302728]], shape=(1000000, 3)), 'axyz': array([[ 0.00788434,  0.00659499, -0.00063158],
       [ 0.00894982,  0.00722448, -0.00078459],
       [ 0.01078347,  0.00750194, -0.00128493],
       ...,
       [-0.00588592, -0.00841436,  0.00135547],
       [-0.00558256, -0.0077336 ,  0.00172636],
       [-0.00863666, -0.00596705,  0.00034757]], shape=(1000000, 3)), 'axyz_ext': array([[ 0.00831349,  0.00697023,  0.00021286],
       [ 0.00901889,  0.00715046,  0.00021543],
       [ 0.0109206 ,  0.00717593,  0.00012324],
       ...,
       [-0.00634959, -0.00898833, -0.00010124],
       [-0.00626412, -0.00891306, -0.00015291],
       [-0.00894589, -0.00607303, -0.00035778]], shape=(1000000, 3)), 'hpart': array([3.46067577, 3.174374  , 2.93403838, ..., 1.75076501, 1.97237561,
       4.40070917], shape=(1000000,)), 'uint': array([1.85772131e-09, 1.42328086e-09, 4.20630317e-10, ...,
       4.39544051e-09, 3.77948668e-09, 8.78998943e-11], shape=(1000000,)), 'duint': array([1.85809089e-06, 1.42386071e-06, 4.21118893e-07, ...,
       4.39469850e-06, 3.77840063e-06, 8.83487962e-08], shape=(1000000,))}

Performing a timestep loop

264 dt_stop = 0.001
265 for i in range(10):
266     t_target = i * dt_stop
267     # skip if the model is already past the target
268     if model.get_time() > t_target:
269         continue
270
271     model.evolve_until(i * dt_stop)
272
273     # Dump name is "dump_xxxx.sham" where xxxx is the timestep
274     model.dump(dump_folder + f"/dump_{i:04}.sham")
Info: iteration since start : 3                                                       [SPH][rank=0]
Info: time since start : 1791.5882544840001 (s)                                       [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0001.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 17.36 us   (43.8%)
Info: dump to _to_trash/dump_0001.sham                                      [Shamrock Dump][rank=0]
              - took 281.76 ms, bandwidth = 406.18 MB/s
---------------- t = 0.001, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.60 us    (1.0%)
   patch tree reduce : 4.88 us    (0.7%)
   gen split merge   : 592.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 922.00 ns  (0.1%)
   LB compute        : 660.55 us  (95.2%)
   LB move op cnt    : 0
   LB apply          : 14.01 us   (2.0%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 3.25 us    (71.5%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955335377140286e-05,-1.782678714727204e-05,-5.997321022941195e-07)
    sum a = (-7.318364664277155e-19,-1.4907779871675686e-19,-3.4040136567782195e-20)
    sum e = 0.013536290988573483
    sum de = 1.290332769278871e-06
Info: CFL hydro = 0.005094995112141007 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.005094995112141007 cfl multiplier : 0.7066666666666667        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.4972e+05 | 1000000 |      1 | 6.679e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5389874087479326 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 4                                                       [SPH][rank=0]
Info: time since start : 1798.6113441470002 (s)                                       [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0002.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.54 us    (57.0%)
Info: dump to _to_trash/dump_0002.sham                                      [Shamrock Dump][rank=0]
              - took 106.38 ms, bandwidth = 1.05 GB/s
---------------- t = 0.002, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.94 us    (1.5%)
   patch tree reduce : 1993.00 ns (0.4%)
   gen split merge   : 762.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 942.00 ns  (0.2%)
   LB compute        : 498.88 us  (95.7%)
   LB move op cnt    : 0
   LB apply          : 4.08 us    (0.8%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.65 us    (66.8%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955294406859166e-05,-1.7826703866802762e-05,-5.99732102066244e-07)
    sum a = (3.7947076036992655e-19,6.030874584450618e-19,-5.2304284492953046e-20)
    sum e = 0.013536292598328123
    sum de = 1.936254421522067e-06
Info: CFL hydro = 0.005805736233858829 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.005805736233858829 cfl multiplier : 0.8044444444444444        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6316e+05 | 1000000 |      1 | 6.129e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5873601103738665 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 5                                                       [SPH][rank=0]
Info: time since start : 1804.856704926 (s)                                           [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0003.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.63 us    (57.2%)
Info: dump to _to_trash/dump_0003.sham                                      [Shamrock Dump][rank=0]
              - took 106.14 ms, bandwidth = 1.05 GB/s
---------------- t = 0.003, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.05 us    (1.3%)
   patch tree reduce : 2.19 us    (0.4%)
   gen split merge   : 741.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 1022.00 ns (0.2%)
   LB compute        : 539.51 us  (96.2%)
   LB move op cnt    : 0
   LB apply          : 4.17 us    (0.7%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.88 us    (70.7%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955253086524537e-05,-1.7826620802866655e-05,-5.997321012681458e-07)
    sum a = (6.844026213814747e-19,5.183841637196318e-19,-2.5887444450459554e-20)
    sum e = 0.013536294854504872
    sum de = 2.5826357305463454e-06
Info: CFL hydro = 0.006282696726571656 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.006282696726571656 cfl multiplier : 0.8696296296296296        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6360e+05 | 1000000 |      1 | 6.113e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5889541862249735 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 6                                                       [SPH][rank=0]
Info: time since start : 1811.0857618520001 (s)                                       [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0004.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.10 us    (54.8%)
Info: dump to _to_trash/dump_0004.sham                                      [Shamrock Dump][rank=0]
              - took 106.31 ms, bandwidth = 1.05 GB/s
---------------- t = 0.004, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.80 us    (1.4%)
   patch tree reduce : 2.08 us    (0.4%)
   gen split merge   : 721.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 952.00 ns  (0.2%)
   LB compute        : 548.38 us  (96.0%)
   LB move op cnt    : 0
   LB apply          : 5.12 us    (0.9%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.85 us    (73.8%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955211417328168e-05,-1.782653795697574e-05,-5.99732099897743e-07)
    sum a = (-6.098637220230962e-20,6.606856988583543e-19,-2.498747194400186e-20)
    sum e = 0.013536297757443975
    sum de = 3.229462088917327e-06
Info: CFL hydro = 0.006603774399651343 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.006603774399651343 cfl multiplier : 0.9130864197530864        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6335e+05 | 1000000 |      1 | 6.122e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.588046128614067 (tsim/hr)                             [sph::Model][rank=0]
Info: iteration since start : 7                                                       [SPH][rank=0]
Info: time since start : 1817.324262325 (s)                                           [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0005.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.28 us    (55.1%)
Info: dump to _to_trash/dump_0005.sham                                      [Shamrock Dump][rank=0]
              - took 103.26 ms, bandwidth = 1.08 GB/s
---------------- t = 0.005, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.22 us    (1.5%)
   patch tree reduce : 2.04 us    (0.4%)
   gen split merge   : 1052.00 ns (0.2%)
   split / merge op  : 0/0
   apply split merge : 1002.00 ns (0.2%)
   LB compute        : 463.05 us  (95.4%)
   LB move op cnt    : 0
   LB apply          : 4.86 us    (1.0%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.82 us    (75.2%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955169400456806e-05,-1.7826455330635906e-05,-5.997320979530626e-07)
    sum a = (1.4840017235895342e-18,-1.7245590806097555e-18,-6.3527471044072525e-21)
    sum e = 0.013536301307567025
    sum de = 3.8767192324104645e-06
Info: CFL hydro = 0.006820935762349557 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.006820935762349557 cfl multiplier : 0.9420576131687243        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6396e+05 | 1000000 |      1 | 6.099e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.590270329782282 (tsim/hr)                             [sph::Model][rank=0]
Info: iteration since start : 8                                                       [SPH][rank=0]
Info: time since start : 1823.536024895 (s)                                           [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0006.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.54 us    (53.6%)
Info: dump to _to_trash/dump_0006.sham                                      [Shamrock Dump][rank=0]
              - took 103.72 ms, bandwidth = 1.08 GB/s
---------------- t = 0.006, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 8.13 us    (0.7%)
   patch tree reduce : 1964.00 ns (0.2%)
   gen split merge   : 751.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 1032.00 ns (0.1%)
   LB compute        : 1193.05 us (98.1%)
   LB move op cnt    : 0
   LB apply          : 4.10 us    (0.3%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.56 us    (72.1%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955127037116262e-05,-1.7826372925354343e-05,-5.997320954332403e-07)
    sum a = (-9.283481101907132e-19,-8.300922883092143e-19,6.352747104407253e-20)
    sum e = 0.013536305505279473
    sum de = 4.5243930011736135e-06
Info: CFL hydro = 0.006968850096436335 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.006968850096436335 cfl multiplier : 0.9613717421124829        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6333e+05 | 1000000 |      1 | 6.122e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5879974767127083 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 9                                                       [SPH][rank=0]
Info: time since start : 1829.7728743070002 (s)                                       [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0007.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.63 us    (43.5%)
Info: dump to _to_trash/dump_0007.sham                                      [Shamrock Dump][rank=0]
              - took 104.13 ms, bandwidth = 1.07 GB/s
---------------- t = 0.007, dt = 0.001 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.71 us    (1.3%)
   patch tree reduce : 2.25 us    (0.4%)
   gen split merge   : 741.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 1022.00 ns (0.2%)
   LB compute        : 552.68 us  (96.1%)
   LB move op cnt    : 0
   LB apply          : 3.76 us    (0.7%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.85 us    (68.9%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955084328508651e-05,-1.782629074263273e-05,-5.997320923379383e-07)
    sum a = (-2.507217523872729e-19,-1.0062751413381088e-18,-1.4717197458543468e-20)
    sum e = 0.013536310350978223
    sum de = 5.172469677358374e-06
Info: CFL hydro = 0.00707064604710029 sink sink = inf                                 [SPH][rank=0]
Info: cfl dt = 0.00707064604710029 cfl multiplier : 0.9742478280749886         [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6374e+05 | 1000000 |      1 | 6.107e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5894497602854941 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 10                                                      [SPH][rank=0]
Info: time since start : 1835.994134187 (s)                                           [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0008.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.19 us    (54.6%)
Info: dump to _to_trash/dump_0008.sham                                      [Shamrock Dump][rank=0]
              - took 102.76 ms, bandwidth = 1.09 GB/s
---------------- t = 0.008, dt = 0.0010000000000000009 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 1000000 min = 1000000                      [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 1000000 min = 1000000                 [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 1000000
    max = 1000000
    avg = 1000000
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 7.48 us    (1.6%)
   patch tree reduce : 2.10 us    (0.4%)
   gen split merge   : 732.00 ns  (0.2%)
   split / merge op  : 0/0
   apply split merge : 1012.00 ns (0.2%)
   LB compute        : 451.41 us  (95.4%)
   LB move op cnt    : 0
   LB apply          : 4.38 us    (0.9%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.54 us    (71.1%)
Info: free boundaries skipping geometry update                            [PositionUpdated][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (1.3955041275850652e-05,-1.782620878395727e-05,-5.997320886657341e-07)
    sum a = (-1.6195269951502222e-18,3.1170812458958252e-19,-6.723324018831009e-21)
    sum e = 0.013536315845049659
    sum de = 5.820935866955104e-06
Info: CFL hydro = 0.007141788731708891 sink sink = inf                                [SPH][rank=0]
Info: cfl dt = 0.007141788731708891 cfl multiplier : 0.9828318853833258        [sph::Model][rank=0]
Info: Timestep perf report:                                                    [sph::Model][rank=0]
+======+============+=========+========+===========+======+=============+=============+=============+
| rank | rate (N/s) |  Nobj   | Npatch |   tstep   | MPI  | alloc d% h% | mem (max) d | mem (max) h |
+======+============+=========+========+===========+======+=============+=============+=============+
| 0    | 1.6382e+05 | 1000000 |      1 | 6.104e+00 | 0.0% |   0.0% 0.0% |     1.01 GB |     5.04 MB |
+------+------------+---------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0.5897543870332764 (tsim/hr)                            [sph::Model][rank=0]
Info: iteration since start : 11                                                      [SPH][rank=0]
Info: time since start : 1842.210399886 (s)                                           [SPH][rank=0]
Info: Dumping state to _to_trash/dump_0009.sham                                       [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 6.60 us    (56.4%)
Info: dump to _to_trash/dump_0009.sham                                      [Shamrock Dump][rank=0]
              - took 104.52 ms, bandwidth = 1.07 GB/s

Plot column integrated density

278 import matplotlib.pyplot as plt
279
280 pixel_x = 1200
281 pixel_y = 1080
282 radius = 30
283 center = (0.0, 0.0, 0.0)
284
285 aspect = pixel_x / pixel_y
286 pic_range = [-radius * aspect, radius * aspect, -radius, radius]
287 delta_x = (radius * 2 * aspect, 0.0, 0.0)
288 delta_y = (0.0, 0.0, radius * 2)
289
290 arr_rho = model.render_cartesian_column_integ(
291     "rho", "f64", center=(0.0, 0.0, 0.0), delta_x=delta_x, delta_y=delta_y, nx=pixel_x, ny=pixel_y
292 )
293
294 import copy
295
296 import matplotlib
297
298 my_cmap = copy.copy(matplotlib.colormaps.get_cmap("gist_heat"))  # copy the default cmap
299 my_cmap.set_bad(color="black")
300
301 fig_width = 6
302 fig_height = fig_width / aspect
303 plt.figure(figsize=(fig_width, fig_height))
304 res = plt.imshow(arr_rho, cmap=my_cmap, origin="lower", extent=pic_range, norm="log", vmin=1e-9)
305
306 cbar = plt.colorbar(res, extend="both")
307 cbar.set_label(r"$\int \rho \, \mathrm{d} z$ [code unit]")
308 # or r"$\rho$ [code unit]" for slices
309
310 plt.title("t = {:0.3f} [code unit]".format(model.get_time()))
311 plt.xlabel("x")
312 plt.ylabel("z")
313 plt.show()
t = 0.009 [code unit]
Info: compute_column_integ field_name: rho, rays count: 1296000      [sph::CartesianRender][rank=0]
Info: compute_column_integ took 32.91 s                              [sph::CartesianRender][rank=0]

Total running time of the script: (2 minutes 27.697 seconds)

Estimated memory usage: 720 MB

Gallery generated by Sphinx-Gallery