CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   Show solution data at certain time steps.. (http://www.cfd-online.com/Forums/star-ccm/66809-show-solution-data-certain-time-steps.html)

peresah July 24, 2009 10:05

Show solution data at certain time steps..
 
Help :-)

Hope someone can help with this basic task...

I would like to access the raw solution data at certain time steps during my transient simulation, not just a "hard copy" of a plot/scene...

I have successfully used the Auto Export to make a CCM-file with the Append option enabled, but once the file has been created and the simulation is finished, how do I actually get to view the data from each time step?

If this is not possible with the CCM-format, is it possible with some of the other available formats... Or do you have to write a macro for this?

I would appreciate any response - thanks!

Maddin July 27, 2009 05:05

Don't know if this works in 4.04 but in 4.02 you have to write all data's via export or hardcopy to look after the simulation is fine.
Other way could be the auto save but I think this isn't a good solution.

peresah July 27, 2009 06:05

Hi Maddin

Thanks for your reply. I'm not sure you understood, so I'll try to clarify. I know how to auto export the data. But how do I "import"/show the data, e.g. show the velocity profile along a vertical line for each time step. I don't want just an image ("hard copy"), but the actual raw data.

After crawling through the forum, I think I've come up with a solution: Record a macro with a loop that runs a single time-step, export the raw data as a csv-file and repeats...

Kindly
Peres

Maddin July 27, 2009 06:32

Hmm maybe you should write a scene file for proVis? But I didn't worked much with this.

peresah July 28, 2009 07:10

Provis?
 
Thanks Maddin. I've tried googling Provis, but get ambigious results. Do you know where I can possibly obtain this software?

Maddin July 28, 2009 07:52

It's a part of stardesign. Maybe StarView+ can also help you.
Under Windows with STARCAT5 the post-processing is with provis (but there I have an older version of starccm).

peresah July 28, 2009 10:16

Ahh, I found provis, hidden in the stardesign directory... I'll try to play around with it , thanks.

By the way, I did make a macro (see below), named exporttransient.java, which does the job. The only thing I haven't figured out yet is if there's a way to automatically determine (1) if the stopping criteria have been met or (2) solution has become instable, so the loop knows when to end. The present approach attempts to resolve (1) but I'm not sure if it's working, so it requires an attentive user :-)

Quote:

package macro;

//Default imported packages
import java.util.*;
import star.common.*;
import star.base.neo.*;
import star.vis.*;

//Special imported packages for this class
import java.io.File;

//Class definition
public class exporttransient extends StarMacro {

public void execute() {

//Initialize variables
String Fname;
double Time;

//Set base path and extension of export file, and name of plot
String BasePath = "/home/username/dir/";
String Ext = ".csv";
String PlotName = "Velocity profile";

//Get references to current simulation, solution and plot
Simulation MySim = getActiveSimulation();
Solution MySol = MySim.getSolution();
XYPlot MyPlot = ((XYPlot) MySim.getPlotManager().getObject(PlotName));

//Extract file name and title (without extension) from simulation
File MyFile = new File(MySim.getSessionPath());
String SimName = MyFile.getName();
String SimTitle = SimName.substring(0,SimName.lastIndexOf("."));

//Initiaize solotion - else plot will be empty
MySol.initializeSolution();

//Step through iteration
while (IsCriteriaSatisfied(MySim) == false) {

//Run a single step and wait until the iteration has been completed
MySim.getSimulationIterator().step(1, true);

//Old: Make tabular data from plot
//InternalDataSet MyData = ((InternalDataSet) MyPlot.getDataSetGroup().getDataSet("line y=0.25 x=0"));

//Generate filename
Time = MySol.getPhysicalTime();
Fname = BasePath + SimTitle + "_time_is_" + Double.toString(Time) + "sec" + Ext;

//Export file
//Old: MySim.getDataSetManager().writeCSVDataSet(MyData,r esolvePath(Fname));
MyPlot.export(resolvePath(Fname));

//Output message
MySim.println("Exported plot " + PlotName + " as " + Fname);

} //Exit loop
} // Exit method

private boolean IsCriteriaSatisfied(Simulation MySim) {

PhysicalTimeStoppingCriterion MyCrit1 = ((PhysicalTimeStoppingCriterion) MySim.getSolverStoppingCriterionManager().getSolve rStoppingCriterion("Maximum Physical Time"));

StepStoppingCriterion MyCrit2 = ((StepStoppingCriterion) MySim.getSolverStoppingCriterionManager().getSolve rStoppingCriterion("Maximum Steps"));

//Return the IsSatisfied value for enabled criteria
if (MyCrit1.getIsUsed() && MyCrit2.getIsUsed())
return MyCrit1.getIsSatisfied() || MyCrit2.getIsSatisfied();

else if (MyCrit1.getIsUsed())
return MyCrit1.getIsSatisfied();

else if (MyCrit1.getIsUsed())
return MyCrit2.getIsSatisfied();

else return false;
} //Exit method
} //Exit class

