CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Create Iterative Macro

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2019, 04:48
Exclamation Create Iterative Macro
  #1
New Member
 
Join Date: Jul 2019
Posts: 3
Rep Power: 6
michele21 is on a distinguished road
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
michele21 is offline   Reply With Quote

Old   July 10, 2019, 20:14
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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.
me3840 is offline   Reply With Quote

Old   July 11, 2019, 05:52
Default
  #3
New Member
 
Join Date: Jul 2019
Posts: 3
Rep Power: 6
michele21 is on a distinguished road
Quote:
Originally Posted by me3840 View Post
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.
Thank you for your reply; maybe I bad explained my problem, the issues not how to remove cells that have specific velocity value but to do it for each iteration in case velocity exceed a specific value in an automated way; anyway I've found a solution doing a for cycle with an if condition e give a single step run every time that cycle for runs. Thats the macro:

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}"));

}
}
michele21 is offline   Reply With Quote

Old   July 12, 2019, 20:21
Default
  #4
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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.
me3840 is offline   Reply With Quote

Old   July 15, 2019, 05:19
Default
  #5
New Member
 
Join Date: Jul 2019
Posts: 3
Rep Power: 6
michele21 is on a distinguished road
Quote:
Originally Posted by me3840 View Post
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.
Sorry for replying too late... how can I create a damping source and what kind of source ? Unfortunately I'm studying a case in which I cannot change the surface tessellation and the solver has to be the coupled implicit. The main problem is that the mesh is highly sensitive to the order of discretization scheme and switching from 1st order to 2nd order generate the high velocity cell..

Thanks for you help
michele21 is offline   Reply With Quote

Reply

Tags
macro java, star ccm+

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 06:47
[gmsh] How to create a 3D volume mesh using a existing surface mesh?! RobertHB Mesh Generation & Pre-Processing 0 July 20, 2017 08:12
[ICEM] how to create a 2d tri mesh with quad mesh in the boundary layer seal2013 ANSYS Meshing & Geometry 3 October 6, 2013 16:09
Actuator disk model audrich FLUENT 0 September 21, 2009 07:06
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 01:07


All times are GMT -4. The time now is 05:23.