Skip to main content

1D Finite-Difference Split Newton Solver

Project description

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(20, 2, ["u", "v"]) # nx, ng, variables

# 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, "label")

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SplitFDM-0.1.4.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file SplitFDM-0.1.4.tar.gz.

File metadata

  • Download URL: SplitFDM-0.1.4.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.1

File hashes

Hashes for SplitFDM-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4ff86e6571ca8170b90fa367839db64fb93add5c8d61d409d94b5b8512824138
MD5 547272d77919f28b86a0af7aefa2f46f
BLAKE2b-256 7c67d3806a87b340648df069e8621f245c552ca24423a660a884d4c028e51df0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page