Model configuration#

This module contains a collection of classes for creating a model configuration. The model configuration defines the model’s inputs, outputs, Global Coefficients, build duration and project. The resulting (ModelConfiguration) object is subsequently used to train a model.

GlobalCoefficientDefinition#

class GlobalCoefficientDefinition#

Global coefficient definition/parameter field.

Parameters:
  • formula (str) – Global Coefficient formula.

  • name (str) – Global Coefficient name.

DomainAxisDefinition#

class DomainAxisDefinition#

Defines an axis in the Domain of Analysis.

Parameters:
  • position (Literal['relative_to_min', 'relative_to_max', 'relative_to_center', 'absolute']) –

    Anchor point position.

    relative_to_min: VolXmin = xmin - value
    relative_to_max: VolXmax = xmax + value
    relative_to_center: (xmin+xmax)/2 - value
    absolute: VolXmin = value

  • value (float) – Distance of the anchor from the position. When position=absolute, the distance can be either positive or negative. In any other case, only positive values are accepted.

  • length (float) – Length of the Domain of Analysis along the axis. Only positive numbers are accepted.

Example

Define the Z-axis(i.e., height) in a Domain of Analysis

from ansys.simai.core.data.models import DomainAxisDefinition, DomainOfAnalysis

# Get the last configuration from a project
bld_conf = my_project.last_model_configuration

# Define a new axis for the Domain of Analysis
new_doa_height = DomainAxisDefinition("relative_to_min", 180.5, 99.1)

# Assign the new Domain of Analysis to the configuration
bld_conf.domain_of_analysis.height = new_doa_height

DomainOfAnalysis#

class DomainOfAnalysis#

Defines the Domain of Analysis.

Parameters:

Example

Get the Domain of Analysis from a configuration and replace it with a new one

from ansys.simai.core.data.models import DomainOfAnalysis

# Get the last configuration from a project
bld_conf = my_project.last_model_configuration

# Define a new Domain of Analysis
new_doa = DomainOfAnalysis(
    length=("relative_to_max", 5, 8.1),
    width=("relative_to_max", 5, 8.1),
    height=("absolute", -4.5, 0.1),
)

# Assign the new Domain of Analysis to the configuration
bld_conf.domain_of_analysis = new_doa

ModelInput#

class ModelInput#

Model inputs.

Parameters:
  • surface (list[str]) – Input surface variables.

  • boundary_conditions (list[str]) – Boundary conditions.

ModelOutput#

class ModelOutput#

The outputs of a model.

Parameters:
  • surface (list[str]) – the output surface variables.

  • volume (list[str]) – the output volume variables.

ModelConfiguration#

class ModelConfiguration#

Configures the build of a model.

Parameters:
  • project (Project) – the project of the configuration.

  • build_preset (str | None) –

    indicates the build duration. Available options:

    debug: < 30 min, only 4 dat
    1_day: < 24 hours
    2_days: < 2 days, default value.
    7_days: < 1 week

  • continuous (bool) – indicates if continuous learning is enabled. Default is False.

  • input (ModelInput | None) – the inputs of the model.

  • output (ModelOutput | None) – the outputs of the model.

  • global_coefficients (list[GlobalCoefficientDefinition] | None) – the Global Coefficients of the model.

  • domain_of_analysis (DomainOfAnalysis | None) – The Domain of Analysis of the model configuration.

  • pp_input (PostProcessInput | None) – The post-processing input (e.g. a surface variable).

Example

Define a new configuration and launch a build.

import ansys.simai.core as asc
from ansys.simai.core.data.model_configuration import (
    DomainAxisDefinition,
    DomainOfAnalysis,
    ModelConfiguration,
    ModelInput,
    ModelOutput,
    PostProcessInput,
)

simai = asc.from_config()

# Get the project of interest
aero_dyn_project = simai.projects.get(name="aero-dyn")

# Define the inputs of the model
model_input = ModelInput(surface=["Velocity"], boundary_conditions=["Vx"])

# Define the outputs of the model
model_output = ModelOutput(
    surface=["Pressure", "WallShearStress_0"], volume=["Velocity_0", "Pressure"]
)

# Define the surface post-processing input
pp_input = PostProcessInput(surface=["Temperature_1"])

# Define the model coefficients
global_coefficients = [("max(Pressure)", "maxpress")]

# Set the Domain of Analysis
doa = DomainOfAnalysis(
    length=("relative_to_max", 5, 8.1),
    width=("relative_to_max", 5, 8.1),
    height=("absolute", -4.5, 0.1),
)

# Define the build configuration for the model
new_conf = ModelConfiguration(
    project=aero_dyn_project,
    build_preset="debug",
    continuous=False,
    input=model_input,
    output=model_output,
    global_coefficients=global_coefficients,
    domain_of_analysis=doa,
    pp_input=pp_input,
)

# Launch a mode build with the new configuration
new_model = simai.models.build(new_conf)

Sets the properties of a build configuration.

compute_global_coefficient()#

Computes the results of the formula for all global coefficients with respect to the project’s sample.

PostProcessInput#

class PostProcessInput#

Designates the variables to use as post-processing input.

Parameters:

surface (list[str]) – the post-processing input surface variables.