CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   Java Macro to change rigid body degree of freedom during the simulation (https://www.cfd-online.com/Forums/siemens/160507-java-macro-change-rigid-body-degree-freedom-during-simulation.html)

Ahmed Elhanafi October 9, 2015 05:59

Java Macro to change rigid body degree of freedom during the simulation
 
Hi Everyone,

I'm looking for a way to enable/disable one degree of freedom in DFBI in Star-CCM+. I tried using Java macro to do this for me after a certain time, but it didn't work. This is what I used:

// STAR-CCM+ macro: DFBI.java
// Written by STAR-CCM+ 10.02.010
package macro;

import java.util.*;

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

public class DFBI extends StarMacro {

public void execute() {
execute0();
}

private void execute0() {

Simulation simulation_0 =
getActiveSimulation();


PhysicalTimeStoppingCriterion physicalTimeStoppingCriterion_0 =
((PhysicalTimeStoppingCriterion) simulation_0.getSolverStoppingCriterionManager().g etSolverStoppingCriterion("Maximum Physical Time"));

if (simulation_0.getSolution().getPhysicalTime()>0.2)


{Body body_0 =
((Body) simulation_0.get(BodyManager.class).getObject("Bod y 1"));

((BodyFreeMotion) body_0.getMotionType()).setFreeTranslationX(false) ;}
}
}


I hope you can help me.

Cheers,

Ahmed.


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