Init a simulation from an upscaled simulation#

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

Setup parameters

19 gamma = 5.0 / 3.0
20 rho_g = 1
21
22 bmin = (-0.6, -0.6, -0.6)
23 bmax = (0.6, 0.6, 0.6)
24
25 N_target = 1e4
26 scheduler_split_val = int(2e7)
27 scheduler_merge_val = int(1)

Deduced quantities

31 import numpy as np
32
33 xm, ym, zm = bmin
34 xM, yM, zM = bmax
35 vol_b = (xM - xm) * (yM - ym) * (zM - zm)
36
37 part_vol = vol_b / N_target
38
39 # lattice volume
40 HCP_PACKING_DENSITY = 0.74
41 part_vol_lattice = HCP_PACKING_DENSITY * part_vol
42
43 dr = (part_vol_lattice / ((4.0 / 3.0) * np.pi)) ** (1.0 / 3.0)
44
45 pmass = -1

Setup

50 ctx = shamrock.Context()
51 ctx.pdata_layout_new()
52
53 model = shamrock.get_Model_SPH(context=ctx, vector_type="f64_3", sph_kernel="M4")
54
55 cfg = model.gen_default_config()
56 cfg.set_artif_viscosity_VaryingCD10(
57     alpha_min=0.0, alpha_max=1, sigma_decay=0.1, alpha_u=1, beta_AV=2
58 )
59 cfg.set_boundary_periodic()
60 cfg.set_eos_adiabatic(gamma)
61 cfg.print_status()
62 model.set_solver_config(cfg)
63 model.init_scheduler(scheduler_split_val, scheduler_merge_val)
64
65 bmin, bmax = model.get_ideal_hcp_box(dr, bmin, bmax)
66 xm, ym, zm = bmin
67 xM, yM, zM = bmax
68
69 model.resize_simulation_box(bmin, bmax)
70
71 setup = model.get_setup()
72 gen = setup.make_generator_lattice_hcp(dr, bmin, bmax)
73 setup.apply_setup(gen, insert_step=scheduler_split_val)
74
75
76 xc, yc, zc = model.get_closest_part_to((0, 0, 0))
77
78 if shamrock.sys.world_rank() == 0:
79     print("closest part to (0,0,0) is in :", xc, yc, zc)
80
81
82 vol_b = (xM - xm) * (yM - ym) * (zM - zm)
83
84 totmass = rho_g * vol_b
85
86 pmass = model.total_mass_to_part_mass(totmass)
87
88 model.set_value_in_a_box("uint", "f64", 0, bmin, bmax)
89
90 tot_u = pmass * model.get_sum("uint", "f64")
91 if shamrock.sys.world_rank() == 0:
92     print("total u :", tot_u)
93
94 model.set_particle_mass(pmass)
95
96 model.set_cfl_cour(0.1)
97 model.set_cfl_force(0.1)
----- SPH Solver configuration -----
[
    {
        "artif_viscosity": {
            "alpha_max": 1.0,
            "alpha_min": 0.0,
            "alpha_u": 1.0,
            "beta_AV": 2.0,
            "sigma_decay": 0.1,
            "type": "varying_cd10"
        },
        "boundary_config": {
            "bc_type": "periodic"
        },
        "cfl_config": {
            "cfl_cour": 0.0,
            "cfl_force": 0.0,
            "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",
            "eos_type": "adiabatic",
            "gamma": 1.6666666666666667
        },
        "epsilon_h": 1e-06,
        "ext_force_config": {
            "force_list": []
        },
        "gpart_mass": 0.0,
        "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,
        "scheduler_config": {
            "merge_load_value": 0,
            "split_load_value": 0
        },
        "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": null,
        "use_two_stage_search": true
    }
]
------------------------------------
SPH setup: generating particles ...
SPH setup: Nstep = 11520 ( 1.2e+04 ) Ntotal = 11520 ( 1.2e+04 ) rate = 4.088670e+06 N.s^-1
SPH setup: the generation step took : 0.00853153 s
SPH setup: final particle count = 11520 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     : 5.51 us    (64.6%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 11520 min = 11520                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 11520 min = 11520                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 11520
    max = 11520
    avg = 11520
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1973.00 ns (0.1%)
   patch tree reduce : 1132.00 ns (0.1%)
   gen split merge   : 781.00 ns  (0.0%)
   split / merge op  : 0/0
   apply split merge : 1323.00 ns (0.1%)
   LB compute        : 1684.31 us (99.2%)
   LB move op cnt    : 0
   LB apply          : 3.92 us    (0.2%)
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.54 us    (67.5%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 11520 min = 11520                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 11520 min = 11520                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 11520
    max = 11520
    avg = 11520
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1613.00 ns (0.1%)
   patch tree reduce : 471.00 ns  (0.0%)
   gen split merge   : 551.00 ns  (0.0%)
   split / merge op  : 0/0
   apply split merge : 270.00 ns  (0.0%)
   LB compute        : 2.80 ms    (99.7%)
   LB move op cnt    : 0
   LB apply          : 2.04 us    (0.1%)
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.32 us    (63.4%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 11520 min = 11520                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 11520 min = 11520                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 11520
    max = 11520
    avg = 11520
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1874.00 ns (0.1%)
   patch tree reduce : 461.00 ns  (0.0%)
   gen split merge   : 481.00 ns  (0.0%)
   split / merge op  : 0/0
   apply split merge : 291.00 ns  (0.0%)
   LB compute        : 2.53 ms    (99.7%)
   LB move op cnt    : 0
   LB apply          : 2.08 us    (0.1%)
Info: ---------------------------------------------                   [DataInserterUtility][rank=0]
SPH setup: injected        11520 / 11520 => 100.0% | ranks with patchs = 1 / 1  <- global loop ->
SPH setup: the injection step took : 0.016837525000000002 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.7% 0.0% |   128.67 MB |   450.00 kB |
+------+--------------------+-------+-------------+-------------+-------------+
SPH setup: the setup took : 0.036546573 s
closest part to (0,0,0) is in : 0.0 0.0 0.0
total u : 0.0

Single timestep to iterate the smoothing length

102 model.timestep()
103 model.dump("init.sham")
104
105 # here we can dump and load it into another context i we want like so
106 ctx_data_source = shamrock.Context()
107 ctx_data_source.pdata_layout_new()
108 model_data_source = shamrock.get_Model_SPH(
109     context=ctx_data_source, vector_type="f64_3", sph_kernel="M4"
110 )
111 model_data_source.load_from_dump("init.sham")
112
113 # trigger rebalancing
114 model_data_source.set_dt(0.0)
115 model_data_source.timestep()
116
117 # reset dt to 0 for the init of the next simulation
118 model_data_source.set_dt(0.0)
119
120 cfg = model_data_source.get_current_config()
121 cfg.print_status()
122
123 # now we feed the old context to the new model
124 ctx_new = shamrock.Context()
125 ctx_new.pdata_layout_new()
126
127 model_new = shamrock.get_Model_SPH(context=ctx_new, vector_type="f64_3", sph_kernel="M4")
128 model_new.set_solver_config(cfg)
129 model_new.init_scheduler(scheduler_split_val, scheduler_merge_val)
130 model_new.resize_simulation_box(bmin, bmax)
131
132 setup = model_new.get_setup()
133 gen = setup.make_generator_from_context(ctx_data_source)
134 split_part = setup.make_modifier_split_part(parent=gen, n_split=2, seed=42)
135 setup.apply_setup(split_part, insert_step=scheduler_split_val)
136
137 model_new.timestep()
---------------- t = 0, dt = 0 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 11520 min = 11520                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 11520 min = 11520                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 11520
    max = 11520
    avg = 11520
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 27.77 us   (4.2%)
   patch tree reduce : 6.03 us    (0.9%)
   gen split merge   : 601.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 892.00 ns  (0.1%)
   LB compute        : 608.59 us  (92.1%)
   LB move op cnt    : 0
   LB apply          : 4.50 us    (0.7%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 4.44 us    (79.1%)
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.39592013888888883
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.03437860905706778 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.4238715277777777
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.03781646996277456 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.4238715277777777
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.041598116959052016 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.4506076388888888
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.045757928654957224 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.5162326388888888
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.05033372152045295 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.6863715277777777
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.05536709367249825 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.6863715277777777
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.06090380303974808 unconverged cnt = 11520
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.7886284722222223
Warning: the unit system is not set                                           [sph::Config][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (0,0,0)
    sum a = (0,0,0)
    sum e = 0
    sum de = 0
Info: CFL hydro = 1.7976931348623157e+308 sink sink = inf                             [SPH][rank=0]
Info: cfl dt = 1.7976931348623157e+308 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.0962e+04 | 11520 |      1 | 5.496e-01 | 0.0% |   0.7% 0.0% |   128.67 MB |   450.00 kB |
+------+------------+-------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0 (tsim/hr)                                             [sph::Model][rank=0]
Info: Dumping state to init.sham                                                      [SPH][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 5.74 us    (57.3%)
Info: dump to init.sham                                                     [Shamrock Dump][rank=0]
              - took 4.38 ms, bandwidth = 443.18 MB/s
Info: Loading state from dump init.sham                                               [SPH][rank=0]
Info: load dump from init.sham                                              [Shamrock Dump][rank=0]
              - took 2.65 ms, bandwidth = 730.55 MB/s
---------------- t = 0, dt = 0 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 11520 min = 11520                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 11520 min = 11520                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 11520
    max = 11520
    avg = 11520
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 3.67 us    (0.5%)
   patch tree reduce : 932.00 ns  (0.1%)
   gen split merge   : 721.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 1202.00 ns (0.1%)
   LB compute        : 796.83 us  (98.3%)
   LB move op cnt    : 0
   LB apply          : 3.44 us    (0.4%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.33 us    (69.5%)
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.8190104166666667
Warning: the unit system is not set                                           [sph::Config][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (0,0,0)
    sum a = (0,0,0)
    sum e = 0
    sum de = 0
Info: CFL hydro = 1.7976931348623157e+308 sink sink = inf                             [SPH][rank=0]
Info: cfl dt = 1.7976931348623157e+308 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    | 6.7882e+04 | 11520 |      1 | 1.697e-01 | 0.0% |   0.4% 0.0% |   128.67 MB |   450.00 kB |
+------+------------+-------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0 (tsim/hr)                                             [sph::Model][rank=0]
----- SPH Solver configuration -----
[
    {
        "artif_viscosity": {
            "alpha_max": 1.0,
            "alpha_min": 0.0,
            "alpha_u": 1.0,
            "beta_AV": 2.0,
            "sigma_decay": 0.1,
            "type": "varying_cd10"
        },
        "boundary_config": {
            "bc_type": "periodic"
        },
        "cfl_config": {
            "cfl_cour": 0.1,
            "cfl_force": 0.1,
            "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",
            "eos_type": "adiabatic",
            "gamma": 1.6666666666666667
        },
        "epsilon_h": 1e-06,
        "ext_force_config": {
            "force_list": []
        },
        "gpart_mass": 0.00017268787196946227,
        "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,
        "scheduler_config": {
            "merge_load_value": 1,
            "split_load_value": 20000000
        },
        "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.56,
            "dt_sph": 0.0,
            "time": 0.0
        },
        "tree_reduction_level": 3,
        "type_id": "sycl::vec<f64,3>",
        "unit_sys": null,
        "use_two_stage_search": true
    }
]
------------------------------------
SPH setup: generating particles ...
SPH setup: Nstep = 20153 ( 2.0e+04 ) Ntotal = 20153 ( 2.0e+04 ) rate = 2.673602e+05 N.s^-1
SPH setup: the generation step took : 0.07634388 s
SPH setup: final particle count = 20153 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     : 5.71 us    (57.9%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 20153 min = 20153                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 20153 min = 20153                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 20153
    max = 20153
    avg = 20153
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1714.00 ns (0.4%)
   patch tree reduce : 1483.00 ns (0.3%)
   gen split merge   : 811.00 ns  (0.2%)
   split / merge op  : 0/0
   apply split merge : 891.00 ns  (0.2%)
   LB compute        : 422.55 us  (97.2%)
   LB move op cnt    : 0
   LB apply          : 3.59 us    (0.8%)
Info: Compute load ...                                                [DataInserterUtility][rank=0]
Info: run scheduler step ...                                          [DataInserterUtility][rank=0]
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.79 us    (65.8%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 20153 min = 20153                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 20153 min = 20153                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 20153
    max = 20153
    avg = 20153
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1694.00 ns (0.6%)
   patch tree reduce : 511.00 ns  (0.2%)
   gen split merge   : 411.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 280.00 ns  (0.1%)
   LB compute        : 270.68 us  (97.5%)
   LB move op cnt    : 0
   LB apply          : 1423.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     : 1964.00 ns (61.6%)
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 20153 min = 20153                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 20153 min = 20153                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 20153
    max = 20153
    avg = 20153
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 1202.00 ns (0.5%)
   patch tree reduce : 501.00 ns  (0.2%)
   gen split merge   : 310.00 ns  (0.1%)
   split / merge op  : 0/0
   apply split merge : 251.00 ns  (0.1%)
   LB compute        : 255.55 us  (97.7%)
   LB move op cnt    : 0
   LB apply          : 1343.00 ns (0.5%)
Info: ---------------------------------------------                   [DataInserterUtility][rank=0]
SPH setup: injected        20153 / 20153 => 100.0% | ranks with patchs = 1 / 1  <- global loop ->
SPH setup: the injection step took : 0.008421487 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.7% 0.0% |   128.67 MB |   450.00 kB |
+------+--------------------+-------+-------------+-------------+-------------+
SPH setup: the setup took : 0.09239752400000001 s
---------------- t = 0, dt = 0 ----------------
Info: summary :                                                               [LoadBalance][rank=0]
Info:  - strategy "psweep" : max = 20153 min = 20153                          [LoadBalance][rank=0]
Info:  - strategy "round robin" : max = 20153 min = 20153                     [LoadBalance][rank=0]
Info: Loadbalance stats :                                                     [LoadBalance][rank=0]
    npatch = 1
    min = 20153
    max = 20153
    avg = 20153
    efficiency = 100.00%
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 42.45 us   (1.6%)
   patch tree reduce : 3.49 us    (0.1%)
   gen split merge   : 1012.00 ns (0.0%)
   split / merge op  : 0/0
   apply split merge : 922.00 ns  (0.0%)
   LB compute        : 2.60 ms    (97.1%)
   LB move op cnt    : 0
   LB apply          : 5.10 us    (0.2%)
Info: Scheduler step timings :                                                  [Scheduler][rank=0]
   metadata sync     : 2.75 us    (70.6%)
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.26030863891232076
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.03503955180694534 unconverged cnt = 20127
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.29479481962983184
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.03854350698763988 unconverged cnt = 19995
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.3368729221455863
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.04239785768640387 unconverged cnt = 19353
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.38237483253113674
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.04663764345504426 unconverged cnt = 16699
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.43844588894953596
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.05130140780054869 unconverged cnt = 10578
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.5010172182801569
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.05643154858060356 unconverged cnt = 4052
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.5702873021386394
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.06207470343866393 unconverged cnt = 916
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.6555351560561704
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.06828217378253032 unconverged cnt = 108
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.7489207562149557
Warning: smoothing length is not converged, rerunning the iterator ...    [Smoothinglength][rank=0]
     largest h = 0.07511039116078332 unconverged cnt = 9
Warning: High interface/patch volume ratio.                                  [InterfaceGen][rank=0]
    This can lead to high mpi overhead, try to increase the patch split crit
    patch 0 high interf/patch volume: 0.8623529995534163
Warning: the unit system is not set                                           [sph::Config][rank=0]
Info: conservation infos :                                                     [sph::Model][rank=0]
    sum v = (0,0,0)
    sum a = (0,0,0)
    sum e = 0
    sum de = 0
Info: CFL hydro = 1.7976931348623157e+308 sink sink = inf                             [SPH][rank=0]
Info: cfl dt = 1.7976931348623157e+308 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.4367e+04 | 20153 |      1 | 1.403e+00 | 0.0% |   0.4% 0.0% |   128.67 MB |   450.00 kB |
+------+------------+-------+--------+-----------+------+-------------+-------------+-------------+
Info: estimated rate : 0 (tsim/hr)                                             [sph::Model][rank=0]

<shamrock.model_sph.TimestepLog object at 0x7f7cb9946330>

Recover data

Info: collected : 1 patches                                                [PatchScheduler][rank=0]

Test h value

146 import numpy as np
147
148 min_hpart = np.min(dat["hpart"])
149 max_hpart = np.max(dat["hpart"])
150 mean_hpart = np.mean(dat["hpart"])
151
152 print(f"hpart min={min_hpart} max={max_hpart} delta={max_hpart - min_hpart}")
153
154 assert min_hpart < 0.04, "hpart min is too large"
hpart min=0.03052490988824677 max=0.07734862180276868 delta=0.04682371191452191

Plot particle distrib

159 import matplotlib
160 import matplotlib.pyplot as plt
161 from mpl_toolkits.mplot3d import Axes3D
162
163 fig = plt.figure(dpi=120)
164 ax = fig.add_subplot(111, projection="3d")
165 ax.set_xlim3d(bmin[0], bmax[0])
166 ax.set_ylim3d(bmin[1], bmax[1])
167 ax.set_zlim3d(bmin[2], bmax[2])
168
169 cm = matplotlib.colormaps["viridis"]
170 sc = ax.scatter(
171     dat["xyz"][:, 0],
172     dat["xyz"][:, 1],
173     dat["xyz"][:, 2],
174     s=1,
175     c=dat["hpart"],
176     cmap=cm,
177 )
178 plt.colorbar(sc)
179 plt.show()
run upscale simulation restart

Total running time of the script: (0 minutes 4.575 seconds)

Estimated memory usage: 156 MB

Gallery generated by Sphinx-Gallery