Python Interface to OpenFOAM (Configured Using YAML)
Project description
⬜⬜⬜⬜⬜
🟩⬜🟩⬜🟩
⬜⬜⬜⬜⬜
🟩⬜🟩⬜🟩
OpenFOAM.YAML
Python Interface to OpenFOAM (Configured Using YAML)
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
About The Project
This repository was originally designed to solve the problem of complex OpenFOAM case structure, and the solution was to re-present the original cases using the common configuration file format YAML. Later, since there is a corresponding package for the YAML format in Python, I wrote this Python interface package for OpenFOAM, and then I added progress bars to most OpenFOAM solvers by analyzing log files in real time. Although there are still many details to be specified in this repository, its function of generating cases and calling solvers is ready for preliminary use, for example, I used this package to generate cases in batch in my own project. In the future I would like to integrate the post-processing steps into this interface package as well.
Built With
Getting Started
To get a local copy up and running follow these simple example steps.
Prerequisites
This project currently uses Poetry to manage Python dependencies. I've heard good things about PDM so far, and may provide PDM support subsequently. If Poetry is not installed, you can refer to official installation guide.
Installation
- Clone the repository
git clone https://github.com/iydon/of.yaml.git
- Install Python dependencies
poetry install --extras full
- Activate the virtual environment
poetry shell
- (Optional) Convert Python package into a single file
make standalone
Usage
Demo
Save the following demo code as a separate file (e.g. demo.py
).
from foam import Foam
foam = Foam.from_file('tutorials/incompressible/simpleFoam/airFoil2D.yaml')
foam.save('airFoil2D')
foam.cmd.all_run()
Running the demo code in the virtual environment results in the following output.
$ poetry run python demo.py
Running simpleFoam on .../of.yaml/airFoil2D
63%|██████████████████████████████████████▏ | 313.0/500.0 [00:06<00:04, 46.66it/s]
Tutorials
The following table shows the OpenFOAM cases that have been converted to YAML format. You can find the corresponding rules by comparing the YAML format with its original format, and I don't have the time or interest to organize the corresponding documentation for the time being.
The existing OpenFOAM tutorials in YAML format
Task List
The following is a task list to convert OpenFOAM-7 to the corresponding YAML format. The corresponding rules for conversion are not currently organized because some of them are still unstable. I will first try to convert as many tutorials as possible, and then organize the rules afterwards.
Conversion task list
- DNS
- dnsFoam
- boxTurb16
- dnsFoam
- IO
- fileHandler
- basic
- laplacianFoam
- flange
- potentialFoam
- cylinder
- pitzDaily
- scalarTransportFoam
- pitzDaily
- laplacianFoam
- combustion
- PDRFoam
- flamePropagationWithObstacles
- XiEngineFoam
- kivaTest
- XiFoam
- RAS
- moriyoshiHomogeneous
- RAS
- chemFoam
- gri
- h2
- ic8h18
- ic8h18_TDAC
- nc7h16
- coldEngineFoam
- freePiston
- fireFoam
- LES
- flameSpreadWaterSuppressionPanel
- oppositeBurningPanels
- smallPoolFire2D
- smallPoolFire3D
- LES
- reactingFoam
- RAS
- DLR_A_LTS
- SandiaD_LTS
- membrane
- laminar
- counterFlowFlame2D
- counterFlowFlame2DLTS
- counterFlowFlame2DLTS_GRI_TDAC
- counterFlowFlame2D_GRI
- counterFlowFlame2D_GRI_TDAC
- RAS
- PDRFoam
- compressible
- rhoCentralFoam
- LadenburgJet60psi
- biconic25-55Run35
- forwardStep
- movingCone
- obliqueShock
- shockTube
- wedge15Ma5
- rhoPimpleFoam
- LES
- pitzDaily
- RAS
- aerofoilNACA0012
- angledDuct
- angledDuctLTS
- annularThermalMixer
- cavity
- mixerVessel2D
- nacaAirfoil
- prism
- squareBendLiq
- laminar
- blockedChannel
- decompressionTank
- forwardStep
- helmholtzResonance
- shockTube
- LES
- rhoPorousSimpleFoam
- angledDuctExplicit
- angledDuctImplicit
- rhoSimpleFoam
- aerofoilNACA0012
- angledDuctExplicitFixedCoeff
- squareBend
- squareBendLiq
- rhoCentralFoam
- discreteMethods
- dsmcFoam
- freeSpacePeriodic
- freeSpaceStream
- supersonicCorner
- wedge15Ma5
- molecularDynamics
- mdEquilibrationFoam
- periodicCubeArgon
- periodicCubeWater
- mdFoam
- nanoNozzle
- mdEquilibrationFoam
- dsmcFoam
- electromagnetics
- electrostaticFoam
- chargedWire
- mhdFoam
- hartmann
- electrostaticFoam
- financial
- financialFoam
- europeanCall
- financialFoam
- heatTransfer
- buoyantPimpleFoam
- BernardCells
- hotRoom
- hotRoomBoussinesq
- buoyantSimpleFoam
- buoyantCavity
- circuitBoardCooling
- externalCoupledCavity
- hotRadiationRoom
- hotRadiationRoomFvDOM
- hotRoomBoussinesq
- iglooWithFridges
- chtMultiRegionFoam
- coolingSphere
- heatExchanger
- heatedDuct
- reverseBurner
- shellAndTubeHeatExchanger
- buoyantPimpleFoam
- incompressible
- SRFPimpleFoam
- rotor2D
- SRFSimpleFoam
- mixer
- adjointShapeOptimizationFoam
- pitzDaily
- boundaryFoam
- boundaryLaunderSharma
- boundaryWallFunctions
- boundaryWallFunctionsProfile
- icoFoam
- cavity
- cavity
- cavityClipped
- cavityGrade
- elbow
- cavity
- nonNewtonianIcoFoam
- offsetCylinder
- pimpleFoam
- LES
- channel395
- RAS
- TJunction
- TJunctionFan
- elipsekkLOmega
- impeller
- oscillatingInletACMI2D
- pitzDaily
- pitzDailyLTS
- propeller
- wingMotion
- laminar
- blockedChannel
- mixerVesselAMI2D
- movingCone
- offsetCylinder
- planarContraction
- planarCouette
- planarPoiseuille
- LES
- pisoFoam
- LES
- motorBike
- pitzDaily
- pitzDailyMapped
- RAS
- cavity
- cavityCoupledU
- laminar
- porousBlockage
- LES
- porousSimpleFoam
- angledDuctExplicit
- angledDuctImplicit
- straightDuctImplicit
- shallowWaterFoam
- squareBump
- simpleFoam
- T3A
- airFoil2D
- mixerVessel2D
- motorBike
- pipeCyclic
- pitzDaily
- pitzDailyExptInlet
- rotorDisk
- turbineSiting
- windAroundBuildings
- SRFPimpleFoam
- lagrangian
- DPMFoam
- Goldschmidt
- MPPICFoam
- Goldschmidt
- column
- cyclone
- injectionChannel
- coalChemistryFoam
- simplifiedSiwek
- icoUncoupledKinematicParcelFoam
- hopper
- hopperEmptying
- hopperInitialState
- mixerVesselAMI2D
- hopper
- reactingParcelFoam
- counterFlowFlame2DLTS
- cylinder
- filter
- hotBoxes
- parcelInBox
- rivuletPanel
- splashPanel
- verticalChannel
- verticalChannelLTS
- simpleReactingParcelFoam
- verticalChannel
- sprayFoam
- aachenBomb
- DPMFoam
- mesh
- blockMesh
- pipe
- sphere
- sphere7
- sphere7ProjectedEdges
- foamyHexMesh
- blob
- flange
- mixerVessel
- simpleShapes
- straightDuctImplicit → ../../incompressible/porousSimpleFoam/straightDuctImplicit
- foamyQuadMesh
- jaggedBoundary
- square
- moveDynamicMesh
- SnakeRiverCanyon
- refineMesh
- refineFieldDirs
- snappyHexMesh
- flange
- iglooWithFridges → ../../heatTransfer/buoyantSimpleFoam/iglooWithFridges
- motorBike → ../../incompressible/simpleFoam/motorBike
- blockMesh
- multiphase
- cavitatingFoam
- LES
- throttle
- throttle3D
- RAS
- throttle
- LES
- compressibleInterFoam
- laminar
- climbingRod
- depthCharge2D
- depthCharge3D
- sloshingTank2D
- laminar
- compressibleMultiphaseInterFoam
- laminar
- damBreak4phase
- laminar
- driftFluxFoam
- RAS
- dahl
- mixerVessel2D
- tank3D
- RAS
- interFoam
- LES
- nozzleFlow2D
- RAS
- DTCHull
- DTCHullMoving
- DTCHullWave
- angledDuct
- damBreak
- damBreakPorousBaffle
- floatingObject
- mixerVesselAMI
- waterChannel
- weirOverflow
- laminar
- capillaryRise
- damBreak
- damBreakWithObstacle
- mixerVessel2D
- sloshingCylinder
- sloshingTank2D
- sloshingTank2D3DoF
- sloshingTank3D
- sloshingTank3D3DoF
- sloshingTank3D6DoF
- testTubeMixer
- wave
- LES
- interMixingFoam
- laminar
- damBreak
- laminar
- interPhaseChangeFoam
- cavitatingBullet
- propeller
- multiphaseEulerFoam
- bubbleColumn
- damBreak4phase
- damBreak4phaseFine
- mixerVessel2D
- multiphaseInterFoam
- laminar
- damBreak4phase
- damBreak4phaseFine
- mixerVessel2D
- laminar
- potentialFreeSurfaceFoam
- movingOscillatingBox
- oscillatingBox
- reactingMultiphaseEulerFoam
- RAS
- wallBoiling1D_2phase
- wallBoiling1D_3phase
- laminar
- bed
- bubbleColumn
- bubbleColumnFixedPolydisperse
- bubbleColumnPolydisperse
- mixerVessel2D
- trickleBed
- RAS
- reactingTwoPhaseEulerFoam
- LES
- bubbleColumn
- RAS
- LBend
- bubbleColumn
- bubbleColumnEvaporatingReacting
- bubbleColumnPolydisperse
- fluidisedBed
- wallBoiling
- wallBoiling1D
- wallBoilingIATE
- wallBoilingPolyDisperse
- laminar
- bubbleColumn
- bubbleColumnEvaporating
- bubbleColumnEvaporatingDissolving
- bubbleColumnIATE
- fluidisedBed
- injection
- mixerVessel2D
- steamInjection
- LES
- twoLiquidMixingFoam
- lockExchange
- twoPhaseEulerFoam
- LES
- bubbleColumn
- RAS
- bubbleColumn
- fluidisedBed
- laminar
- bubbleColumn
- bubbleColumnIATE
- fluidisedBed
- injection
- mixerVessel2D
- LES
- cavitatingFoam
- resources
- geometry
- stressAnalysis
- solidDisplacementFoam
- plateHole
- solidEquilibriumDisplacementFoam
- beamEndLoad
- solidDisplacementFoam
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repository and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the GPL-3.0 License. See LICENSE.txt
for more information.
Contact
Iydon Liang - @iydon - liangiydon_AT_gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.