Skip to content

1D Finite-Difference with AMR and steady-state solver using Newton and Split-Newton

License

Notifications You must be signed in to change notification settings

gpavanb1/SplitFDM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SplitFDM

Downloads

img

1D Finite-Difference with adaptive mesh refinement and steady-state solver using Newton and Split-Newton approach

What does 'split' mean?

The system is divided into two and for ease of communication, let's refer to first set of variables as "outer" and the second as "inner".

  • Holding the outer variables fixed, Newton iteration is performed till convergence using the sub-Jacobian

  • One Newton step is performed for the outer variables with inner held fixed (using its sub-Jacobian)

  • This process is repeated till convergence criterion is met for the full system (same as in Newton)

How to install and execute?

Just run

pip install splitfdm

There is an examples folder that contains a test model - Advection-Diffusion

You can define your own equations by simply creating a derived class from Model and adding to the _equations using existing or custom equations!

A basic driver program is as follows

# Define the problem
m = AdvectionDiffusion(c=0.2, nu=0.001)

# Define the domain and variables
# ng stands for ghost point count
d = Domain.from_size(nx=20, ng=2, ["u", "v"])

# Set IC and BC
ics = {"u": "gaussian", "v": "rarefaction"}
bcs = {
    "u": {
        "left": "periodic",
        "right": "periodic"
    },
    "v": {
        "left": {"dirichlet": 3},
        "right": {"dirichlet": 4}
    }
}
s = Simulation(d, m, ics, bcs)

# Advance in time or to steady state
s.evolve(dt=0.1)
iter = s.steady_state()

# Visualize
draw(d)

Whom to contact?

Please direct your queries to gpavanb1 for any questions.

Acknowledgements

Do visit its Finite-Volume cousin

Special thanks to Cantera and WENO-Scalar for serving as an inspiration for code architecture.

About

1D Finite-Difference with AMR and steady-state solver using Newton and Split-Newton

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages