Esempio n. 1
0
def config():
    ph.Simulation(# strict=True,
        smallest_patch_size=patch_sizes[0], largest_patch_size=patch_sizes[1],
        time_step_nbr=10, time_step=0.001,
        cells=[cells] * 2, dl=[dl] * 2,
        resistivity=0.001, hyper_resistivity=0.001,
        diag_options={"format": "phareh5", "options": {"dir": diag_outputs, "mode":"overwrite"}},
        refinement_boxes={},
    )
    ph.MaxwellianFluidModel( bx=bx, by=by, bz=bz,
        protons={"charge": 1, "density": density, "init":{"seed": seed},
          **{ "nbr_part_per_cell":100,
            "vbulkx": vxyz, "vbulky": vxyz, "vbulkz": vxyz,
            "vthx": vthxyz, "vthy": vthxyz, "vthz": vthxyz,
          }
        },
    )
    ph.ElectronModel(closure="isothermal", Te=0.0)

    from tests.diagnostic import all_timestamps
    timestamps = all_timestamps(ph.global_vars.sim)
    timestamps = np.asarray([timestamps[0], timestamps[-1]])
    for quantity in ["E", "B"]:
        ph.ElectromagDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
        )
Esempio n. 2
0
def dump_all_diags(pops=[]):
    import pyphare.pharein as ph, numpy as np

    sim = ph.global_vars.sim

    timestamps = np.arange(0, sim.time_step + 3) * sim.time_step

    for quantity in ["density", "bulkVelocity"]:
        ph.FluidDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
        )

    for pop in pops:
        for quantity in ["density", "flux"]:
            ph.FluidDiagnostics(quantity=quantity,
                                write_timestamps=timestamps,
                                compute_timestamps=timestamps,
                                population_name=pop)

        for quantity in ['domain', 'levelGhost', 'patchGhost']:
            ph.ParticleDiagnostics(quantity=quantity,
                                   compute_timestamps=timestamps,
                                   write_timestamps=timestamps,
                                   population_name=pop)

    for quantity in ["E", "B"]:
        ph.ElectromagDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
        )
Esempio n. 3
0
def dump_all_diags(pops=[], flush_every=100, timestamps=None):
    import pyphare.pharein as ph, numpy as np

    sim = ph.global_vars.sim

    if timestamps is None:
        timestamps = all_timestamps(sim)

    ph.MetaDiagnostics(
        quantity="tags",
        write_timestamps=timestamps,
        compute_timestamps=timestamps,
    )

    for quantity in ["density", "bulkVelocity"]:
        ph.FluidDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
            flush_every=flush_every,
        )

    for pop in pops:
        for quantity in ["density", "flux"]:
            ph.FluidDiagnostics(quantity=quantity,
                                write_timestamps=timestamps,
                                compute_timestamps=timestamps,
                                flush_every=flush_every,
                                population_name=pop)

        for quantity in ['domain', 'levelGhost', 'patchGhost']:
            ph.ParticleDiagnostics(quantity=quantity,
                                   compute_timestamps=timestamps,
                                   write_timestamps=timestamps,
                                   flush_every=flush_every,
                                   population_name=pop)

    for quantity in ["E", "B"]:
        ph.ElectromagDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
            flush_every=flush_every,
        )
Esempio n. 4
0
def config(**options):

    ph.Simulation(**options)
    ph.MaxwellianFluidModel(bx=bx,
                            by=by,
                            bz=bz,
                            protons={
                                "charge": 1,
                                "density": density,
                                **vvv
                            })
    ph.ElectronModel(closure="isothermal", Te=0.12)

    sim = ph.global_vars.sim

    timestamps = all_timestamps(sim)

    for quantity in ["E", "B"]:
        ph.ElectromagDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
        )
    for quantity in ["density", "bulkVelocity"]:
        ph.FluidDiagnostics(
            quantity=quantity,
            write_timestamps=timestamps,
            compute_timestamps=timestamps,
        )

    for pop in sim.model.populations:
        for quantity in ['domain']:
            ph.ParticleDiagnostics(
                quantity=quantity,
                compute_timestamps=timestamps[:particle_diagnostics["count"] +
                                              1],
                write_timestamps=timestamps[:particle_diagnostics["count"] +
                                            1],
                population_name=pop)
Esempio n. 5
0
                         "charge": 1,
                         "density": density,
                         **vvv, "init": {
                             "seed": 1337
                         }
                     })

ElectronModel(closure="isothermal", Te=0.12)

sim = ph.global_vars.sim

timestamps = np.arange(0, sim.final_time + sim.time_step, 10 * sim.time_step)

for quantity in ["E", "B"]:
    ph.ElectromagDiagnostics(
        quantity=quantity,
        write_timestamps=timestamps,
        compute_timestamps=timestamps,
    )

for quantity in ["density", "bulkVelocity"]:
    ph.FluidDiagnostics(
        quantity=quantity,
        write_timestamps=timestamps,
        compute_timestamps=timestamps,
    )

pops = [
    "protons",
]