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

Expressions syntax for vector component

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By ginop

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2023, 04:54
Default Expressions syntax for vector component
  #1
New Member
 
Gino Parisella
Join Date: Mar 2017
Location: Perth, Western Australia
Posts: 22
Rep Power: 9
ginop is on a distinguished road
I am trying to use expressions to set up initial conditions, but I have syntax issues to get components from vectors.

Example:
HTML Code:
var1 #eval { vector(1, sqrt(2), 3) };
var2 #eval { vector(var1.x(), 4, 5) };
the syntax above is not correct, and I tried a few variations of it without luck.

the resulting error is "Object var1.x does not exist or wrong type in expression at position...".

What is the correct syntax to use a component out of a defined vector?

Thank you in advance
ginop is offline   Reply With Quote

Old   December 5, 2023, 10:21
Default need to expand the string
  #2
New Member
 
Gino Parisella
Join Date: Mar 2017
Location: Perth, Western Australia
Posts: 22
Rep Power: 9
ginop is on a distinguished road
ok, I found the answer in the user guide

basically if I define a vector
Code:
var1    #eval{vector(1, 5, 3)};
the vector components are accessed using the expansion
Code:
$[(vector) var1]
for example if I want to define another vector using the "y" component from "var1", I should do
Code:
var2    #eval{vector(4, $[(vector) var1].y(), 6)};
hope it helps!

Cheers
ginop is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
UDF syntax error Ratel Fluent UDF and Scheme Programming 4 May 23, 2015 05:15
what is syntax error : missing ')' before ';' aleisia Fluent UDF and Scheme Programming 8 March 10, 2015 15:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 15:16


All times are GMT -4. The time now is 20:11.