示例#1
0
    def evolve(self):
        """
        Evolve the linear advection equation through one timestep.  We only
        consider the "density" variable in the CellCenterData2d object that
        is part of the Simulation.
        """

        tm_evolve = self.tc.timer("evolve")
        tm_evolve.begin()

        myd = self.cc_data

        method = self.rp.get_param("advection.temporal_method")

        rk = integration.RKIntegrator(myd.t, self.dt, method=method)
        rk.set_start(myd)

        for s in range(rk.nstages()):
            ytmp = rk.get_stage_start(s)
            ytmp.fill_BC_all()
            k = self.substep(ytmp)
            rk.store_increment(s, k)

        rk.compute_final_update()

        # increment the time
        myd.t += self.dt
        self.n += 1

        tm_evolve.end()
示例#2
0
    def evolve(self):
        """
        Evolve the equations of compressible hydrodynamics through a
        timestep dt.
        """

        tm_evolve = self.tc.timer("evolve")
        tm_evolve.begin()

        myd = self.cc_data

        method = self.rp.get_param("compressible.temporal_method")

        rk = integration.RKIntegrator(myd.t, self.dt, method=method)
        rk.set_start(myd)

        for s in range(rk.nstages()):
            ytmp = rk.get_stage_start(s)
            ytmp.fill_BC_all()
            k = self.substep(ytmp)
            rk.store_increment(s, k)

        rk.compute_final_update()

        # increment the time
        myd.t += self.dt
        self.n += 1

        tm_evolve.end()
示例#3
0
    def evolve(self):
        """
        Evolve the equations of compressible hydrodynamics through a
        timestep dt.
        """

        tm_evolve = self.tc.timer("evolve")
        tm_evolve.begin()

        dens = self.cc_data.get_var("density")
        ymom = self.cc_data.get_var("y-momentum")
        ener = self.cc_data.get_var("energy")

        grav = self.rp.get_param("compressible.grav")

        #--------------Euler time stepping--------------#
        # myg = self.cc_data.grid

        # Flux_x, Flux_y = flx.unsplit_fluxes(self.cc_data, self.aux_data, self.rp,
        #                                     self.ivars, self.solid, self.tc, self.dt)

        # old_dens = dens.copy()
        # old_ymom = ymom.copy()

        # # conservative update
        # dtdx = self.dt/myg.dx
        # dtdy = self.dt/myg.dy

        # for n in range(self.ivars.nvar):
        #     var = self.cc_data.get_var_by_index(n)

        #     var.v()[:,:] += \
        #         dtdx*(Flux_x.v(n=n) - Flux_x.ip(1, n=n)) + \
        #         dtdy*(Flux_y.v(n=n) - Flux_y.jp(1, n=n))

        # # gravitational source terms
        # ymom[:,:] += 0.5*self.dt*(dens[:,:] + old_dens[:,:])*grav
        # ener[:,:] += 0.5*self.dt*(ymom[:,:] + old_ymom[:,:])*grav

        #--------------Runge-Kutta Timestepping---------#
        myd = self.cc_data

        method = self.rp.get_param("compressible.temporal_method")

        rk = integration.RKIntegrator(myd.t, self.dt, method=method)
        rk.set_start(myd)

        for s in range(rk.nstages()):
            ytmp = rk.get_stage_start(s)
            ytmp.fill_BC_all()
            k = self.substep(ytmp)
            rk.store_increment(s, k)

        rk.compute_final_update()

        # increment the time
        self.cc_data.t += self.dt
        self.n += 1

        tm_evolve.end()