Java
Hi,
I am trying to write out report values. But I get these result in STAR-CCM+ when playing the macro: Part Value (Pa) ------------------------------ ------------- Plane_Water_1 1.479126e+04 ------------- Total: 1.479126e+04 Surface Average of Total Pressure on Volume Mesh This part is longer but I only show this lines, to messy otherwise The macro I wrote is as follows: ************************************************** ************************************************** *********** ************************************************** ************************************************** *********** public void PrintReports(Simulation SIM){ for(AreaAverageReport FP: SIM.getReportManager().getObjectsOf(AreaAverageRep ort.class)){ ArrayList<String> list = new ArrayList<String>(); list.add("Pressure_Plane_Water_1-Surface_Average"); list.add("Pressure_Plane_Water_2-Surface_Average"); list.add("Pressure_Plane_Water_3-Surface_Average"); list.add("Pressure_Plane_Water_4-Surface_Average"); if (list.contains(FP.getPresentationName())){ FP.printReport(); } } } ************************************************** ************************************************** *********** ************************************************** ************************************************** *********** How can I print reports that only gives the name and value as for instance: Plane_Water_1 1.568415e+04 Also how can I print reports that begin with the same letters? |
You need to do:
SIM.println(FP.getPresentationName() + " " + FP.getReportMonitorValue()); |
me3840, thank you for your reply. It looks much better now. You are really great :)
|
May I ask you another question. All of this is for training purposes. I have created a basic model in Starccm+ with two boundaries. What I want to do is to increase the mass flow rate when the average velocity report on the pressure boundary is < 0. And decrease the massflow if the average velocity report is > 0. I want to basically balance the flow out from the pressure boundary. I have commented the places I have difficulties with.
private void execute0() { Simulation SIM = getActiveSimulation(); Region RG = SIM.getRegionManager().getRegion("Region 2"); AreaAverageReport AAR = ((AreaAverageReport) SIM.getReportManager().getReport("EQD_Average_Velo city")); Boundary EQD_p0 = RG.getBoundaryManager().getBoundary("Surface Extruder_EQD_p0.Original_part.pressure_out_EQD_p0" ); for(MassFlowRateProfile MF: EQD_p0.getValues().getObjectsOf(MassFlowRateProfil e.class)){ if(AAR.getReportMonitorValue() > 0){ // Here I want to decrease the massflow little by little until the velocity report is // 0. } if(AAR.getReportMonitorValue() > 0){ // Here I want to increase the massflow little by little until the velocity report is // 0. } } } |
I updated the code and the macro is running. However, it does not change the Mass flow rate value in starccm+ in region boundary. I want it to update that value every 50 iterations or so.
Simulation SIM = getActiveSimulation(); Region RG = SIM.getRegionManager().getRegion("Region 2"); AreaAverageReport AAR = ((AreaAverageReport) SIM.getReportManager().getReport("EQD_Average_Velo city")); Boundary EQD_p0 = RG.getBoundaryManager().getBoundary("Surface Extruder_EQD_p0.Original_part.pressure_out_EQD_p0" ); MassFlowRateProfile MF = EQD_p0.getValues().get(MassFlowRateProfile.class); for(;;){ SIM.getSimulationIterator().step(50); if(AAR.getReportMonitorValue() > 0){ MF.getMethod(ConstantScalarProfileMethod.class).ge tQuantity().setValue(1.0-(1/10)); SIM.println("Lowering the Mass Flow to" + "kg/s"); } if(AAR.getReportMonitorValue() < 0){ MF.getMethod(ConstantScalarProfileMethod.class).ge tQuantity().setValue(1.0+(1/10)); SIM.println("Raising the Mass Flow to" + "kg/s"); } } } |
I managed to solve this issue. Thank you for your help.
|
All times are GMT -4. The time now is 21:02. |