|
[Sponsors] |
March 25, 2014, 23:41 |
Setting Initial Conditions Velocity Profile
|
#1 |
New Member
Join Date: Mar 2014
Posts: 12
Rep Power: 12 |
Hi guys,
I am in need of help as i'm completely stuck on this an don't know how else to proceed. I'm modelling atmospheric boundary layer flow over hilly terrain and need to automatically set a logarithmic inlet velocity profile based on reference velocities given by measurements. Since the domain is not flat and the surface elevation varies considerably along the inlet boundary I have a log-law equation modified for elevation Z. The way I was hoping to approach this was to Extract the face centroid positions of the inlet boundary to an internal table, and then use my equation on the 'z' value of each centroid to work out the velocity and then assign it to the coordinate (x,y) of the same centroid. I can't figure out how to apply an equation to the table. Is there another way of doing this? How would i apply a simple logarithmic profile? Additionally how would i do this as a vector? When I input (x,y) constant velocity values the flow remains normal to the face and doesn't change its angle. Also what is the "magnitude" node in the inlet region exactly? I want the magnitude to be based on the vectors that i put into the initial conditions. Any help appreciated! [EDIT]: If I set the initial conditions to an XYZ File table that I populate externally (say matlab) does Star interpolate the data to fit the cell centroids? If that's the case then this is probably the easiest method as i could then set a local cordinate system and simply input the magnitude of the vector as a normal. |
|
March 26, 2014, 10:33 |
|
#2 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
you could try this but I have not tested it:
- create a section plane parallel and almost touching your inlet boundary but with the input part being the ground - the resulting derived part is a line following the ground level - create a internal xyz table with the above line as the input part and the centroid z as the scalar - create an interpolate table field function with the above table is the input and z as the scalar - you now have a field function which gives you the ground height at the inlet - create your log inlet velocity field function with the local ground height field function included in the formula - this can be a vector or a scalar field function, then you just change the mode in the velocity inlet boundary to either magnitude (ie normal) or components |
|
March 26, 2014, 22:09 |
|
#3 |
New Member
Join Date: Mar 2014
Posts: 12
Rep Power: 12 |
Thanks ping, I'll let you know if it works, have another problem atm unfortunately.
|
|
March 27, 2014, 21:56 |
|
#4 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25 |
Why do you have to do anything with a table, you already have a function that defines your velocity as a function of height. Just make a field function out of that equation and apply it to the velocity inlet BC.
|
|
March 28, 2014, 01:40 |
|
#5 |
New Member
Join Date: Mar 2014
Posts: 12
Rep Power: 12 |
Hey me3840, you're right i have considered the field function as the better option i'm just unsure of the correct syntax.
I have constants P1 and P2. I then create a new field function and give it the velocity dimension and a vector type. I then fill out the definition with "$$Velocity[0] == (log($($$Centroid[2]))+P2)/P1" This is meant to calculate a horizontal velocity 'x' as a function of all the available height 'z' values. Would you mind explaining what i'm doing wrong? Thanks. |
|
March 28, 2014, 02:37 |
|
#6 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
you originally asked to make the velocity a function of the local ground level which you said varied along the inlet boundary - so i gave you a method to to first measure the local ground z then use this in a definition
if you are happy with the cell z location then me3840 is correct - the definition shown be something like this for a scalar field function to use as the velocity magnitide: (log($$Centroid[2])+P2)/P1 ie forget the $$Velocity[0] == and the extra $ in the equation or if you want to use vector components then create a vector field function with this definition: [0, 0, (log($$Centroid[2])+P2)/P1] |
|
March 28, 2014, 03:24 |
|
#7 |
New Member
Join Date: Mar 2014
Posts: 12
Rep Power: 12 |
Thanks ping,
Sorry for the confusion. Originally I thought that the coordinates had to be extracted prior to being used which is why I wanted to vary the minimum value of 'z' used according to the surface of the boundary. The correction you gave works perfectly, thank you very much! |
|
March 28, 2014, 03:46 |
|
#8 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
i made a mistake in the vector version - that will give you z velocities as a function of z!
so if x is normal to your boundary then use [ (log($$Centroid[2])+P2)/P1] , 0, 0 ] or for y normal use [ 0, (log($$Centroid[2])+P2)/P1] , 0 ] dont forget these are scalar or vectore field functions so you can display them in a scene like any other field to check the definition is reasonable before using them wherever required |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Velocity blows up suddenly after 30,000+ iterations | lordvon | OpenFOAM Running, Solving & CFD | 15 | October 19, 2015 14:52 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
rhoSimplecFoam Mach0.8 no pressure values | CFDnewbie147 | OpenFOAM Running, Solving & CFD | 16 | November 23, 2013 06:58 |
calculation stops after few time steps | sivakumar | OpenFOAM Running, Solving & CFD | 7 | March 17, 2013 07:37 |
Error while running rhoPisoFoam.. | nileshjrane | OpenFOAM Running, Solving & CFD | 8 | August 26, 2010 13:50 |