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

Need help with a macro

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 13, 2013, 06:50
Default Need help with a macro
  #1
New Member
 
Tapan Shah
Join Date: Feb 2012
Posts: 5
Rep Power: 5
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, 23 views)
tapanshah001 is offline   Reply With Quote

Old   February 13, 2013, 10:42
Default
  #2
Member
 
Ryan Coe
Join Date: Jun 2010
Location: Albuquerque, NM
Posts: 98
Rep Power: 7
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.

Code:
// STAR-CCM+ macro: LiftAndDrag.java
package macro;

import java.util.*;

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

import star.base.report.Report;
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();
	theta=((RotationRate*timestep)+theta);
	resultant=((((((sin(theta))-(RotationRate*cos(theta)))^2)-((((cos(theta))-(RotationRate*sin(theta)))^2))^(1/2))));
	Alpha=asin(((RotationRate)*sin(theta))/(resultant)); 
	
	// 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?
__________________
Ryan
ryancoe is offline   Reply With Quote

Reply

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 CD-adapco 1 April 9, 2007 12:37
Call a macro from a macro Flav CD-adapco 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 21:25.