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

java macro to set angle of attack

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By kiteguy
  • 3 Post By kiteguy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2021, 17:11
Default java macro to set angle of attack
  #1
New Member
 
Georg
Join Date: Dec 2020
Posts: 10
Rep Power: 6
kiteguy is on a distinguished road
Hi everyone,

I am trying to script a macro that lets me set the angle of attack in my simulation through the command line before running it, but I am struggling to wrap my head around the -jvmargs option.

To be precise, I would like to change the value 14.0 in the following line of the macro to an arbitrary value that I can input from the command line
-> scalarGlobalParameter_0.getQuantity().setValue(14. 0);

Would this be the proper way to parse a "newaoa" value of 10 deg to the macro?
-> starccm+ -power -batch change_aoa.java -jvmargs -Dnewaoa=10.0 -np 1 testsim.sim

And how would I need to change the line from the macro to use that new aoa?

Does anybody here have some experience with similar cases? I would really appreciate the help

BR!
anan12345 likes this.
kiteguy is offline   Reply With Quote

Old   May 23, 2021, 09:16
Default fixed it
  #2
New Member
 
Georg
Join Date: Dec 2020
Posts: 10
Rep Power: 6
kiteguy is on a distinguished road
I figured it out now and thought I'd post a minimum working example for anyone stumbling over the same problem in the future:

Code:
// Simcenter STAR-CCM+ macro: change_aoa.java
// Written by Simcenter STAR-CCM+ 16.02.009
package macro;

import java.util.*;

import star.common.*;
import star.base.neo.*;

public class change_aoa extends StarMacro {

  public void execute() {
    execute0();
  }

  private void execute0() {
	
    Simulation simulation_0 = 
      getActiveSimulation();

    ScalarGlobalParameter scalarGlobalParameter_0 = 
      ((ScalarGlobalParameter) simulation_0.get(GlobalParameterManager.class).getObject("aoa"));

	String newaoa = System.getProperty("newaoa");

	Double x = 	Double.parseDouble(newaoa);

    scalarGlobalParameter_0.getQuantity().setValue(x);

    Units units_0 = ((Units) simulation_0.getUnitsManager().getObject("deg"));

    scalarGlobalParameter_0.getQuantity().setUnits(units_0);
  }
}
the syntax to input the angle of attack from the command line is:

Code:
starccm+ -power -podkey <podkey> -licpath <licpath> -batch change_aoa.java -jvmargs -Dnewaoa=8 testsim.sim
bluebase, emba and anan12345 like this.
kiteguy is offline   Reply With Quote

Reply


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
Macro to access java files in sub-directory abraum STAR-CCM+ 3 July 11, 2012 02:46
how to plot attack angle along with impeller span direction at leading edge wildli FLUENT 0 August 31, 2010 14:47
convegence problem with high angle of attack littlelz CFX 2 October 28, 2009 06:07
introducing angle of attack on ICEMCFD HEXA icem beginner FLUENT 2 December 6, 2008 15:34
Proper output of angle of attack in CFX post Kevin CFX 3 October 18, 2006 12:18


All times are GMT -4. The time now is 11:53.