CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

codedFixedValue in openFoam 2.3

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 4 Post By Tobi
  • 1 Post By Zen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 26, 2015, 07:08
Default codedFixedValue in openFoam 2.3
  #1
New Member
 
Gian
Join Date: Feb 2015
Posts: 6
Rep Power: 11
vishmehr24 is on a distinguished road
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
vishmehr24 is offline   Reply With Quote

Old   February 26, 2015, 09:02
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

you are not applying this to the boundary if you update it!
You have to generate a vectorField like:
Code:
vectorField sinusMoving = ....
and then apply this to the points at the boundary with the operator==
Code:
vectorField sinusMoving = ....
operator==(sinusMoving);
Cheers


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");
The above line will generate a new volVectorField called U_ which is a reference to the U field (but const so you can not change values).
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:
is the frequency of oscillation
I will not answer this question
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 27, 2015, 01:20
Default
  #3
New Member
 
Gian
Join Date: Feb 2015
Posts: 6
Rep Power: 11
vishmehr24 is on a distinguished road
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?
vishmehr24 is offline   Reply With Quote

Old   September 8, 2015, 09:53
Default
  #4
New Member
 
Tomladian Bucinara
Join Date: Jan 2015
Posts: 18
Rep Power: 11
Tom123 is on a distinguished road
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
Tom123 is offline   Reply With Quote

Old   October 6, 2015, 11:12
Default
  #5
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 13
Zen is on a distinguished road
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
Zen is offline   Reply With Quote

Old   October 6, 2015, 11:26
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
Tobi is offline   Reply With Quote

Old   October 13, 2015, 12:17
Default
  #7
Zen
Member
 
Zeno
Join Date: Sep 2013
Location: Delft, The Netherlands
Posts: 63
Rep Power: 13
Zen is on a distinguished road
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
Michael@UW likes this.
Zen is offline   Reply With Quote

Old   October 13, 2015, 13:21
Default
  #8
New Member
 
Tomladian Bucinara
Join Date: Jan 2015
Posts: 18
Rep Power: 11
Tom123 is on a distinguished road
Dear Z,

your method really works, thanks.
Tom123 is offline   Reply With Quote

Old   May 17, 2019, 12:11
Default
  #9
New Member
 
Hao Li
Join Date: May 2017
Posts: 7
Rep Power: 9
haolee0928 is on a distinguished road
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:
Originally Posted by Tobi View Post
Hi,

you are not applying this to the boundary if you update it!
You have to generate a vectorField like:
Code:
vectorField sinusMoving = ....
and then apply this to the points at the boundary with the operator==
Code:
vectorField sinusMoving = ....
operator==(sinusMoving);
Cheers


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");
The above line will generate a new volVectorField called U_ which is a reference to the U field (but const so you can not change values).
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:

I will not answer this question
haolee0928 is offline   Reply With Quote

Old   August 29, 2020, 05:47
Default calculate sphere velocity at each time step and apply it to inlet boundary condition
  #10
Member
 
Arash Mahboubidoust
Join Date: Jun 2013
Location: Iran
Posts: 58
Rep Power: 13
arashfluid is on a distinguished road
Send a message via Yahoo to arashfluid
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?
arashfluid is offline   Reply With Quote

Old   August 29, 2020, 06:52
Default
  #11
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
Tobi is offline   Reply With Quote

Old   August 29, 2020, 08:17
Default
  #12
Member
 
Arash Mahboubidoust
Join Date: Jun 2013
Location: Iran
Posts: 58
Rep Power: 13
arashfluid is on a distinguished road
Send a message via Yahoo to arashfluid
Quote:
Originally Posted by Tobi View Post
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.

Thank you very much. I will check it.
arashfluid is offline   Reply With Quote

Reply

Tags
codedfixedvalue, velocity bc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 14:37.