|
[Sponsors] |
February 26, 2015, 07:08 |
codedFixedValue in openFoam 2.3
|
#1 |
New Member
Gian
Join Date: Feb 2015
Posts: 6
Rep Power: 11 |
I have implemented a velocity BC for sinusoidally moving wall in y-direction as;
movingWall_1 { type codedFixedValue; value uniform (0 0 0); redirectType rampedFixedValue; code #{ vector (0, (0.1*sin(3.14*this->db().time().value())/2), 0); #}; } ------------------------------------------ But it does not impart any velocity to the moving wall_1, What could be wrong? Also, could you let me know what db() and value() stand for here and what is the frequency of oscillation.. Thanks |
|
February 26, 2015, 09:02 |
|
#2 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
you are not applying this to the boundary if you update it! You have to generate a vectorField like: Code:
vectorField sinusMoving = .... Code:
vectorField sinusMoving = .... operator==(sinusMoving); PS: db() is the database that stores the fields you can use during run time. This line: this->db().time().value() only return the time. Other example, if you want to have access to the Velocity field U, it looks like that: Code:
const volVectorField& U_ = this->db().lookupObject<volVectorField>("U"); Now you can use that field for doing stuff. In my case I used it to calculate the velocity at the boundary points (patchInterpolator) and then move the boundary due to velocity. PPS: Quote:
__________________
Keep foaming, Tobias Holzmann |
||
February 27, 2015, 01:20 |
|
#3 |
New Member
Gian
Join Date: Feb 2015
Posts: 6
Rep Power: 11 |
Thanks.It appears this statement also works in 0/U file:
(*this)== vector (0, (0.1*sin(3.14*this->db().time().value())),0); ------------------------ However, my timestep goes to vanishingly small value after 4 sec of run. I think the problem may lie with corresponding pressure BC at movingWall that I specified as: 0/p_rgh: zeroGradient; Perhaps this is inconsistent after the velocity BC? Which pressure BC should I be using then? |
|
September 8, 2015, 09:53 |
|
#4 |
New Member
Tomladian Bucinara
Join Date: Jan 2015
Posts: 18
Rep Power: 11 |
Dear Tobi,
Could you please help me do the following question? The data of inlet velocity field and their corresponding coordinate are listed in a file called UTable.csv in the format of (x y z ux uy uz), i.e., x1 y1 z1 ux1 uy1 uz1 x2 y2 z2 ux1 uy2 uz2 ... I want to apply the velocity data to the inlet_1 boundary, but I do not know how to finish the following coding work. internalField uniform (0 0 0); inlet_1 { type codedFixedValue; value $internalField; redirectType Sth; code #{ vector dir= ??? ... #}; } I have been working on the problem for a few days. Thanks in advance. Tom |
|
October 6, 2015, 11:12 |
|
#5 |
Member
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 13 |
Hi Tom,
Did you manage to solve your problem? If I understood well, you want to use some velocity data as an inlet condition. I don't know how you can do it with codedFixedValue but you may want to have a look at timeVaryingMappedFixedValue. In principle, this bc is used for unsteady simulations but I think you can make it work for steady cases as well. Best wishes, Z |
|
October 6, 2015, 11:26 |
|
#6 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Dear Tom and Zen,
sorry Tom I did not recognize your post. It is possible for sure but you have first load the data into some arrays. After that you have to check the face face center coordinates and apply the velocity to the face center. But there is some boundary condition available that reads Data from a file. Check that out first and if necessary, modify the code that it matches your requirements (:
__________________
Keep foaming, Tobias Holzmann |
|
October 13, 2015, 12:17 |
|
#7 |
Member
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 13 |
Hi Tom and Tobi,
I looked up the timeVaryingMappedFixedValue boundary condition in a bit more detail and I can say it can be used to specify non-uniform boundary conditions in space and/or time. The reference tutorial for this b.c. is located in simpleFoam/pitzDailyExptInlet and it is specifically for spatially varying inlet conditions. Basically, one has to create a directory in /constant called 'boundaryData' and as many subdirectories in /boundaryData as the number of boundaries that needs a timeVaryingMappedFixedValue boundary condition. These subdirectories should also be named after the boundary to which the timeVaryingMappedFixedValue is applied (e.g. inlet). Furthermore, a file containing the x,y,z coordinates of the points where quantities (such as U, k, epsilon, p) are specified must be created in /boundaryData and should be called 'points'. Finally, if, for example, one wants to have a spatially varying inlet velocity, he or she should create a file in /inlet/0 called 'U' and specify there the value of u_x,u_y,u_z. The first velocity would correspond to the velocity at the first point specified in /boundaryData/points. If also a time varying quantity is required, one should create in e.g. /input different folders corresponding to different times e.g. 0, 0.1, 0.2 etc. Hope this helps, Z |
|
October 13, 2015, 13:21 |
|
#8 |
New Member
Tomladian Bucinara
Join Date: Jan 2015
Posts: 18
Rep Power: 11 |
Dear Z,
your method really works, thanks. |
|
May 17, 2019, 12:11 |
|
#9 | |
New Member
Hao Li
Join Date: May 2017
Posts: 7
Rep Power: 9 |
Dear friend, I admire you as an Openfoam expert and saw your many responds.
Could you help me with my questions? At the end of time step n*deltaT (i.e. the beginning of the time step (n+1)deltaT ). I want to access the velocity along line or several points of time step n*deltaT, Can I use the following line? A question is how to define the line or the several points I want to extract? const volVectorField& U_ = this->db().lookupObject<volVectorField>("U"); Best wishes Lee Quote:
|
||
August 29, 2020, 05:47 |
calculate sphere velocity at each time step and apply it to inlet boundary condition
|
#10 |
Member
|
Dear friends,
I am solving the flow around the sphere (as a particle) inside a channel. I want to calculate the integral of the drag force over the sphere at each time step to calculate the velocity of the sphere V2 (F=m.(V2-V1)/dt) and then applied the obtained velocity (V2) at each time step to the inlet boundary as a portion of velocity boundary condition (U-V2). How can I do this? |
|
August 29, 2020, 06:52 |
|
#11 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
You can check if the »forceCoeffs« create the data in the registry, if it is so, you can lookup the required data from the boundary (e.g., codedFixedValue). If not, you have to calculate the forces yourself within the boundary condition and apply the result to the faces.
Actually the functionObjects should be registered and you should be able to have access to them. However, I am not 100% sure about that and I don't have the time to look for that.
__________________
Keep foaming, Tobias Holzmann |
|
August 29, 2020, 08:17 |
|
#12 | |
Member
|
Quote:
Thank you very much. I will check it. |
||
Tags |
codedfixedvalue, velocity bc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Frequently Asked Questions about Installing OpenFOAM | wyldckat | OpenFOAM Installation | 3 | November 14, 2023 12:58 |
Differences between OF2.2 and OF 2.3 in sprayFoam spraycloudproperties | FWST | OpenFOAM Running, Solving & CFD | 1 | February 13, 2015 07:53 |
OpenFOAM Foundation Releases OpenFOAM v2.3.0 | opencfd | OpenFOAM Announcements from OpenFOAM Foundation | 3 | December 23, 2014 04:43 |
[Gmsh] 2D Mesh Generation Tutorial for GMSH | aeroslacker | OpenFOAM Meshing & Mesh Conversion | 12 | January 19, 2012 04:52 |
64bitrhel5 OF installation instructions | mirko | OpenFOAM Installation | 2 | August 12, 2008 19:07 |