CFD Online Logo CFD Online URL
Home > Forums > STAR-CCM+

Need help with a macro

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

LinkBack Thread Tools Display Modes
Old   February 13, 2013, 06:50
Default Need help with a macro
New Member
Tapan Shah
Join Date: Feb 2012
Posts: 5
Rep Power: 7
tapanshah001 is on a distinguished road
Hello guys,

I am to simulating the performance of a Vertical axis wind turbine(3 blades) in Star-CCM+.My case is unsteady.
My rotation is free and is depending on the torque generated about central axis due to aerodynamic forces. Now i need to calculate the relative Lift and drag for each blades. For doing this i am resolving the free stream vector and the rotation rate vector for each time step, which give me the relative angle of attack . From this i can evaluate the direction of life and drag. This direction is then to be specified in the force report for lift and drag in Star-CCM+.

I am also sharing the macro which i have developed, which is not working.
(I am not good with java coding!!)

I can also mail u the basic concept or the formulas that i want to incorporate. Can't upload here to to size issues.

Can someone please help me out....!!
Attached Files
File Type: txt Lift and drag macroo.txt (2.9 KB, 27 views)
tapanshah001 is offline   Reply With Quote

Old   February 13, 2013, 10:42
Ryan Coe
Join Date: Jun 2010
Location: Albuquerque, NM
Posts: 98
Rep Power: 9
ryancoe is on a distinguished road
So you are using the torque value(s) from the report(s) to set the rotation rate of the region? Is there anything specific about the macro you had an issue with? Java can be intimidating at first if you're used to higher level programming (e.g., Matlab), but if you take the time to learn the basics it can be very helpful in STAR. I think you may want something more the like the psuedo-Java below.

// STAR-CCM+ macro:
package macro;

import java.util.*;

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

import star.common.ImplicitUnsteadySolver;
import star.common.PhysicalTimeStoppingCriterion;
import star.common.Simulation;
import star.common.StarMacro;
import star.motion.MotionManager;
import star.motion.RotatingMotion;

public class LiftAndDrag extends StarMacro {

  private void execute0() {

	// Set up simulation and macro objects 
	Simulation mysim = getActiveSimulation();
	double theta;
	double resultant;
	double alpha;
    double RotationRate;
	double timeStep;
	rotation = (RotatingMotion) mysim.get(MotionManager.class).getObject("Rotation");			
	RotationRate = rotation.getRotationRate().getValue();
	timeStep = ((ImplicitUnsteadySolver) mysim.getSolverManager().getSolver(ImplicitUnsteadySolver.class)).getTimeStep().getValue();
	// and so on
	// Running loop
	while (SimulationTime < TimeLimit) {
		// Run one iteration
		// Check report values
		// assign rotation rate
Have you considered using a 6-DOF Rotation model instead?
ryancoe is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
StarCCM+ Command line options and Macro execution isidp STAR-CCM+ 8 January 29, 2013 06:00
Macro Trouble -Winows Explorer Crashes with Macro Martin Castillo FLUENT 1 July 25, 2007 04:18
Macro problem cfddummy Siemens 1 April 9, 2007 12:37
Call a macro from a macro Flav Siemens 2 July 1, 2004 05:42
Bug in the DEFINE_ADJUST macro? Senthil FLUENT 5 September 3, 2002 22:26

All times are GMT -4. The time now is 10:17.