Boundary Conditions

Applying boundary conditions with a script is very similar to assigning boundary conditions through the user interface. The same inputs are required--selection mode, boundary condition type, value, and units, as well as selected entity:

// Apply boundary conditions.

log.write("Applying boundary conditions...");

a.selectionMode = "Surface";

a.selectionBasis = "Direct";

// Inlet

bc = new BoundaryCondition("Normal Velocity");

bc.value = 250;

bc.units = "in/s";

A line-by-line description of this is given:

A comment followed by a line written to the console:

// Apply boundary conditions.

log.write("Applying boundary conditions...");

sets the selection mode to surface:

a.selectionMode = "Surface";

sets direct selection of entities:

a.selectionBasis = "Direct";

creates a boundarycondition object called bc that will apply a normal velocity condition:

bc = new BoundaryCondition("Normal Velocity");

The value of the velocity condition is 250. Note that the bc object is modfied:

bc.value = 250;

The units are inches per second:

bc.units = "in/s";

Select surface with ID 9 (knowledge of surface ID’s is required):

a.select(9);

assign the boundary condition defined as the bc boundarycondition object:

a.applyBoundaryCondition(bc);

An alternative method is to use the BoundaryCondition class method called setValue:

bc = new BoundaryCondition("Pressure");

bc.setValue(0, “psi”);

a.select(15);

a.applyBoundaryCondition(bc);