CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   STAR-CCM+ (https://www.cfd-online.com/Forums/star-ccm/)
-   -   Dynamic Change of Boundary Conditions (https://www.cfd-online.com/Forums/star-ccm/139614-dynamic-change-boundary-conditions.html)

SimonP July 28, 2014 04:51

Dynamic Change of Boundary Conditions
 
Hi everyone,

I'm working with STAR-CCM+ and am running a VOF-based simulation. I would like to change a boundary condition type from Pressure to Wall after I have reached an quasi-static state.

I'm controlling my simulation via an external Java-File already, so some coding effort won't be the problem.

I need something like this:
If Updateevent_1 = True
change boundary_condition_type to "Wall"


But at this point I face the problem that I'm not too sure (and it didn't work so far), whether this external Script can actually call the current state of a variable which would be necessary in this case. My efforts so far have failed, since Starccm+ Macro recorder generates its own variable-types which are incompatible with common Java-if-loops.

Any ideas on tackling this problem via the script (or an alternate possibility?)

Cheers
Simon

me3840 July 28, 2014 10:58

Just do something like:

Code:

Simulation sim = getActiveSimulation();
       
        LogicUpdateEvent logicUpdateEvent =((LogicUpdateEvent) sim.getUpdateEventManager().getUpdateEvent("Logic Event"));
       
        if (!(logicUpdateEvent.getEvaluatedState())) {
            Region region = sim.getRegionManager().getRegion("RegionName");
            Boundary boundary = region.getBoundaryManager().getBoundary("Boundary");
            boundary.setBoundaryType(WallBoundary.class);
        }


SimonP July 31, 2014 04:15

Cheers
 
Thanks for your help, since I wanted to add some more function features I did sth like this:

public void execute() {
execute0();
execute1();

}

private void execute0() {

Boundary Condition A
Stopping Crtieria A
}

private void execute1() {

Boundary Condition B
Stopping Crtieria B
}


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