Example #1
0
    def test_detect_missing_arrays_for_many_particle_arrays(self):
        # Given.
        x = np.asarray([1.0])
        u = np.asarray([0.0])
        h = np.ones_like(x)
        fluid = get_particle_array_wcsph(name='fluid', x=x, u=u, h=h, m=h)
        solid = get_particle_array(name='solid', x=x, u=u, h=h, m=h)
        arrays = [fluid, solid]

        # When
        integrator = PECIntegrator(fluid=TwoStageRigidBodyStep(),
                                   solid=TwoStageRigidBodyStep())
        equations = [SHM(dest="fluid", sources=None)]
        kernel = CubicSpline(dim=1)
        a_eval = AccelerationEval(particle_arrays=arrays,
                                  equations=equations,
                                  kernel=kernel)
        comp = SPHCompiler(a_eval, integrator=integrator)

        # Then
        self.assertRaises(RuntimeError, comp.compile)
Example #2
0
 def configure_scheme(self):
     s = self.scheme
     scheme = self.options.scheme
     if scheme == 'wcsph':
         s.configure(h0=self.h0, hdx=self.hdx)
     elif scheme == 'aha':
         s.configure(h0=self.h0)
     elif scheme == 'edac':
         s.configure(h=self.h0)
     step = dict(obstacle=TwoStageRigidBodyStep())
     s.configure_solver(kernel=CubicSpline(dim=2), dt=self.dt, tf=3.0,
                        adaptive_timestep=False, extra_steppers=step)
Example #3
0
    def create_solver(self):
        kernel = QuinticSpline(dim=2)
        integrator = Integrator(fluid=TransportVelocityStep(),
                                obstacle=TwoStageRigidBodyStep())

        solver = Solver(kernel=kernel,
                        dim=2,
                        integrator=integrator,
                        tf=tf,
                        dt=dt,
                        adaptive_timestep=False,
                        output_at_times=[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
        return solver
 def _set_stepper(self):
     # create the integrator stepper class we want to test
     self.stepper = TwoStageRigidBodyStep()
 def test_two_stage(self):
     self.stepper = TwoStageRigidBodyStep()
     self._test_motion()