|
[Sponsors] |
August 18, 2021, 14:17 |
StarCCM+ user defined field function
|
#1 |
New Member
Anant Gairola
Join Date: Aug 2021
Location: London, Ontario, Canada
Posts: 11
Rep Power: 5 |
This is a very StarCCM+ syntax specific query. In my simulations I have recorded the mean velocity components in a local (cylindrical coordinate system) reference frame using a field mean monitor. Let's call these Ur, Ut and Uz. My question is -how do I create a vector field function for the velocity vector using these available components in the cylindrical coordinate system? I understand that if the components were originally recorded in the cartesian system (let's call them Ux, Uy and Uz) then the vector field function can be created as [${Ux},${Uy},${Uz}] but this is will not work if I have the components in cylindrical system. Any insight would be very helpful.
Thanks, Anant |
|
August 18, 2021, 21:34 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
Did you make a monitor for the mean velocity as a vector or as scalar components? As a vector it's easy. As scalar components it becomes very cumbersome. Starccm automatically translates vectors from one representation to another easily. All you need to do is add a reference to the coordinate system in the call to the vector field function:
Velocity(@LocalCoordinateSystem("Laboratory.yourna mehere")) And you can still tail it with [0] [1] [2] to access the r, theta, and z components. And don't forget the $ or $$ infront depending on what you are trying to do. Btw I recommend you to just make a mean velocity monitor as a vector (it can be in any coordinate system) since you can easily convert to any other coordinate system on demand. I don't recommend doing it by components because you end up having to do this step of building a vector field from something that should have been a vector to begin with. |
|
August 19, 2021, 12:27 |
|
#3 |
New Member
Anant Gairola
Join Date: Aug 2021
Location: London, Ontario, Canada
Posts: 11
Rep Power: 5 |
Hi,
Thank you for the response. What you said makes prefect sense. However, unfortunately I did not have the foresight to save the velocity as a vector, I only saved the mean magnitude as a scalar quantity. I found another way to tackle this issue. For the interest of the general audience, here is how I did it- I had saved the mean velocity components in the cylindrical coordinate system (let's call them Ur, Ut and Uz). So I then created a scalar field called "theta", defined as $${Position}(@CoordinateSystem("Laboratory.Cylindr ical 1"))[1] - this gives me the azimuthal location of all the points in the domain. Then I created, Ux, Uy and Uz (the components in the cartesian coordinate system) as following- Ux: ${Ur}*cos(${theta})-${Ut}*sin(${theta}) Uy: ${Ur}*sin(${theta})+${Ut}*cos(${theta}) Uz: Uz This allowed me to create a mean vector field function, (let's call it velocity_vector) as [Ux, Uy Uz]. Effectively I did the conversion back to the cartesian components manually using the field functions described above. The vector field function, velocity_vector can be decomposed into any arbitrarily defined local coordinate system, if needed as well by using $${velocity_vector}(@CoordinateSystem(Your choice of local reference frame put in quotes))[your choice of the component-0, 1 or 2] PS when in doubt it's always best to save vector components in the cartesian coordinate system since that is the default choice for StarCCM+. The resulting components can then be transformed to any other local coordinate system easily. Thank you once again for your response; I really appreciate it. Regards, Anant |
|
Tags |
coordinate transformation, field functions, starccm+, velocity vectors |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wrong units of user defined field function | FliegenderZirkus | FLUENT | 0 | July 19, 2020 12:21 |
User Field Function | mazhar16823 | Main CFD Forum | 0 | June 15, 2020 16:59 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
Transient User Defined Function in CFX | Niru | CFX | 0 | November 12, 2013 18:07 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |