# Field Function

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

 November 19, 2014, 07:09 Field Function #1 New Member   Daniel GRimbs Join Date: Nov 2014 Posts: 2 Rep Power: 0 hey, I have problems with my Field Function. I would like to simulate movement and move the object in the Z-axis (dependent on time). the equation of motion I have already written, but I have a problem that does not move the object in the negative direction of the coordinate system. I hope someone of you can help me further. Here is the definition of Field Function: [(\$ Time <0.4)? 10 : ((\$ time>= 1.3) && (\$ Time <1.7))? - 10: 0,0,0]

November 20, 2014, 04:03
#2
Senior Member

Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 779
Rep Power: 19
Quote:
 Originally Posted by Dgrimbs hey, I have problems with my Field Function. I would like to simulate movement and move the object in the Z-axis (dependent on time). the equation of motion I have already written, but I have a problem that does not move the object in the negative direction of the coordinate system. I hope someone of you can help me further. Here is the definition of Field Function: [(\$ Time <0.4)? 10 : ((\$ time>= 1.3) && (\$ Time <1.7))? - 10: 0,0,0]
I cannot promise that it will help, but I would really split this into two definitions to make sure that the parser works okay, especially with the ternary operation in there. It might also make your code easier to understand and maintain.

The position
Code:
`MyPosition = (\$Time < 0.4) ? 10 : ((\$Time >= 1.3 && \$Time < 1.7) ? -10 : 0)`
and then use
Code:
`[\${MyPosition}, 0, 0]`
Note that you must also ensure that third element of the ternary is bracketed. This is not needed for C/C++/Java etc, but does seem to be needed for STARCCM.

Valid for STARCCM (and C/C++/Java etc)
Code:
`conditon1 ? val1 : (condition2 ? val2 : val3)`
Valid for C/C++/Java etc, but invalid for STARCCM
Code:
`conditon1 ? val1 : condition2 ? val2 : val3`

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post almir OpenFOAM Running, Solving & CFD 62 June 16, 2016 03:01 alessio.nz OpenFOAM 6 December 23, 2015 15:27 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 Jul1731 STAR-CCM+ 3 April 4, 2014 11:54 asaijo OpenFOAM Installation 9 April 6, 2011 12:21

All times are GMT -4. The time now is 09:45.