# Rectangular pulse as field function

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 3, 2014, 07:30 Rectangular pulse as field function #1 New Member   Jul Join Date: Feb 2014 Posts: 4 Rep Power: 12 Hi guys, I am trying to create a field function (first time I am doing that on Star) to make a velocity inlet depending of the time. I want to create a rectangular pulse so I am using a sinusoidal function, and when this function is positive the velocity will be like 80m/s and when it is negative, the velity will be zero. So here is the field function I have created: (sin(352*\$Time)>=0) ? \$\$Velocity=80 : (sin(352*\$Time)<0) ? \$\$Velocity=0 Unfortunately, this function doest not compile. I can't find what I have did wrong ... do you have any ideas where I have done a mistake ? Thank you

 April 3, 2014, 08:09 #2 Senior Member   Robert Join Date: Jun 2010 Posts: 117 Rep Power: 17 Velocity is a vector, you will need something like \$\$Velocity[1] (Y velocity) or use \$VelocityMagnitude if you want a scalar.

 April 4, 2014, 08:32 #3 New Member   Jul Join Date: Feb 2014 Posts: 4 Rep Power: 12 Thank you for your answer. My code is now compiling but still not working. So I tried to set a field funtion very simple as: \$VelocityMagnitude==80 And the velocity keeps to zero ... Do you have any idea where I am doing wrong ?

 April 4, 2014, 11:54 #4 New Member   Jul Join Date: Feb 2014 Posts: 4 Rep Power: 12 I have found the solution !! Thank you for your help !

 Thread Tools Search this Thread Search this Thread: Advanced Search 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 Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post almir OpenFOAM Running, Solving & CFD 92 May 21, 2024 07:56 thomasduerr OpenFOAM Post-Processing 121 June 11, 2021 10:05 immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 Christian Main CFD Forum 2 February 27, 2007 06:27

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

 Contact Us - CFD Online - Privacy Statement - Top