Model

class mstar.MStarModel

The M-Star document, containing components and geometry that describe the simulation. To create or load msb files, use the mstar.Load() method

import mstar

# Create a new empty model
model = mstar.Load()

# Load an existing model from a file
model = mstar.Load("MyModel.msb")
MStarModel.Get(name)

Find a component by name.

Returns:

The component

Return type:

MStarComponent

MStarModel.GetSimParams()

Get the simulation parameters object. Convenience method.

Returns:

The simulation parameters component

Return type:

MStarComponent

MStarModel.GetLattice()

Get the main lattice object. Convenience method.

Returns:

The main lattice component

Return type:

MStarComponent

MStarModel.GetFluidModel()

Get the fluid model object.

Returns:

The fluid model component

Return type:

MStarComponent

MStarModel.GetOutputConfig()

Get the output configuration object. Main entrypoint to change any of the output options

Returns:

Output configuration

Return type:

ModelOutput

MStarModel.Print(activeOnly=True)

Print the model tree to the screen

Parameters:

activeOnly (bool) – Only show the active properties. If False, will show every property in the model.

MStarModel.Save(fn)

Save the model as a file

Parameters:

fn (str) – The filename to save

Returns:

True if success

Return type:

bool

MStarModel.Export(directoryPath)

Export the model to solver files (xml, stl, etc)

Parameters:

directoryPath (str) – The directory to export to. Directory must already exist

Returns:

True if successful

Return type:

bool

MStarModel.ExportXml(filename)

Export the model to solver xml file (*.xml)

Parameters:

filename (str) – The filename to write

Returns:

True if successful

Return type:

bool

MStarModel.Check()

Check model for errors

Returns:

List of errors ComponentError

Return type:

list[ComponentError]

MStarModel.GetMainPartition()

Partition for main model data.

Return type:

TObj_Partition

Returns:

The TObj_Partition object

MStarModel.GetWorkFlowPartition()

Partition for workflow data (parameter sweeps)

Return type:

WorkflowPartition

Returns:

The WorkflowPartition object

MStarModel.GetUpDirection()

Get model up direction

Return type:

Dir

MStarModel.SetUpDirection(upDir)

Set model up direction

Parameters:

upDir (Dir) – Up direction

MStarModel.AddComponent(typeDesc)

Add a component to the root level of the model. See the Type descriptors for AddComponent()

Parameters:

typeDesc (str) – Type descriptor

Returns:

created component

Return type:

MStarComponent

MStarModel.Remove(name)

Remove a component by name

Parameters:

name (str) – The name of the component to remove

Returns:

True if successful

Return type:

bool

MStarModel.GetFluidModelType(ftype)
Return type:

FluidModelType

MStarModel.SetFluidModelType(ftype)

Change the fluid model type

import mstar
model = mstar.Load()
model.SetFluidModelType(mstar.FluidModelType.FreeSurface)
Parameters:

ftype (FluidModelType) – type of fluid

MStarModel.ChangeFluid(name)

Change the fluid model.

Parameters:

name (str) – The type name of the fluid. Available types are: SinglePhase, FreeSurface, Miscible, Immiscible, NoFluid

Returns:

True if successful

Return type:

bool

MStarModel.ListChildren()

Returns list of all component names in model

Returns:

List of names

Return type:

list[str]

MStarModel.IsNull()

Checks if the model instance is null. This can happen under certain circumstances where an invalid file or catalog item is specified.

Returns:

True if model is null.

MStarModel.Close()

Closes the model

MStarModel.DumpJson()

Dump json format string of model components and properties

MStarModel.DumpHtml()

Dump html format string of model components and properties

MStarModel.DumpHtmlFile(filename)

Dump html format to file of model components and properties

Parameters:

filename (str) – Output filename

class mstar.FluidModelType

Enum class for fluid model types

  • SinglePhase

  • FreeSurface

  • Miscible

  • Immiscible

  • NoFluid (Background Fluid in GUI)

  • NullFluid (No Fluid in GUI)

Type descriptors for AddComponent()

The below lists indicate the name to pass into the MStarModel.AddComponent() or MStarComponent.AddComponent() method.

For example the follow code will create a Global Variable object and name it “my_global”

gv = mstar.AddComponent("GlobalVariable")
gv.SetName("my_global")

To append a child object to a component, get a component object from the model and then use its AddComponent() method. For example, the below code will add a refinement lattice

# model is MStarModel instance we have loaded
refine0 = model.GetLattice().AddComponent("Refinement")

Fundamentals

  • Static

  • Moving

  • InletOutlet

  • MovingInletOutlet

Geometry

  • ImportedGeometry

  • BRepGeometry

Particles

  • Particles

  • Bubbles

  • Droplets

  • Tracers

  • DEMParticles

  • Sink

  • ReactionOnParticle

Scalars

  • Scalar

  • Reaction

  • MiscibleScalar

Variables

  • GlobalVariable

  • GlobalConstants

  • CustomVariable

  • CustomParticleVariable

  • CustomStaticBodyVariable

Thermal

  • Thermal

  • HeatConductionVolume

  • HeatConductionSurface

  • Heat3DSurfaceBc

  • Heat3DVolumeBc

  • HeatConductionContact

Runtime

  • CustomScript

  • ConvergenceMetric

  • MeanAge

  • ZonalAnalysis

  • MovingAverageFilter

  • ControlLoop or PIDControl

  • StatisticFilter

  • EventDetector

  • MovingAverageFilter

  • LookupTable

  • UDFLibrary

  • UDFRegion

Lattice

  • Refine or Refinement

  • CullingZone or InclusionZone

  • Screen or LatticeScreen

  • PorousMedium

Output

  • Probe

  • ProbeArray

  • OutputPlane

  • OutputSurface

  • OutputLine

  • ControlVolume

  • IsoSurface

  • IsoSurfaceVariable