Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

### status

Team of CSIR South Africa, 2016 has forked my CFD repo https://github.com/qingfengxia/Cfd ,into CfdFoam workbench, see https://github.com/jaheyns/CfdFoam, focusing on OpenFOAM and usability.
see their progress on post: Computational Fluid Dynamics (CFD) workbench using OpenFOAM https://forum.freecadweb.org/viewtopic.php?f=18&t=21576

Recent work in Fem has broken Cfd workbench, I am fixing this now.

### I will carry on commit the original CFD repo, https://github.com/qingfengxia/Cfd I will try to:

* add more CFD solvers other than OpenFOAM, like Fenics.
I will work only on solvers without a free GUI preprocessor to help new user to get started. With ultimate goal of multiphysics modeling using Fem and Cfd workbench.

* infrastructure shared by CFD solvers and FEM solvers.

I will commit some features directly into FEM workbench, to share the code extensively. I will work only on solvers without a free GUI preprocessor to help new user to get started. I will also notice new features usable to CfdFoam.

* incorporate some features developed by CfdFOAM team

recently, I will not develop new feature on OpenFOAM, but bugfix and develop testing case

* develop my own CFD solver based on Fenics, especially for 2D case https://github.com/qingfengxia/FenicsSolver

### After next release of FreeCAD, this CFD workbench will stick to stable FEM API.

This Cfd workbench tries to share Fem module as large as possible (meshing, boundary condition, material), thereby, progress of FemWorkbench can easily break this workbench. I will check regularly on Fem module to maintain compatible. I will develop some example file, if you find it is outdated, please let me know by private message or email me directly.

Currently, I found I can not install both Cfd and CfdFoam workbenches. Actually, case files developed in each workbench is not compatible. So install the CfdFOAM before release of next version of FreeCAD, I will fix broken names in Cfd.

### Readme and roadmap

https://github.com/qingfengxia/Cfd/blob ... Roadmap.md will be updated directly to https://github.com/qingfengxia/Cfd. I will reply this post to alert new feature.


### developer manual, please help

Finally but not the least, please also contribute/keep-alive this FreeCAD related project.

https://github.com/qingfengxia/FreeCAD_Mod_Dev_Guide

a gitbook "Module developer's guide to FreeCAD 's source code ", to help new developer to code, in particularly Fem and Cfd workbenches.
it is a by-product of my CFD workbench, recording some note and process to develop this workbench. I am trying to provide some overview of FreeCAD source code. As FreeCAD evolves very fast, code snippets get out-dated quickly.

I have been tangled by my family liability and research responsibility as a contracted postdoc researcher. My recent commit to those 2 projects have been slowing down. without community's help, those project will not reach a beta version soon.

Thanks
Last edited by qingfeng.xia on Sun Nov 19, 2017 11:28 pm, edited 6 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
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

New Features planned in 2017 (will be updated regularly)

1. gmsh boundary layer (accepted by master)
2. mapplotlib plot residual in addition to gnuplot
3. turbulence flow (Foam only, done Oct 2017)
4. 2D mesh export (Fenics Solver only)
5. fenics CFD solver (incompresible laminar flow only 2D and 3D)

2018
1. cfMesh function manually merged from Joha2's fork
2. python3 support
3. multi-region meshing, preparation for multi-physics coupling
Last edited by qingfeng.xia on Sun Nov 19, 2017 11:31 pm, edited 2 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
Worufu
Posts: 41
Joined: Wed Jan 13, 2016 10:44 am
Location: Italy

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by Worufu »

Your and CSIR work is amazing, a very great part that characterize Freecad. I hope you can find time to continue the developing. I find this workbench very useful and the integration in the Fem WB is the right way, also the capability to use the internal post processing tools. I hope to help you and CSIR as tester for now, but I really want to help in coding a day.
Don't lost the belief in this project, despite the low access in this forum, the voice of your work is growing in the underground ;)
wafi
Posts: 82
Joined: Sat Oct 15, 2016 8:45 am

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by wafi »

I agree with Worufu, but I have a problem to install both workbenches parallel due using same parameter in the installation path of preferences.
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

Sep 04, Further coding for FemConstraintFluidBoundary

Previously, only 3D case is supported by OpenFOAM solver, now 2D Fenics solver is nearly finished. Selecting of Edges as boundary for 2D case is enabled.

Also, thermal and turbulence UI, previously just for UI design review, is now fully functional.
FreeCAD FluidBoundary setting for 2D case.png
FreeCAD FluidBoundary setting for 2D case.png (229.74 KiB) Viewed 6205 times
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
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

Gmsh mesh with a boundary layer support has been merge into master, boundary layer is essential for turbulent flow simulation

see the forum post
https://forum.freecadweb.org/viewtopic.php?f=18&t=22968
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
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

Recently, I tested Gmsh3, it iseems the boundary layer setup for 3D mesh has changed.
FacesList option is gon, It could be a bug in the future

=====================================
BoundaryLayer
hwall * ratio^(dist/hwall)
Options:
AnisoMax
Threshold angle for creating a mesh fan in the boundary layer
type: float
default value: 10000000000

EdgesList
Indices of curves in the geometric model for which a boundary layer is needed
type: list
default value: {}

FanNodesList
Indices of vertices in the geometric model for which a fan is created
type: list
default value: {}

IntersectMetrics
Intersect metrics of all faces
type: integer
default value: 0

NodesList
Indices of vertices in the geometric model for which a BL ends
type: list
default value: {}

Quads
Generate recombined elements in the boundary layer
type: integer
default value: 0

hfar
Element size far from the wall
type: float
default value: 1

hwall_n
Mesh Size Normal to the The Wall
type: float
default value: 0.1

hwall_n_nodes
Mesh Size Normal to the The Wall at nodes (overwrite hwall_n when defined)
type: list_double
default value: {}

ratio
Size Ratio Between Two Successive Layers
type: float
default value: 1.1

thickness
Maximal thickness of the boundary layer
type: float
default value: 0.01
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
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

qingfeng.xia wrote: Sun Jun 18, 2017 12:02 pm New Features planned in 2017 (will be updated regularly)

1. gmsh boundary layer
2. mapplotlib plot residual in addition to gnuplot
3. turbulence flow
4. 2D mesh export
5. fenics CFD solver
Initial commit to write 2D and 3D case for my FenincsSolver in Cfd Workbench.

Solver is not limited to CFD, but multi-physics, see my repo
https://github.com/qingfengxia/FenicsSolver

FenicsSolver_FreeCAD.png
FenicsSolver_FreeCAD.png (236.39 KiB) Viewed 5812 times

And can anyone teach me to make a 2D plane part, elbow, to test my code?
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
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by thschrader »

qingfeng.xia wrote: Sun Nov 19, 2017 11:20 pm And can anyone teach me to make a 2D plane part, elbow, to test my code?
Please see here:
https://opensimsa.github.io/training.html
regards Thomas
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Progress of the general Computational Fluid Dynamics (CFD) workbench: CfdWorkbench

Post by qingfeng.xia »

Thanks for pointing me to those useful tutorial, the Elbow case for OpenFOAM is still 3D mesh with only 1 layer in the third direction. From the tutorial, I can not see whether it is 2D or 3D?

For Fenics, I would need a pure 2D mesh. Any idea?

thschrader wrote: Mon Nov 20, 2017 12:33 pm
qingfeng.xia wrote: Sun Nov 19, 2017 11:20 pm And can anyone teach me to make a 2D plane part, elbow, to test my code?
Please see here:
https://opensimsa.github.io/training.html
regards Thomas
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
Post Reply