peresah August 31, 2009 18:33

Updated
 
For those interested, a newer version and documentation for the macro can be found on Edinburgh University's Wiki for Star-users.

Cheers
Peres

IvanCFD May 12, 2010 04:03

Hi all,

I am about to run a unsteady simulation on Fluent and I would need to export a number of variables on a certain plane of the grid (x-,y- and z- velocities, and x-vorticity) every time step to be post-processed with another software (Matlab).

So far I've exported data from steady simulations, at the end of them, once converged. However I've never done this before for unsteady simulations.

I would much appreciate any light you could give me on this.

Cheers,

Ivan.

pavko718 October 23, 2010 18:56

Reading in CCM/SBD files for post processing
 
Hi Peresah,

In the current version of STAR-CCM+ (5.04) it's possible to read .ccm files back into a blank simulation WITH the field function saved in them. These should appear in the Filed Function list under Tools in the simulation tree.

This feature may even be available in earlier versions, but nothing older than 5.02.

If you are only interested in surface data, such as temperature or other quantity only on the surface, the .sbd binary file format may be another option. This format is preferable for saving surface data (geometry and functions) and can be easily and quickly read back into a blank simulation.

Regards,
Pavel

hwsv07 December 29, 2014 20:14

Quote:

Originally Posted by IvanCFD (Post 258444)
Hi all,

I am about to run a unsteady simulation on Fluent and I would need to export a number of variables on a certain plane of the grid (x-,y- and z- velocities, and x-vorticity) every time step to be post-processed with another software (Matlab).

So far I've exported data from steady simulations, at the end of them, once converged. However I've never done this before for unsteady simulations.

I would much appreciate any light you could give me on this.

Cheers,

Ivan.


I have the same issue as well.

I want to export the data (in csv format) at different time steps of the simulation so that I can process the data in matlab.

any idea how to do this automatically?

I have too many timesteps and doing it manually just takes too much time.

kguntur December 30, 2014 02:57

HWSV07,

You can do it using a macro. the macro could run a few time steps, export data as a csv and repeat that. I believe that you can append new data to existing csv file so you can get all time steps in a single file.

Hope this helps.

hwsv07 January 1, 2015 12:53

Quote:

Originally Posted by kguntur (Post 525509)
HWSV07,

You can do it using a macro. the macro could run a few time steps, export data as a csv and repeat that. I believe that you can append new data to existing csv file so you can get all time steps in a single file.

Hope this helps.

hi kguntur

but i would still have to manually run the macro to save the data at specified timestep right?

kguntur January 3, 2015 07:54

hi HWSV07,

No. you don't have to run the macro manually. Suppose you have to run the simulation for 10 sec with 0.1 s time step and you want to save the data ever 1s (i.e. 10 tie steps), your macro would look something like this.

for i = 1 to 10
step 10 time steps
save data
next i

that way you are running it for 100 (10 x 10 ) time steps while saving it every 10 time steps.
Now for the actual java code, you could record a java with what you need and then edit it. It is not that difficult. Hope this helps.


All times are GMT -4. The time now is 10:00.