示例#1
0
def main():
    setup = Setup()

    setup.grid = (75, 75)
    setup.steps = [1] + list(range(10, 100, 10))  #[100, 3600]
    setup.processes = {
        "advection": True,
        "coalescence": True,
        "condensation": True
    }
    setup.condensation_dt_max = .2

    n_sd = range(50, 51, 10)

    times = {}
    for parallel in (False, ):
        PySDM.backends.numba.conf.NUMBA_PARALLEL = parallel
        reload_backend()
        for method in ('local', ):
            key = f"{method} (parallel={parallel})"
            times[key] = []
            for sd in n_sd:
                setup.n_sd_per_gridbox = sd
                storage = Storage()
                simulation = Simulation(setup, storage)
                # simulation.particles.croupier = method
                stats = simulation.run()
                times[key].append(stats.wall_times[-1])

    from matplotlib import pyplot as plt
    for method, t in times.items():
        plt.plot(n_sd, t, label=method)
    plt.legend()
    plt.loglog()
    plt.show()
示例#2
0
def test_export():
    # Arrange
    setup = Setup()
    setup.n_steps = 1
    setup.outfreq = 1

    storage = Storage()
    simulator = Simulation(setup, storage)
    sut = netCDF(storage, setup, simulator)
    controller = DummyController()

    simulator.reinit()
    simulator.run(controller)

    # Act
    sut.run(controller=controller)
示例#3
0
文件: example.py 项目: cycle13/PySDM
def main():
    with np.errstate(all='ignore'):
        setup = Setup()

        setup.n_sd_per_gridbox = 25
        setup.grid = (25, 25)
        setup.processes["coalescence"] = True
        setup.processes["condensation"] = True
        setup.condensation_rtol_lnv = 1e-8
        setup.condensation_rtol_thd = 1e-8
        setup.mpdata_iters = 2

        storage = Storage()
        simulation = Simulation(setup, storage)
        simulation.reinit()
        simulation.run()