Update on the development of the OpenFOAM CFD workbench (CFDOF)

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

User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

HoWil wrote: Sat Sep 02, 2017 5:19 pm
oliveroxtoby wrote: Fri Sep 01, 2017 4:06 pm Found the error - my bad! It should be working now with your normal settings, I hope.
Thanks for reporting the issue.
Hi Oliver,
can you please explain in more detail what kind of error you corrected. There is a similar problem with the material dialogue in fem-wb (see https://forum.freecadweb.org/viewtopic. ... 3e#p187725) and I am sure your infos could help here ;) .
Thanks in advance,
HoWil
Hi HoWil

So the problem was that we were setting the value into the input box as a string in the 'C' locale (I think - the default way that python prints it) whereas the input box needs to interpret it in the user's locale. You *do* want to store quantities in the C locale in the material database in order to have a canonical storage format, but before entering it into the text box it needs to be converted to the user's locale. I had some problems using python's locale.str() function for this, as it doesn't seems to have the same interpretation of language versus input locale as FreeCAD. Thus I used the Quantity.UserString function to achieve the same effect. So for example where you set the density at https://github.com/FreeCAD/FreeCAD/blob ... al.py#L364
I think you could rather do
q = FreeCAD.Units.Quantity("{} {}".format(density_with_new_unit, density_new_unit))
self.form.input_fd_density.setText(q.UserString)

Hope that helps!
Please provide all the information requested in this post before reporting problems with CfdOF.
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

thschrader wrote: Sat Sep 02, 2017 8:18 pm
oliveroxtoby wrote: Fri Sep 01, 2017 9:08 am We probably don't have the spare time or funding to implement this any time soon, so editing case dictionaries is the best bet. You would want the 'forces' function object, see the OpenFOAM user guide - https://cfd.direct/openfoam/user-guide/ ... 390006.2.2 - and the template you would need to use can be copied from <OpenFOAM directory>/etc/caseDicts/postProcessing/forces/forcesIncompressible

Of course, if anyone wants to add this functionality to the workbench, that would be great.
No need :)
You can calculte the resulting forces in paraview by projecting/integrating the pressure field along
the x,y,z-Axes. I have stolen the idea from this guy:
https://www.youtube.com/watch?v=J944HOj_4b0
Good point - that should be much more straightforward.
Please provide all the information requested in this post before reporting problems with CfdOF.
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

thschrader wrote: Sun Sep 03, 2017 10:53 am @oliveroxtoby
Here is a little info about a calculation I have done.
The pic above (cylinder in channel) is a test case. The channel is 6 m long, 2 m high and 100 mm "thick".

Theory:
Diameter cylinder is D=400 mm. Fluid is water with rho=1000 kg/m^3, inlet speed 1,5 m/s.
This gives a pressure of q=1085 N/m^2, Re=5,9*10^5 ==> drag-coeff=0,8 according to DIN4131.
The resulting force on an infinite long cylinder is F=cf*D*q=348 N/m.

openfoam-result, see spreadsheet in paraview pic:
the resulting drag-force on the 10 cm long simulation-cylinder is 35,3 N, so for a 1m part it is 353 N!
I think that is a perfect matching!

(btw: as far as I understood the input-files, openfoam caculates a "normalized" pressure field,
p_openfoam=p_real/density.
So to get the real pressure, you must multiply the calculated field with fluid-density. OK?)
Nice to hear! OpenFOAM is a very mature toolset by now. Yes, the incompressible solvers use kinematic pressure - can be a real gotcha if you forget!
Please provide all the information requested in this post before reporting problems with CfdOF.
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by HoWil »

oliveroxtoby wrote: Mon Sep 04, 2017 10:26 am Hope that helps!
For sure it will! ;) Thx a lot.
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by thschrader »

oliveroxtoby wrote: Mon Sep 04, 2017 10:33 am Nice to hear! OpenFOAM is a very mature toolset by now.
This is a wish to get the cfd-wb more mature... :)
Is it possible to put an additional button "checkmesh" into the analysis-control dialog
to use the "checkMesh" command from openFOAM? For windows users like me it is only possible
to use this by activating the bluecfd-core console as a standalone. The pic is a checkMesh from
the GMSH-generated mesh I used for the "cylinder in channel" calculation above. In the openFOAM
tutorials I have seen so far on YT all guys tell you that the "checkMesh" should be done.
regards Thomas
checkMesh_command.JPG
checkMesh_command.JPG (146.97 KiB) Viewed 3682 times
Worufu
Posts: 41
Joined: Wed Jan 13, 2016 10:44 am
Location: Italy

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by Worufu »

Hi guys, I've a problem with the MeshRegion.

