Metadata-Version: 2.1
Name: SplitFXM
Version: 0.4.2
Summary: 1D Finite-Difference/Volume Split Newton Solver
Home-page: https://github.com/gpavanb1/SplitFXM
Author: gpavanb1
Author-email: gpavanb@gmail.com
License: CC BY-NC 4.0 for non-commercial use, commercial license available
Project-URL: Bug Reports, https://github.com/gpavanb1/SplitFXM/issues
Project-URL: Source, https://github.com/gpavanb1/SplitFXM/
Description: # SplitFXM
        
        [![Downloads](https://pepy.tech/badge/splitfxm)](https://pepy.tech/project/splitfxm)
        ![Coverage](https://img.shields.io/badge/coverage-99%25-brightgreen.svg)
        [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13882261.svg)](https://doi.org/10.5281/zenodo.13882261)
        
        ![img](https://github.com/gpavanb1/SplitFXM/blob/main/assets/logo.jpg)
        
        1D [Finite-Difference](https://en.wikipedia.org/wiki/Finite_difference_method) or [Finite-Volume](https://en.wikipedia.org/wiki/Finite_volume_method) using asymmetric stencils with [adaptive mesh refinement](https://en.wikipedia.org/wiki/Adaptive_mesh_refinement) and steady-state solver using Newton and [Split-Newton](https://github.com/gpavanb1/SplitNewton) 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](https://github.com/gpavanb1/SplitFXM/models) folder that contains a test model - [Advection-Diffusion](https://en.wikipedia.org/wiki/Convection%E2%80%93diffusion_equation)
        
        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)
        d = Domain.from_size(20, 1, 1, ["u", "v", "w"]) # nx, nb_left, nb_right, variables
        ics = {"u": "gaussian", "v": "rarefaction", "w": "tophat"}
        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(t_diff=0.1)
        bounds = [[-1., -2., 0.], [5., 4., 3.]]
        iter = s.steady_state(split=True, split_loc=1, bounds=bounds)
        
        # Visualize
        draw(d, "label")
        ```
        
        ## How to build from source?
        
        Since v0.4.0, SplitFXM utilizes Cython for accelerated computation. To build from source, you will need to install Cython and run the following command:
        ```
        python setup.py build_ext --inplace
        ```
        
        ## Run benchmark
        There is a benchmark that is included, which compares the time it takes to generate both a sparse and dense Jacobian. The results are as follows:
        
        For N=250, 
        
        | Method    | Time       | 
        |-----------|------------|
        | Dense   |    20 seconds |
        | Sparse |  ~0.6 seconds  |
        
        The benchmark can be executed from the parent folder using the command
        
        `python -m pytest -s benchmark`
        
        ## How to run tests?
        
        To run the tests, execute the following command from the parent folder:
        ```
        python -m pytest tests
        ```
        
        You can use the `-s` flag to show `print` outputs of the tests
        
        ## How to get coverage?
        
        To get coverage, execute the following command from the parent folder:
        ```
        python -m pytest --cov=splitfxm --cov-report <option> tests
        ```
        
        The `option` can be related to showing covered/missed lines or specifying the output format of the report. For example, to get a line-by-line report, use the following command:
        ```
        python -m pytest --cov=splitfxm --cov-report term-missing tests
        ```
        
        ## Whom to contact?
        
        Please direct your queries to [gpavanb1](http://github.com/gpavanb1)
        for any questions.
        
        ## Acknowledgements
        
        Special thanks to [Cantera](https://github.com/Cantera/cantera) and [WENO-Scalar](https://github.com/comp-physics/WENO-scalar) for serving as an inspiration for code architecture.
        
        
        ## Citing
        
        If you are using `SplitFXM` in any scientific work, please make sure to cite as follows
        ```
        @software{pavan_b_govindaraju_2024_13882261,
          author       = {Pavan B Govindaraju},
          title        = {gpavanb1/SplitFXM: v0.4.0},
          month        = oct,
          year         = 2024,
          publisher    = {Zenodo},
          version      = {v0.4.0},
          doi          = {10.5281/zenodo.13882261},
          url          = {https://doi.org/10.5281/zenodo.13882261}
        }
        ```
        
Keywords: amr newton python finite-difference armijo optimization pseudotransient splitting
Platform: UNKNOWN
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Description-Content-Type: text/markdown
