Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. // STAR-CCM+ macro: step.java
  2. // Written by STAR-CCM+ 12.02.010
  3. package macro;
  4.  
  5. import java.util.*;
  6.  
  7. import star.common.*;
  8. import star.base.neo.*;
  9. import star.vis.*;
  10. import star.base.report.*;
  11.  
  12. import java.io.BufferedWriter;
  13. import java.io.File;
  14. import java.io.FileOutputStream;
  15. import java.io.FileWriter;
  16. import java.io.IOException;
  17. import java.io.OutputStream;
  18. import java.nio.file.Files;
  19. import java.nio.file.Paths;
  20.  
  21. public class step extends StarMacro {
  22.  
  23.  
  24.  
  25. public void execute() {
  26.     execute0();
  27.   }
  28.  
  29.   private void execute0() {
  30.  
  31.     Simulation simulation_0 =
  32.       getActiveSimulation();
  33. double z = 0.005;
  34.  
  35. try {
  36.  
  37.     // Collecting the simualtion file name
  38.     String simulationName = simulation_0.getPresentationName();
  39.  
  40.     // Open Buffered Input and Output Readers
  41.     // Creating file with name "<sim_file_name>+report.csv"
  42.     BufferedWriter bwout = new BufferedWriter(new FileWriter("D:\\" + simulationName +"report.csv"));
  43.    
  44.  
  45. while (z < 0.45){
  46.     PlaneSection planeSection_1 =
  47.       ((PlaneSection) simulation_0.getPartManager().getObject("\u043F\u0440\u043E\u0445\u043E\u0434\u043D\u043E\u0435 \u0441\u0435\u0447\u0435\u043D\u0438\u0435"));
  48.  
  49.     Coordinate coordinate_2 =
  50.       planeSection_1.getOriginCoordinate();
  51.  
  52.     Units units_0 =
  53.       ((Units) simulation_0.getUnitsManager().getObject("m"));
  54.  
  55.  
  56.    coordinate_2.setCoordinate(units_0, units_0, units_0, new DoubleVector(new double[] {0.0031250000320142135, 0.002723076133406721, z}));
  57.    
  58.  
  59.     ExpressionReport expressionReport_0 =
  60.       ((ExpressionReport) simulation_0.getReportManager().getReport("\u0412\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435 1"));
  61.  
  62.     expressionReport_0.printReport();
  63. z = z + 0.001;
  64.  
  65.     bwout.write(expressionReport_0.toString()+ "," + units_0.toString()+ "," + coordinate_2.toString() + "\n");
  66.  
  67. }
  68.     bwout.close();
  69.  
  70.     } catch (IOException iOException) {
  71.     }
  72.  
  73.  
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement