|
[Sponsors] |
July 3, 2019, 05:48 |
Create Iterative Macro
|
#1 |
New Member
Join Date: Jul 2019
Posts: 3
Rep Power: 7 |
Hello everyone,
I need to write a macro to automate the following procedure: remove cell where velocity magnitude exceed a certain value (say 80 m/s) and re-run the simulation. By now, i create a stopping criteria based on a max value of velocity monitor and every time this criterion is satisfied the simulation stop and save; then I start a macro which remove cells where velocity exceed a chosen value and restart the simulation. Because this limit is reached often I want to automate this procedure whit a cycle based on the stopping criteria which in the case this stopping criteria is satisfied remove cell and run simulation without done manually every time. Hope someone can help me Michele |
|
July 10, 2019, 21:14 |
|
#2 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25 |
Look at the remove invalid cells feature. It has the ability to let you specify a function with which to remove cells from a field function. Record yourself a macro doing just that and you should have everything you need.
|
|
July 11, 2019, 06:52 |
|
#3 | |
New Member
Join Date: Jul 2019
Posts: 3
Rep Power: 7 |
Quote:
for (int i=0; i<4000; i++){ simulation_0.getSimulationIterator().run(1); double a ; a = maxReport_0.getValue(); if ( a >= 100.0 ) { Units units_0 = simulation_0.getUnitsManager().getPreferredUnits(n ew IntVector(new int[] {0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); Units units_1 = simulation_0.getUnitsManager().getPreferredUnits(n ew IntVector(new int[] {0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); Units units_2 = simulation_0.getUnitsManager().hasPreferredUnits(n ew IntVector(new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); Units units_3 = simulation_0.getUnitsManager().hasPreferredUnits(n ew IntVector(new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0})); MeshManager meshManager_0 = simulation_0.getMeshManager(); Region region_0 = simulation_0.getRegionManager().getRegion("Region_ 1"); meshManager_0.removeInvalidCells(new NeoObjectVector(new Object[] {region_0}), NeoProperty.fromString("{\'minimumContiguousFaceAr ea\': 0.0, \'minimumCellVolumeEnabled\': true, \'minimumVolumeChangeEnabled\': false, \'functionOperator\': 1, \'minimumContiguousFaceAreaEnabled\': false, \'minimumFaceValidityEnabled\': false, \'functionValue\': 90.0, \'functionEnabled\': true, \'function\': \'VelocityMagnitude\', \'minimumVolumeChange\': 1.0E-10, \'minimumCellVolume\': 0.0, \'minimumCellQualityEnabled\': true, \'minimumCellQuality\': 1.0E-5, \'minimumDiscontiguousCells\': 1, \'minimumDiscontiguousCellsEnabled\': false, \'minimumFaceValidity\': 0.51}")); } } |
||
July 12, 2019, 21:21 |
|
#4 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25 |
I really don't suggest doing this every iteration, it's bound to be extremely slow, especially if there's a lot of removals.
You're better off creating a damping source term or just improving the mesh if your mesh quality is the problem. |
|
July 15, 2019, 06:19 |
|
#5 | |
New Member
Join Date: Jul 2019
Posts: 3
Rep Power: 7 |
Quote:
Thanks for you help |
||
Tags |
macro java, star ccm+ |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFoam "Permission denied" and "command not found" problems. | iyidaniel@yahoo.co.uk | OpenFOAM Running, Solving & CFD | 11 | January 2, 2018 07:47 |
[gmsh] How to create a 3D volume mesh using a existing surface mesh?! | RobertHB | Mesh Generation & Pre-Processing | 0 | July 20, 2017 09:12 |
[ICEM] how to create a 2d tri mesh with quad mesh in the boundary layer | seal2013 | ANSYS Meshing & Geometry | 3 | October 6, 2013 17:09 |
Actuator disk model | audrich | FLUENT | 0 | September 21, 2009 08:06 |
Where's the singularity/mesh flaw? | audrich | FLUENT | 3 | August 4, 2009 02:07 |