CFD Online Discussion Forums

CFD Online Discussion Forums (
-   STAR-CCM+ (
-   -   Need help with a macro (

tapanshah001 February 13, 2013 06:50

Need help with a macro
1 Attachment(s)
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....!!

ryancoe February 13, 2013 10:42

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?

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