Cross section river profiles

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Cross section river profiles

Post by microelly2 »

Kunda1 wrote: Tue Jan 09, 2018 8:09 pm @thschader for posterity, do you mind leaving a step-by-step instruction of how you achieved this thing of awesomeness?
yes, it would be nice to be able to do this simulations.
thschrader
Veteran
Posts: 3157
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Cross section river profiles

Post by thschrader »

microelly2 wrote: Tue Jan 09, 2018 8:32 pm
Kunda1 wrote: Tue Jan 09, 2018 8:09 pm @thschader for posterity, do you mind leaving a step-by-step instruction of how you achieved this thing of awesomeness?
yes, it would be nice to be able to do this simulations.
Ok, here is a short description.
Geometry:
I used chakkrees macro to import the csv-Data (the profiles) posted by canislupus.
Then connected the profiles with Dwire and loft them. Thats the riverbed. file:
riverbed.FCStd
(219.44 KiB) Downloaded 59 times
Simulation:
To construct the flow-channel I used a cube (red), from which I subtracted the
riverbed-body. The remaining shape (green) is the flow channel with the riverbed-profile
at the bottom. This body was used for meshing/simulating with the cfd-of-wb (openfoam).
mesher: cfmesh
solver: interfoam, 2-phase water/air
blue: inlet, red: outlet, violet cube: initialization-zone (here starts the water)
total simulation-time 10 sec, timestep 0,01 sec, output every 0,1 sec ==> 100 timesteps for animation
runtime simulation 4 hours on my laptop.
Animation:
After finishing the simulation you can import the results in paraview and start the animation.
The animation can be saved as vtk-files. I imported the first 20 vtk-files in FC and used a macro
from the user gift, to make the mesh moving.
https://forum.freecadweb.org/viewtopic.php?f=13&t=26107
The model tree looks a little bit weird, because I played with the geometry
geometry.JPG
geometry.JPG (136.84 KiB) Viewed 2355 times
flowchannel1.JPG
flowchannel1.JPG (110.14 KiB) Viewed 2355 times
flowchannel2.JPG
flowchannel2.JPG (111.96 KiB) Viewed 2355 times
animation.JPG
animation.JPG (144 KiB) Viewed 2355 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Cross section river profiles

Post by Kunda1 »

:shock: :shock: :shock: :shock: 8-)
That's a lot of work
thschrader wrote: Tue Jan 09, 2018 11:00 pm runtime simulation 4 hours on my laptop.
...Yikes, a lot of time for such a short animation. Granted I have no FEA experience and elementarily grasp that there ALOT of number crunching going on. Is there a way to make all this more seamless (besides fidgeting with the model). Meaning can the animation script be made seamless?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
thschrader
Veteran
Posts: 3157
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Cross section river profiles

Post by thschrader »

Kunda1 wrote: Tue Jan 09, 2018 11:48 pm :shock: :shock: :shock: :shock: 8-)
That's a lot of work
thschrader wrote: Tue Jan 09, 2018 11:00 pm runtime simulation 4 hours on my laptop.
...Yikes, a lot of time for such a short animation. Granted I have no FEA experience and elementarily grasp that there ALOT of number crunching going on. Is there a way to make all this more seamless (besides fidgeting with the model). Meaning can the animation script be made seamless?
For a seamless animation you have several options:
Increase the number of FEM-cells (finer mesh). Use a shorter time-step. As far as I know you
need a minimum of 30 frame-rates to see a seamless motion (lets say on TV). In this simulation every
0,1 sec a result was plotted. So the frame rate is to low (10 frames per second).
Using a finer mesh is difficult, please have a look at the video. The guy used 216000 cells and a time-step
of only 0,0001 sec! That gave a courant number of 0,4, and that is the critical parameter.
In timestep-calculations the fluid-particle must remain in one FEM-cell during one timestep, the courant-number
is <1. If the fluid-particle passes more than one cell (courant-number >1), the openfoam-solver stops with
error. So: if you refine the mesh you must parallel use a shorter timestep, which boosts the calculation-time.
https://www.youtube.com/watch?v=7qRW4v_0cSw
https://en.wikipedia.org/wiki/Courant%E ... _condition
https://www.cfd-online.com/Forums/openf ... umber.html
Or I must edit the macro from gift (which is pretty short) to get a faster run through the vtks.
But i have no python skills... ;)
simulation_macro.JPG
simulation_macro.JPG (75.59 KiB) Viewed 2338 times
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Cross section river profiles

Post by oliveroxtoby »

Really nice to see CfdOF being put through its paces for free-surface flow :-)
thschrader wrote: Wed Jan 10, 2018 12:37 am Using a finer mesh is difficult, please have a look at the video. The guy used 216000 cells and a time-step
of only 0,0001 sec! That gave a courant number of 0,4, and that is the critical parameter.
In timestep-calculations the fluid-particle must remain in one FEM-cell during one timestep, the courant-number
is <1. If the fluid-particle passes more than one cell (courant-number >1), the openfoam-solver stops with
error. So: if you refine the mesh you must parallel use a shorter timestep, which boosts the calculation-time.
https://www.youtube.com/watch?v=7qRW4v_0cSw
https://en.wikipedia.org/wiki/Courant%E ... _condition
https://www.cfd-online.com/Forums/openf ... umber.html
Or I must edit the macro from gift (which is pretty short) to get a faster run through the vtks.
But i have no python skills... ;)
simulation_macro.JPG
Just to point out one thing: for multiphase, the timestep is actually adjusted automatically to fulfil a stable Courant number criterion as the simulation progresses, so it is not necessary to do any hand-calculations. The specified time step size is just the initial value that is used at the start of the simulation and is not critical at all. Of course, this should be made clearer in the interface.

Also, you might get a somewhat cleaner looking animation with a bit less effort if you generate it directly from Paraview, using the contour filter to visualise the free surface.
Please provide all the information requested in this post before reporting problems with CfdOF.
thschrader
Veteran
Posts: 3157
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Cross section river profiles

Post by thschrader »

Hi Oliver,
thanks about the courant-number info.
BTW: whats the drag-coefficient of the millennium falcon? :)
How did you do the simulation?
https://twitter.com/ex_mente/status/936562984914210816
MrSpock.JPG
MrSpock.JPG (22.84 KiB) Viewed 2284 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Cross section river profiles

Post by Kunda1 »

oliveroxtoby wrote: Wed Jan 10, 2018 5:36 am Also, you might get a somewhat cleaner looking animation with a bit less effort if you generate it directly from Paraview, using the contour filter to visualise the free surface.
hint hint nudge nudge
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
thschrader
Veteran
Posts: 3157
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Cross section river profiles

Post by thschrader »

Kunda1 wrote: Wed Jan 10, 2018 11:48 am hint hint nudge nudge
Hi Kunda1,
I know the filtering-options of paraview. But every data-set of every time-step
is so big, that the loading-time produces a non-seamless motion.
Thomas
floodingFC.gif
floodingFC.gif (250.83 KiB) Viewed 2276 times
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Cross section river profiles

Post by oliveroxtoby »

thschrader wrote: Wed Jan 10, 2018 12:26 pm Hi Kunda1,
I know the filtering-options of paraview. But every data-set of every time-step
is so big, that the loading-time produces a non-seamless motion.
Thomas
floodingFC.gif
File | Save Animation generates nice smooth videos (assuming you use a sufficient frame rate).
Please provide all the information requested in this post before reporting problems with CfdOF.
thschrader
Veteran
Posts: 3157
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Cross section river profiles

Post by thschrader »

Kunda1 wrote: Tue Jan 09, 2018 11:48 pm Is there a way to make all this more seamless (besides fidgeting with the model). Meaning can the animation script be made seamless?
You see the first 1,7 sec of animation. My little lame-duck-laptop
worked the whole night, this morning I stopped the calculation.
Using 364000 FEM-cells and a frame rate of 33 frames/sec you
get a relativly seamless motion. I need more computing power...
The inlet-speed is too high. The water presses against the upper wall
of the flow-channel at the beginning (the flat circle).
regards Thomas
animationRiver.gif
animationRiver.gif (880.14 KiB) Viewed 2185 times
Post Reply