Skip to content

iBatistic/HoPyFoam

Repository files navigation

-

FOAM like Python code for High-order Finite Volume Method

HoPyFOAM is an OpenFOAM-like Python package written for a high-order finite volume method. The code is intended to solve solid mechanics problems on 2D unstructured meshes. It is based on numpy and petsc4py packages while the coding style and code structure is similar to one from the OpenFOAM library.

Authors and Contributors

Installation

  1. Clone the directory with git clone git@github.com:iBatistic/HoPyFoam.git

  2. Install the necessary packages (Ubuntu 24.04 and 22.04):

    sudo apt update
    sudo apt install -y build-essential python3-dev python3-pip cmake gfortran \
    libopenblas-dev liblapack-dev libmpich-dev libhdf5-dev petsc-dev
    
  3. Install the necessary packages (macOS Sequoia):

    brew install open-mpi
    brew install gmsh
    
  4. Required python are listed in requirements.txt and can be installed easily with venv:

    virtualenv venv-HoPyFoam
    

    above command on macOS is:

    python3 -m venv venv-HoPyFoam
    

    Source virtual environment and install required packages:

    source venv-HoPyFoam/bin/activate
    pip install -r requirements.txt
    
  5. Install some of the OpenFOAM.COM distribution using the instructions on this link. OpenFOAM is required for mesh generation and post-processing functionalities.

  6. To run cases, first source OpenFOAM shell session and then activate Python environment:

    openfoam2312
    source venv-HoPyFoam/bin/activate
    

    All tutorial cases have a corresponding ./Allrun script to run them.

License

This toolkit is released under the GNU General Public License (version 3). More details can be found in the LICENSE file.

Disclaimer

This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks.

Tutorials

  • laplacianFoam1D

    • heatConduction.py Python script for 1D heat conduction with linear temperature profile.

    • heatConductionMMS.py Python script for 1D heat conduction with variable source term obtained using MMS.

  • laplacianFoam

    • squareBlock Laplace equation solved on 2D square domain ($1 x 1$ m), left and right patches have fixed values, top and bottom patches are zero gradient.

    • squareBlockSource Laplace equation solved on 2D square domain ($1 x 1$ m), left and right patches have fixed values, top and bottom patches are zero gradient and source term is added.

  • elasticSolidFoam

    • cantilever2D Rectangular beam $50$ x $2$ m with a Young’s modulus of $30000$ Pa and a Poisson’s ration of $0.3$. The beam is fixed on the left boundary, and a uniform distributed traction of $(0,-2,0)$ Pa is applied to the right boundary; the top and bottom boundaries are traction-free. Example is taken from: Demirdžić, I. "A fourth-order finite volume method for structural analysis." Applied Mathematical Modelling, 2016.

    • squareBlock2D 2D square domain ($1$ x $1$ m), left patch fixed, top and bottom are traction-free. The right patch have prescribed traction in $x$ direction. Poisson's value is $0$ resulting in linear distribution of displacement field.

    • squareBlock2DMMS 2D square domain ($1$ x $1$ m), all patches have zero displacement. Body force calculated according to expected solution. Example is taken from: Aycock, Kenneth I., Nuno Rebelo, and Brent A. Craven. "Method of manufactured solutions code verification of elastostatic solid mechanics problems in a commercial finite element solver." Computers & Structures, 2020.

Contact, support, and contribution information

To contact the authors about HoPyFOAM, please use the issue tracker of the GitHub project. Bug reports and contributions to new features are welcome.

About

Python code for High-order Finite Volume Method.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy