CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   STAR-CCM+ (https://www.cfd-online.com/Forums/star-ccm/)
-   -   Prescribe velocity field as essential B.C. (https://www.cfd-online.com/Forums/star-ccm/240478-prescribe-velocity-field-essential-b-c.html)

Michelle197 January 7, 2022 08:42

Prescribe velocity field as essential B.C.
 
Hi all,

I am new to star ccm+ so this is probably a stupid question.
I have a cube and I want to prescribe the velocity on the cube faces to create a uniaxial extensional flow: velocity = [strain_rate*x,-strain_rate/2*y,-strain_rate/2*z]. So what I did is created a velocity_inlet boundary condition on the surfaces. Since the velocity depends on the local coordinates on the surfaces I thought it was best to define it via a field function, but I can not figure out how this works. I want to have a strain_rate of 1, but I don't know how to set a user variable. I tried to define a user field function but I keep getting syntax errors because the dimension is not right: [$$Position[1]*1, -0.5*$$Position[2],-0.5*$$Position[3]].

I also saw that there is a velocity field function, so I tried to add that to the boundary condition, but now I can't find how to define the velocity.

Can anyone please help me out? Thanks in advance!

Kind regards,
Michelle

LuckyTran January 8, 2022 02:50

The velocity field function is a primitive function that you should never try to edit. That's your velocity solution when you iterate... You don't want to mess with it (you can't either how).

Use indexing 0, 1, and 2 for the x,y,and z components of a vector. Enclose variable names in curly brackets if they are fancy. I.e. ${strain_rate} if strain_rate is a defined scalar function. Single $ are for referencing scalar functions and dbl dollar signs $$ are for referencing vectors. Note that you could also define parameters that can be referenced in field functions rather than creating an entire field function for a simple constant value.

What is wrong with?
Code:

[$${Position}[0]*1, -0.5*$${Position}[1],-0.5*$${Position}[2]]

Michelle197 January 8, 2022 06:16

Thank you for your answer!

The problem with that line was that it has the wrong dimensions. It gives as result the unit of Position and not Velocity. If I want to define a scalar Strain_rate [1/s] do I have to do that via a field function as well, or is there an easier way?

Thanks!
Michelle

LuckyTran January 8, 2022 11:53

Easy? There's no such thing as a free lunch.

If cowabunga has a value of 1 then why not just hard code it as-is? If you plan on changing its value later one day to 189 and on another day to -256, then I recommend to use a parameter. You can find parameters in the tree in tools if you look a little further down past field functions. If cowabunga is spatially/temporally varying field, then use a field function.


Units are units. Just take care of them. If you define dimensionless stuff and try to use it as an input to dimensioned things, Star will assume SI units for the dimensionless stuff. If you define dimensions, then you are in charge of making sure the dimensions match. Position obviously has units of length. 1, and -0.5 has units of no-dimensions.

Instead of 1, which has no units, type 1 [1/s]

Michelle197 January 8, 2022 15:09

Thank you I will try that! :)


All times are GMT -4. The time now is 07:21.