Git Product home page Git Product logo

eno-linear-advection's Introduction

ENO scheme for 1-D linear advection equation

k-th order ENO scheme for 1-D linear advection equation is implemented in ENO.py. Written by WCY at Tsinghua University. It is the homework for the Course: Advanced Computational Fluid Mechanics, 2023.

The 1-D linear advection problem is solved by intereacting with the ENO class. The construction function of the ENO class contains the following arguments:

a: The convection speed, default value is 1
ni: The number of internal cells, default value is 100
cfl: The CFL number used for simulation, default value is 0.5
order: The order of ENO scheme used, default value is 3

To use the code, simply write:

import numpy as np
import ENO as ENO

eno = ENO.ENO_advection(order=3) # set order to the order you need
eno.set_initial()
global_t = 0.0
T = 10.0 # simulate to T = 10.0
global_t = 0.0
while global_t < T:
    dt = eno.Runge_Kutta()
    global_t += dt

And you can use the following command to plot the result:

import matplotlib.pyplot as plt
plt.plot(eno.xc, eno.u, label = "ENO, order-{}".format(3))

For the more detailed usage, you can refer to test.ipynb. The plot of the solution given by ENO 3, 4, and 5 at T = 1.0, a = 1.0 is shown below:

Result_1.0

The GIF below compares the numerical solution of ENO-3 with the exact solution when the solution time T < 10:

ENO-3

eno-linear-advection's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.