CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

StarCCM+ user defined field function

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By LuckyTran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2021, 14:17
Default StarCCM+ user defined field function
  #1
New Member
 
Anant Gairola
Join Date: Aug 2021
Location: London, Ontario, Canada
Posts: 11
Rep Power: 5
agairola is on a distinguished road
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
agairola is offline   Reply With Quote

Old   August 18, 2021, 21:34
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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.
agairola likes this.
LuckyTran is offline   Reply With Quote

Old   August 19, 2021, 12:27
Default
  #3
New Member
 
Anant Gairola
Join Date: Aug 2021
Location: London, Ontario, Canada
Posts: 11
Rep Power: 5
agairola is on a distinguished road
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
agairola is offline   Reply With Quote

Reply

Tags
coordinate transformation, field functions, starccm+, velocity vectors


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
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


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