|
[Sponsors] |
[swak4Foam] adding an interpolated graph to groovyBC |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 26, 2017, 07:05 |
adding an interpolated graph to groovyBC
|
#1 |
Senior Member
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14 |
Dear Foamers
I want to simulate a real blood flow in an aortic aneurysm. I used the paper done by Khanafer et al. entitled "Modeling pulsatile flow in aortic aneurysms: Effect of non-Newtonian properties of blood" they used an inlet velocity profile which contains a term of U(t) (please see the attached picture) Using groovyBC, it is possible to add a parabolic velocity inlet but I don't have any idea how to add a velocity profile term created from interpolation of 350 points. Is there anyone who can help me with this issue? I will be grateful if you help me with your advice. Br, Mohsen Last edited by m5m5kh; September 26, 2017 at 08:41. |
|
October 2, 2017, 00:57 |
|
#2 |
Senior Member
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14 |
Please share your knowledge with me
|
|
October 2, 2017, 02:45 |
|
#3 |
Senior Member
Oskar
Join Date: Nov 2015
Location: Poland
Posts: 184
Rep Power: 10 |
I believe You need to use some tool (excel or something like that) to approximate a formula of Your inlet profile then follow this tutorial
https://www.youtube.com/watch?v=K-nAF3qAPTc |
|
October 2, 2017, 04:38 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi all,
in OpenFOAM there is a boundary called timeVaryingMappedFixedValue which can handle tables and makes interpolation inbetween the timesteps. The header file of the class states: Code:
Description This boundary conditions interpolates the values from a set of supplied points in space and time. Supplied data should be specified in constant/boundaryData/\<patchname\>/ - points : pointField of locations - \<time\>/\<field\> : field of values at time \<time\> The default mode of operation (mapMethod planarInterpolation) is to project the points onto a plane (constructed from the first threee points) and construct a 2D triangulation and finds for the face centres the triangle it is in and the weights to the 3 vertices. The optional mapMethod nearest will avoid all projection and triangulation and just use the value at the nearest vertex. Values are interpolated linearly between times. Usage \table Property | Description | Required | Default value setAverage | Switch to activate setting of average value | no | false perturb | Perturb points for regular geometries | no | 1e-5 fieldTableName | Alternative field name to sample | no| this field name mapMethod | Type of mapping | no | planarInterpolation offset | Offset to mapped values | no | Zero \endtable \verbatim <patchName> { type timeVaryingMappedFixedValue; } \endverbatim Good luck, Tobi
__________________
Keep foaming, Tobias Holzmann |
|
October 2, 2017, 08:40 |
|
#5 |
Senior Member
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14 |
Dear Tobias and Oskar
Thanks for your help.I will follow your hints. Kind regards, Mohsen |
|
October 4, 2017, 13:35 |
|
#6 | |
Senior Member
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14 |
Quote:
Is there any possibility to use groovyBC? |
||
October 16, 2017, 14:26 |
|
#7 |
Senior Member
mohsen kh
Join Date: Jan 2013
Location: Iran
Posts: 125
Rep Power: 14 |
No one faced such problem??? any similar experience?
your help is really needed. Regards, Mohsen |
|
December 29, 2017, 16:37 |
|
#8 | |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8 |
Quote:
|
||
December 29, 2017, 18:52 |
|
#10 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12 |
A while ago I needed a parabolic BC for U and here's the way I did it:
Code:
inlet { type codedFixedValue; value uniform (0 0 0); redirectType parabolaProfile; code #{ const fvPatch& boundaryPatch = patch(); const vectorField& Cf = boundaryPatch.Cf(); vectorField& field = *this; scalar uave = 10; scalar h = 5e-3; scalar vel; forAll(Cf, faceI) { vel = 6 * uave / (h*h) * (h * Cf[faceI].y() - Cf[faceI].y() * Cf[faceI].y()); field[faceI] = vector(vel, 0, 0); } #}; } Edit: I meant that you can use tableFile inside the code. Since this is a C++ code, you can do all sorts of things without relying on OF classes and functions. You can use C++ capabilities to read from files and do operations though it's more convenient to use OF classes and functions. Also, if you want to include any header you can use codeInclude directive like this: Code:
inlet { type codedFixedValue; value uniform (0 0 0); redirectType parabolaProfile; codeInclude #{ #include ”someHeaderFile” #}; code #{ const fvPatch& boundaryPatch = patch(); const vectorField& Cf = boundaryPatch.Cf(); vectorField& field = *this; scalar uave = 10; scalar h = 5e-3; scalar vel; forAll(Cf, faceI) { vel = 6 * uave / (h*h) * (h * Cf[faceI].y() - Cf[faceI].y() * Cf[faceI].y()); field[faceI] = vector(vel, 0, 0); } #}; } |
|
December 29, 2017, 18:59 |
|
#11 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
The solution you mentioned is working if one has a mathematical formula that can be implemented. If one can do this, it is easy as you demonstrated (by the way there exist a parabolic BC). If one has a table that cannot be fit to a polynomial or other function, one has to modify the varying bc. I guess it is not a big deal or there are already other ways to do it
__________________
Keep foaming, Tobias Holzmann |
|
December 29, 2017, 19:07 |
|
#12 | |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12 |
Quote:
|
||
December 31, 2017, 06:12 |
|
#13 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How I can introduce my power heat (W) in chtMultiRegionFoam? | aminem | OpenFOAM Pre-Processing | 32 | August 29, 2019 02:23 |
chtMultiRegionSimpleFoam: crash on parallel run | student666 | OpenFOAM Running, Solving & CFD | 3 | April 20, 2017 11:05 |
conjugateHeatFoam + interFoam | farhagim | OpenFOAM Programming & Development | 15 | July 19, 2016 07:55 |
chtMultiRegionSimpleFoam 3D problem | Lucie | OpenFOAM Pre-Processing | 2 | June 21, 2016 05:23 |
chtMultiRegionSimpleFoam | samiam1000 | OpenFOAM Running, Solving & CFD | 39 | March 31, 2016 08:43 |