Ejemplo n.º 1
0
    def take_time_step(self, solver):
        physics = solver.physics
        mesh = solver.mesh
        U = solver.state_coeffs

        res = self.res

        # First stage
        res = solver.get_residual(U, res)
        dU1 = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt, res)
        Utemp = U + 0.5 * dU1
        solver.apply_limiter(Utemp)

        # Second stage
        solver.time += self.dt / 2.
        res = solver.get_residual(Utemp, res)
        dU2 = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt, res)
        Utemp = U + 0.5 * dU2
        solver.apply_limiter(Utemp)

        # Third stage
        res = solver.get_residual(Utemp, res)
        dU3 = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt, res)
        Utemp = U + dU3
        solver.apply_limiter(Utemp)

        # Fourth stage
        solver.time += self.dt / 2.
        res = solver.get_residual(Utemp, res)
        dU4 = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt, res)
        dU = 1. / 6. * (dU1 + 2. * dU2 + 2. * dU3 + dU4)
        U += dU
        solver.apply_limiter(U)

        return res  # [num_elems, nb, ns]
Ejemplo n.º 2
0
    def take_time_step(self, solver):
        physics = solver.physics
        mesh = solver.mesh
        U = solver.state_coeffs

        res = self.res
        res = solver.get_residual(U, res)
        dU = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt, res)
        U += dU

        solver.apply_limiter(U)

        return res  # [num_elems, nb, ns]
Ejemplo n.º 3
0
        def take_time_step(self, solver):
            mesh = solver.mesh
            U = solver.state_coeffs

            res = self.res

            res = solver.get_residual(U, res)
            dU = mult_inv_mass_matrix(mesh, solver, self.dt, res)

            A, iA = self.get_jacobian_matrix(mesh, solver)

            res = np.einsum('ijkll, ijl -> ikl', A, U) + dU
            U = np.einsum('ijkll, ijl -> ikl', iA, res)

            solver.apply_limiter(U)
            solver.state_coeffs = U

            return res  # [ne, nb, ns]
Ejemplo n.º 4
0
    def take_time_step(self, solver):
        physics = solver.physics
        mesh = solver.mesh
        W = solver.state_coeffs
        Up = solver.state_coeffs_pred

        res = self.res

        # Prediction step
        Up = solver.calculate_predictor_step(solver, self.dt, W, Up)
        # Correction step
        res = solver.get_residual(Up, res)

        dU = solver_tools.mult_inv_mass_matrix(mesh, solver, self.dt / 2., res)

        W += dU
        solver.apply_limiter(W)

        solver.state_coeffs_pred = Up

        return res  # [num_elems, nb, ns]
Ejemplo n.º 5
0
    def take_time_step(self, solver):
        physics = solver.physics
        mesh = solver.mesh
        U = solver.state_coeffs

        res = self.res
        dU = self.dU

        Time = solver.time
        for istage in range(self.nstages):
            dt = self.dt

            res = solver.get_residual(U, res)
            dUtemp = solver_tools.mult_inv_mass_matrix(mesh, solver, dt, res)
            solver.time = Time + dt

            dU *= self.ssprk3a[istage]
            dU += dUtemp
            U += self.ssprk3b[istage] * dU
            solver.apply_limiter(U)

        return res  # [num_elems, nb, ns]