CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   Need a macro to run every timestep (https://www.cfd-online.com/Forums/siemens/56530-need-macro-run-every-timestep.html)

Nate March 19, 2008 19:37

Need a macro to run every timestep
 
1.) Do macros automatically run every timestep? 2.) Does anyone have a sample of such a macro?

I need to come up with my own macro to export XYZ tables each timestep but I'm not sure how to go about getting the macro to run every step.

Thanks!

Steve March 24, 2008 17:37

Re: Need a macro to run every timestep
 
it is pretty easy to do

firstly setup your model then record a macro that contains

1) the pressing of the step button. This makes the simulation take one timestep/iteration

2) the post processing steps you want (exports etc)

Stop the recording and open up the java file. The next step is to wrap this code in a java for or while statement, for example

int imax=100; //maximum number of steps

for(i=0&#59i&#60imax&#59i++){

// insert your recorded macro code here

}

Any java book or a bit of work with google should sort you out.


Nate March 24, 2008 19:13

Re: Need a macro to run every timestep
 
Thanks Steve!

I guess that was kind of a no-brainer. I hadn't though about the fact that you can step just once like that.



All times are GMT -4. The time now is 07:58.