Exemplo n.º 1
0
 def _do_dim(self, dim, input, valid: bool = False):
     for interp in range(1, 4):
         try:
             self.dman, self.sim, self.hier = create_simulator(
                 dim, interp, **input)
             self.assertTrue(valid)
             self.dman.dump(self.sim.currentTime(), self.sim.timeStep())
             del (
                 self.dman,
                 self.sim,
                 self.hier,
             )
             cpp.reset()
         except ValueError as e:
             self.assertTrue(not valid)
Exemplo n.º 2
0
    def test_1d(self):

        for interp in range(1, 4):

            self.dman, self.sim, self.hier = create_simulator(1, interp)
            dw = DataWrangler(self.sim, self.hier)

            print("\n", dw.lvl0IonDensity())
            print("\n", dw.lvl0BulkVelocity())
            print("\n", dw.lvl0PopDensity())
            print("\n", dw.lvl0PopFluxs())
            print("\n", dw.lvl0EM())

            del (
                dw,
                self.dman,
                self.sim,
                self.hier,
            )
            cpp.reset()
Exemplo n.º 3
0
def create_simulator(dim, interp, **input):

    cpp.reset()
    ph.globals.sim = None
    ph.Simulation(**basicSimulatorArgs(dim, interp, **input))
    extra_pops = {}
    if "populations" in input:
        for pop, vals in input["populations"].items():
            extra_pops[pop] = defaultPopulationSettings()
            extra_pops[pop].update(vals)

    model = makeBasicModel(extra_pops)
    if "diags_fn" in input:
        input["diags_fn"](model)

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

    ph.populateDict()
    hier = cpp.make_hierarchy()
    sim = cpp.make_simulator(hier)
    sim.initialize()
    return [cpp.make_diagnostic_manager(sim, hier), sim, hier]
Exemplo n.º 4
0
 def tearDown(self):
     for k in ["dman", "sim", "hier"]:
         if hasattr(self, k):
             v = getattr(self, k)
             del v  # blocks segfault on test failure, could be None
     cpp.reset()
Exemplo n.º 5
0
 def tearDown(self):
     cpp.reset()