Test request: OpenFOAM solver for FemWorkbench
Moderator: oliveroxtoby
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
-
- Posts: 227
- Joined: Tue Sep 22, 2015 1:47 pm
- Location: Oxford UK/Shenzhen China
- Contact:
Test request: OpenFOAM solver for FemWorkbench
update: 25/12/2016, I back to forum and dev for a very very busy winter, I see some dev work on FluidMaterial and Gmsh from several devers
I hope contribution can be merge to my https://github.com/qingfengxia/Cfd.git repo, so open source strength is united.
I will upload my work on compressible and thermal solver , although it is not tested fully, to avoid duplicate work from other devers.
as branch of https://github.com/qingfengxia/Cfd.git
update: 01/10/2016: openfoam related code has been moved to a CFD module:
https://github.com/qingfengxia/Cfd
please `git clone https://github.com/qingfengxia/Cfd.git`
update: 16/09/2016 It is decided a new python module "Cfd" will be developed, depending on Fem. cpp code will be commit to Fem
===========collaboration strategy==========
Cfd is still under testing and dev, it will not be ready to be included into official in the next 6 m.
Currently route I can imagine:
CFD workbench new developers fork official FreeCAD and my Cfd githttps://github.com/qingfengxia/Cfd.git.
Cfd workbench depends on Fem for meshing and boundary(FemConstraint) and post-processing, most of them are coded in C++ so it is hard to split from Fem. If you need add feature on above, you branch FreeCAD official, not mime (but do let me know, pull request will only accepted if it is fully discussed on forum and reviewed by other dev like Bernd, me). see my ebook on how to pull request. Any other cfd python code, do pull request me (my Cfd.git) e.g. I developed vtk mesh and result import and export feature, git directly to official Fem workbench.
User can install freecad-daily, and git update/install Cfd.git so all got updated code without pain for installation.
============outdated, use https://github.com/qingfengxia/Cfd.git please ========
update on 05/09/2016: on a free install compilation both GUI and text tests passed on ubuntu 16.04 + openfoam4
one commit: bugfix for missing files and spelling errors in CMakelists.txt
To https://github.com/qingfengxia/FreeCAD.git
0af2a2a..eee073f foambuilder1 -> foambuilder1
============end of outdated ==================
## Highlight for this initial pull:
1. Python code to run a basic laminar flow simulation is added
2. An independent python module, FoamCaseBuilder (LGPL), can work with and without FreeCAD to build up case for OpenFOAM
3. A general FemSolverControlTaskPanel is proposed for any FemSolver.
Code under Fem folder pass flake8 test, but FoamCaseBuilder is checked due to time limitation.
Code should be merged into master asap, to move to next stage dev.
## Limitation:
1. only laminar flow with dedicate solver and boundary setup can converge, and I suspect the the current meshing tool, netgen is not ideal for CFD, which needs very thin layer near wall. Please download my 2 test file to evaluate for this stage.
2. result can only be viewed in paraview. but possible to export result to VTK format then load back to FreeCAD. (it is implemented in Oct 2016)
======================
## updated test procedure for Cfd module Dec 25, 2016
======================
To test: you need to install several GPL software to run the test, There are 2 files can be downloaded ro quickly test the function
see details
https://github.com/qingfengxia/Cfd/tree ... aseBuilder
You may need to run the TestBuilder.py twice to get case built, reason maybe file download is not finished though runFoamCommand is a block operation.
https://www.iesensor.com/download/TestCase.unv and must be put into folder of FoamCaseBuilder/
Test FoamCaseBuilder module without FreeCAD: "python pathto/FoamCaseBuilder/TestBulderer.py"
Test with FreeCAD by download: https://www.iesensor.com/download/TestFoam.fcstd, this file may outdated!!!
more procedure could be found at https://github.com/qingfengxia/Cfd/tree/master/
to test this fork, you need to start FreeCAD in gmome-terminal, not from window manager! in order to source all env var in ~/bashrc
you need to run the case in console terminal, because it takes too long to converge, it is not a good idea to wait in FreeCAD GUI.
## Roadmap for OpenFOAM
https://github.com/qingfengxia/Cfd/blob ... Roadmap.md
I hope contribution can be merge to my https://github.com/qingfengxia/Cfd.git repo, so open source strength is united.
I will upload my work on compressible and thermal solver , although it is not tested fully, to avoid duplicate work from other devers.
as branch of https://github.com/qingfengxia/Cfd.git
update: 01/10/2016: openfoam related code has been moved to a CFD module:
https://github.com/qingfengxia/Cfd
please `git clone https://github.com/qingfengxia/Cfd.git`
update: 16/09/2016 It is decided a new python module "Cfd" will be developed, depending on Fem. cpp code will be commit to Fem
===========collaboration strategy==========
Cfd is still under testing and dev, it will not be ready to be included into official in the next 6 m.
Currently route I can imagine:
CFD workbench new developers fork official FreeCAD and my Cfd githttps://github.com/qingfengxia/Cfd.git.
Cfd workbench depends on Fem for meshing and boundary(FemConstraint) and post-processing, most of them are coded in C++ so it is hard to split from Fem. If you need add feature on above, you branch FreeCAD official, not mime (but do let me know, pull request will only accepted if it is fully discussed on forum and reviewed by other dev like Bernd, me). see my ebook on how to pull request. Any other cfd python code, do pull request me (my Cfd.git) e.g. I developed vtk mesh and result import and export feature, git directly to official Fem workbench.
User can install freecad-daily, and git update/install Cfd.git so all got updated code without pain for installation.
============outdated, use https://github.com/qingfengxia/Cfd.git please ========
update on 05/09/2016: on a free install compilation both GUI and text tests passed on ubuntu 16.04 + openfoam4
one commit: bugfix for missing files and spelling errors in CMakelists.txt
To https://github.com/qingfengxia/FreeCAD.git
0af2a2a..eee073f foambuilder1 -> foambuilder1
============end of outdated ==================
## Highlight for this initial pull:
1. Python code to run a basic laminar flow simulation is added
2. An independent python module, FoamCaseBuilder (LGPL), can work with and without FreeCAD to build up case for OpenFOAM
3. A general FemSolverControlTaskPanel is proposed for any FemSolver.
Code under Fem folder pass flake8 test, but FoamCaseBuilder is checked due to time limitation.
Code should be merged into master asap, to move to next stage dev.
## Limitation:
1. only laminar flow with dedicate solver and boundary setup can converge, and I suspect the the current meshing tool, netgen is not ideal for CFD, which needs very thin layer near wall. Please download my 2 test file to evaluate for this stage.
2. result can only be viewed in paraview. but possible to export result to VTK format then load back to FreeCAD. (it is implemented in Oct 2016)
======================
## updated test procedure for Cfd module Dec 25, 2016
======================
To test: you need to install several GPL software to run the test, There are 2 files can be downloaded ro quickly test the function
see details
https://github.com/qingfengxia/Cfd/tree ... aseBuilder
You may need to run the TestBuilder.py twice to get case built, reason maybe file download is not finished though runFoamCommand is a block operation.
https://www.iesensor.com/download/TestCase.unv and must be put into folder of FoamCaseBuilder/
Test FoamCaseBuilder module without FreeCAD: "python pathto/FoamCaseBuilder/TestBulderer.py"
Test with FreeCAD by download: https://www.iesensor.com/download/TestFoam.fcstd, this file may outdated!!!
more procedure could be found at https://github.com/qingfengxia/Cfd/tree/master/
to test this fork, you need to start FreeCAD in gmome-terminal, not from window manager! in order to source all env var in ~/bashrc
you need to run the case in console terminal, because it takes too long to converge, it is not a good idea to wait in FreeCAD GUI.
## Roadmap for OpenFOAM
https://github.com/qingfengxia/Cfd/blob ... Roadmap.md
Last edited by qingfeng.xia on Tue Dec 27, 2016 1:39 pm, edited 13 times in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Re: Test request: OpenFOAM solver for FemWorkbench
Hi qingfeng
I have been looking forward to testing this
http://openfoamwiki.net/index.php/Polyh ... generation
By using polyhedral s as default will increase open-foam accuracy
I have been looking forward to testing this
Do you know this function in foam before you start coding the result import in Freecad.I suspect the the current meshing tool, netgen is not ideal for CFD
http://openfoamwiki.net/index.php/Polyh ... generation
By using polyhedral s as default will increase open-foam accuracy
Re: Test request: OpenFOAM solver for FemWorkbench
Which branch? Thins one: https://github.com/qingfengxia/FreeCAD/ ... ambuilder1
Re: Test request: OpenFOAM solver for FemWorkbench
Yes. OpenFOAM has its own system of meshing. Maybe it would be a better strategy to use it, like other programs that works as graphical interface of OpenFOAM:makkemal wrote:Hi qingfeng
I have been looking forward to testing thisDo you know this function in foam before you start coding the result import in Freecad.I suspect the the current meshing tool, netgen is not ideal for CFD
http://openfoamwiki.net/index.php/Polyh ... generation
By using polyhedral s as default will increase open-foam accuracy
https://www.ods-engineering.com/tools/o ... /download/
http://engys.com/products/helyx-os
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)
Canal Youtube Grupo Telegram de FreeCAD Español
My personal web site
My GitHub repository
Mini Airflow Tunnel Project
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)
Canal Youtube Grupo Telegram de FreeCAD Español
My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Re: Test request: OpenFOAM solver for FemWorkbench
https://github.com/qingfengxia/FreeCAD/ ... ambuilder1
On this branch I get it compiled but get this error when starting the FEM workbench.
??
On this branch I get it compiled but get this error when starting the FEM workbench.
Code: Select all
No module named _CommandSolverFoam
Re: Test request: OpenFOAM solver for FemWorkbench
Same here.makkemal wrote:https://github.com/qingfengxia/FreeCAD/ ... ambuilder1
On this branch I get it compiled but get this error when starting the FEM workbench.??Code: Select all
No module named _CommandSolverFoam
I assme this is because the modules where only added to src/Mod/Fem/CMakeLists.txt ( https://github.com/qingfengxia/FreeCAD/ ... ts.txt#L84 ) and not to src/Mod/Fem/App/CMakeLists.txt ( https://github.com/qingfengxia/FreeCAD/ ... ts.txt#L73 ) They need to be added to both CMakes.
bernd
-
- Posts: 227
- Joined: Tue Sep 22, 2015 1:47 pm
- Location: Oxford UK/Shenzhen China
- Contact:
Re: Test request: OpenFOAM solver for FemWorkbench
Sorry, Guys, there are bugs in my Fem/App/CMakeList.txt, and spelling error in Fem/Cmakelist.txt, as you have pointed out. I forget to install file list here. I tested it without installation, it always makes some inconvenience for tester.
It will be soon fixed today. I got error in fresh pc rebuild. cmake , MedFile,
to fix it: Fem/Cmakelists.txt FoamCasebuilder -> FoamCaseBuilder
copy the file list to App/Cmakelists.txt. it should fixed.
It will be soon fixed today. I got error in fresh pc rebuild. cmake , MedFile,
to fix it: Fem/Cmakelists.txt FoamCasebuilder -> FoamCaseBuilder
copy the file list to App/Cmakelists.txt. it should fixed.
bernd wrote:Same here.makkemal wrote:https://github.com/qingfengxia/FreeCAD/ ... ambuilder1
On this branch I get it compiled but get this error when starting the FEM workbench.??Code: Select all
No module named _CommandSolverFoam
I assme this is because the modules where only added to src/Mod/Fem/CMakeLists.txt ( https://github.com/qingfengxia/FreeCAD/ ... ts.txt#L84 ) and not to src/Mod/Fem/App/CMakeLists.txt ( https://github.com/qingfengxia/FreeCAD/ ... ts.txt#L73 ) They need to be added to both CMakes.
bernd
Last edited by qingfeng.xia on Mon Sep 05, 2016 12:31 pm, edited 1 time in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Re: Test request: OpenFOAM solver for FemWorkbench
You may rebase on master (you are a 160 commits behind). Your branch rebases on FreeCAD master without any problems.qingfeng.xia wrote:Sorry, Guys, there are bugs in my Fem/App/CMakeList.txt, and spelling error in Fem/Cmakelist.txt, as you have pointed out. I forget to install file list here. I tested it without installation, it always makes some inconvenience for tester.
It will be soon fixed today.
Re: Test request: OpenFOAM solver for FemWorkbench
I can compile and start the workbench now, however I cannot add a Openfoam solver to Freecad.
If I load the test file you provided the openfoam solver cannot be opened ?
Ubuntu 16.04
Openfoam 4
PyFoam installed
If I load the test file you provided the openfoam solver cannot be opened ?
Code: Select all
Traceback (most recent call last):
File "/home/makke/freecad/Mod/Fem/CfdSolverFoam.py", line 34, in <module>
import CfdSolver
File "/home/makke/freecad/Mod/Fem/CfdSolver.py", line 31, in <module>
from FoamCaseBuilder import supported_turbulence_models
File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/__init__.py", line 27, in <module>
from .utility import *
File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/utility.py", line 80, in <module>
_FOAM_SETTINGS = {"FOAM_DIR": _detectFoamDir(), "FOAM_VERSION": _detectFoamVersion()}
File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/utility.py", line 74, in _detectFoamVersion
return tuple([int(s) for s in foam_ver.split('.')])
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''
Openfoam 4
PyFoam installed
Code: Select all
makke@ubuntu:~$ simpleFoam -help
Usage: simpleFoam [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-noFunctionObjects
do not execute functionObjects
-parallel run in parallel
-postProcess Execute functionObjects only
-roots <(dir1 .. dirN)>
slave root directories for distributed running
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage
Using: OpenFOAM-4.0 (see www.OpenFOAM.org)
Build: 4.0-665f1db4c1f1
-
- Posts: 227
- Joined: Tue Sep 22, 2015 1:47 pm
- Location: Oxford UK/Shenzhen China
- Contact:
Re: Test request: OpenFOAM solver for FemWorkbench
Thanks very much for your testing.makkemal wrote:I can compile and start the workbench now, however I cannot add a Openfoam solver to Freecad.
If I load the test file you provided the openfoam solver cannot be opened ?
Ubuntu 16.04Code: Select all
Traceback (most recent call last): File "/home/makke/freecad/Mod/Fem/CfdSolverFoam.py", line 34, in <module> import CfdSolver File "/home/makke/freecad/Mod/Fem/CfdSolver.py", line 31, in <module> from FoamCaseBuilder import supported_turbulence_models File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/__init__.py", line 27, in <module> from .utility import * File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/utility.py", line 80, in <module> _FOAM_SETTINGS = {"FOAM_DIR": _detectFoamDir(), "FOAM_VERSION": _detectFoamVersion()} File "/home/makke/freecad/Mod/Fem/FoamCaseBuilder/utility.py", line 74, in _detectFoamVersion return tuple([int(s) for s in foam_ver.split('.')]) <type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''
Openfoam 4
PyFoam installed
It seems you got OF installed correctly, please try: bash -i -c "echo $WM_PROJECT_VERSION" in your terminal.
also you can open utilty file and define _detectFoamVerson(): to single line just `return _DEFAULT_FOAM_VERSION`, to carrry on the testing.
Code: Select all
def _detectFoamVersion():
#foam_ver = subprocess.check_output('bash -i -c "echo $WM_PROJECT_VERSION"')
return _DEFAULT_FOAM_VERSION
This is the original code:
Code: Select all
def _detectFoamVersion():
#foam_ver = subprocess.check_output('bash -i -c "echo $WM_PROJECT_VERSION"')
proc = subprocess.Popen('bash -i -c "echo $WM_PROJECT_VERSION"', stdout=subprocess.PIPE, shell=True)
(foam_ver, err) = proc.communicate()
if foam_ver:
return tuple([int(s) for s in foam_ver.split('.')])
else:
print("""environment var 'WM_PROJECT_VERSION' is not defined\n,
fallback to default {}""".format(_DEFAULT_FOAM_VERSION))
return _DEFAULT_FOAM_VERSION
an try and expect could be used, maybe
Last edited by qingfeng.xia on Tue Sep 06, 2016 11:56 am, edited 1 time in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd