Skip to main content

1D Finite-Difference/Volume Split Newton Solver

Project description

SplitFXM

Downloads

img

1D Finite-Difference or Finite-Volume 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 splitfxm

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

from splitfxm.domain import Domain
from splitfxm.simulation import Simulation
from splitfxm.schemes import default_scheme
from splitfxm.visualize import draw

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

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

# Define the problem
m = AdvectionDiffusion(c=0.2, nu=0.001, method=method)
d = Domain.from_size(20, 2, ["u", "v", "w"])
ics = {"u": "gaussian", "v": "rarefaction"}
bcs = {
    "u": {
        "left": "periodic",
        "right": "periodic"
    },
    "v": {
        "left": {"dirichlet": 3},
        "right": {"dirichlet": 4}
    },
    "w": {
        "left": {"dirichlet": 2},
        "right": "periodic"
    }
}
s = Simulation(d, m, ics, bcs, default_scheme(method))


# Advance in time or to steady state
s.evolve(dt=0.1)
bounds = [[-1., -2., 0.], [5., 4., 3.]]
iter = s.steady_state(split=True, split_loc=1, bounds=bounds)

# Visualize
draw(d, "label")

Whom to contact?

Please direct your queries to gpavanb1 for any questions.

Acknowledgements

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

SplitFXM-0.1.tar.gz (16.6 kB view details)

Uploaded Source

File details

Details for the file SplitFXM-0.1.tar.gz.

File metadata

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

File hashes

Hashes for SplitFXM-0.1.tar.gz
Algorithm Hash digest
SHA256 0a2dd2c21bc3e181291a995acc734a69e6012d24a3c6ee93e259cfdc34bdf6dd
MD5 4cb90f2c70c00d5c7c80c6f355bc7a3d
BLAKE2b-256 11d37ab853638f2fc6a2cc78eb8fd941feb9043eb3b1cce92e9a0c44543b85fa

See more details on using hashes here.

Supported by

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