|
[Sponsors] |
July 10, 2017, 09:11 |
Java
|
#1 |
New Member
Vincent
Join Date: Jul 2017
Posts: 9
Rep Power: 8 |
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? Last edited by Vincent_GDC; July 10, 2017 at 12:13. |
|
July 10, 2017, 22:13 |
|
#2 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24 |
You need to do:
SIM.println(FP.getPresentationName() + " " + FP.getReportMonitorValue()); |
|
July 11, 2017, 06:04 |
|
#3 |
New Member
Vincent
Join Date: Jul 2017
Posts: 9
Rep Power: 8 |
me3840, thank you for your reply. It looks much better now. You are really great
|
|
July 11, 2017, 07:43 |
|
#4 |
New Member
Vincent
Join Date: Jul 2017
Posts: 9
Rep Power: 8 |
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. } } } |
|
July 11, 2017, 09:06 |
|
#5 |
New Member
Vincent
Join Date: Jul 2017
Posts: 9
Rep Power: 8 |
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"); } } } |
|
July 13, 2017, 07:34 |
|
#6 |
New Member
Vincent
Join Date: Jul 2017
Posts: 9
Rep Power: 8 |
I managed to solve this issue. Thank you for your help.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Java | sarahtuvia | STAR-CCM+ | 0 | March 31, 2016 10:42 |
Running salome-meca from a java script | Iche_Bins | Structural Mechanics | 0 | October 9, 2013 06:44 |
Macro to access java files in sub-directory | abraum | STAR-CCM+ | 3 | July 11, 2012 02:46 |
Getting OpenFOAM to coexist with an existing JAVA VM | nik777 | OpenFOAM Installation | 5 | February 22, 2007 07:21 |
java vs c++ | zxaar | Main CFD Forum | 10 | December 3, 2004 02:05 |