CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

code is being executed more than once per time step with different values

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2015, 10:36
Smile code is being executed more than once per time step with different values
  #1
New Member
 
Jinming Wu
Join Date: Oct 2015
Posts: 3
Rep Power: 11
Jinming Wu is on a distinguished road
When performing Fluent transient simulation, I encountered the problem that the Message script (with subscript) is excuted more than once in every time step, and the variable value is different every time. Does anyone know why is this happen.

The script is shown below, and the result is shown in Fig1.

Thank you for your help!


#include "udf.h"
real cvelocity[3]={0,0,0};
real rotcentroid[3]={150,0,0};
real m1=5736;

DEFINE_CG_MOTION(T1,dt,vel,omega,time,dtime)
{
Thread *thread;
Domain *domain;

real force[3]={0,0,0};
real moment[3]={0,0,0};

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

if(!Data_Valid_P())
return;

domain=Get_Domain(1);
thread=Lookup_Thread(domain,4);
Compute_Force_And_Moment(domain,thread,rotcentroid ,force,moment,TRUE);

cvelocity[0]+=dtime*(force[0]/m1);
cvelocity[1]+=dtime*((force[1]-m1*9.81)/m1);

vel[0]=cvelocity[0];
vel[1]=cvelocity[1];

Message("\nvel[0] equals %f\n",cvelocity[0]);
}
Attached Images
File Type: jpg Fig1.jpg (173.5 KB, 11 views)
Jinming Wu is offline   Reply With Quote

Old   November 19, 2015, 04:20
Default
  #2
New Member
 
Jinming Wu
Join Date: Oct 2015
Posts: 3
Rep Power: 11
Jinming Wu is on a distinguished road
Does anyone know how tho solve this problem?
Jinming Wu is offline   Reply With Quote

Reply

Tags
define_cg_motion, udf


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
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 14:40
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 09:35
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 23:40
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 08:56
calculation diverge after continue to run zhajingjing OpenFOAM 0 April 28, 2010 05:35


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