When I try to open the MeshRegion dialog, FreeCAD returns this error and I can't go further. Dependecies checker says that all dependencies is installed. I try with FEM mesh generator mesh region, but sometimes openfoam returns errors (unable to find "points", etc...).
Am I missing something or the feature is under w.i.p.?
Thanks ;)
Meshregion.png
Meshregion.png (82.69 KiB) Viewed 3634 times

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11967 (Git)
Build type: Release
Branch: master
Hash: d0c5865f323aa9555662912f2ff96188f29096a6
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: Italian/Italy (it_IT)
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

Worufu wrote: Fri Sep 08, 2017 2:21 pm Hi guys, I've a problem with the MeshRegion.

When I try to open the MeshRegion dialog, FreeCAD returns this error and I can't go further. Dependecies checker says that all dependencies is installed. I try with FEM mesh generator mesh region, but sometimes openfoam returns errors (unable to find "points", etc...).
Am I missing something or the feature is under w.i.p.?
Thanks ;)
That was a bug - somehow the gmsh regions got lost when we added the cartesian mesh functionality. I've added it back; seems to be working now. Thanks for reporting.
Please provide all the information requested in this post before reporting problems with CfdOF.
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

thschrader wrote: Thu Sep 07, 2017 4:24 pm
oliveroxtoby wrote: Mon Sep 04, 2017 10:33 am Nice to hear! OpenFOAM is a very mature toolset by now.
This is a wish to get the cfd-wb more mature... :)
Is it possible to put an additional button "checkmesh" into the analysis-control dialog
to use the "checkMesh" command from openFOAM? For windows users like me it is only possible
to use this by activating the bluecfd-core console as a standalone. The pic is a checkMesh from
the GMSH-generated mesh I used for the "cylinder in channel" calculation above. In the openFOAM
tutorials I have seen so far on YT all guys tell you that the "checkMesh" should be done.
regards Thomas
checkMesh_command.JPG
Yup, this has been on our list for a while. You should be able to add it quite easily by calling startFoamApplication in CfdTools.py - I think it will handle running and printing output to the report view automatically.
Please provide all the information requested in this post before reporting problems with CfdOF.
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by thschrader »

Here is a little example, that you can do free-surface flow simulation using the
cfd-wb. It is a modified case of the tutorial from
https://www.youtube.com/watch?v=gZ_TqsPwiXY

Design the geometry and the cfd-case in FC, run the simpleFoam-solver to get all necessary files.
Delete all results, overwrite the p/U/alpha.water/fvschemes/fvsolutions/controldict/setFieldsdict with
the files (slightly modified) from the interFoam/dam-break tutorial and activate the bluecfdcore-console.
Set the alpha.water field an run interFoam. The used mesh is very coarse, my goal was to get
the stuff running...
FC_snappyhexMesh.JPG
FC_snappyhexMesh.JPG (45.81 KiB) Viewed 3541 times
init_aplhaWater_field.JPG
init_aplhaWater_field.JPG (33.54 KiB) Viewed 3541 times
runtime.JPG
runtime.JPG (105.85 KiB) Viewed 3541 times
ship1.JPG
ship1.JPG (23.43 KiB) Viewed 3541 times
ship2.JPG
ship2.JPG (23.51 KiB) Viewed 3541 times
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Update on the development of the OpenFOAM CFD workbench (CFDOF)

Post by oliveroxtoby »

thschrader wrote: Sun Oct 01, 2017 2:18 pm Here is a little example, that you can do free-surface flow simulation using the
cfd-wb. It is a modified case of the tutorial from
https://www.youtube.com/watch?v=gZ_TqsPwiXY

Design the geometry and the cfd-case in FC, run the simpleFoam-solver to get all necessary files.
Delete all results, overwrite the p/U/alpha.water/fvschemes/fvsolutions/controldict/setFieldsdict with
the files (slightly modified) from the interFoam/dam-break tutorial and activate the bluecfdcore-console.
Set the alpha.water field an run interFoam. The used mesh is very coarse, my goal was to get
the stuff running...
Hi Thomas, thanks for the example. Please note that the CfdOF workbench actually supports free-surface with interFoam (and multiphaseInterFoam) right out of the box (made possible by a contribution from Klaus Sembritzki) - so there should be no need to overwrite dictionaries manually. If you add multiple fluid materials, then provided you choose a transient, incompressible analysis type in the physics task panel, interFoam or multiphaseInterFoam (for more than two fluids) will be used automatically. Field initialisation zones can be used to select the initial fluid volume fractions. At present gravity is restricted to -9.81 m/s^2 in the y direction and there is no surface tension (unless the case files are manually edited, of course).
Please provide all the information requested in this post before reporting problems with CfdOF.
Post Reply