ALFAcase Syntax

An ALFAcase file is a text-based file that must be written following the YAML syntax, only a restricted subset of the YAML specification is supported and the this section and the next cover the differences.

Our root object is a map (equivalent to a dictionary) that represents a CaseDescription with its attributes.

The majority of the values from ALFAcase are based on key and value, the example below illustrates some of these cases:

key and value syntax
 key: value

 # Case 1
 material_name: string

 # Case 2
 string: string

 # Case 3
 mass_fractions:
 string:
   value: number
   unit: string

 # Case 4
 position:
 values: [ number ]
 unit: string

 # Case 5
 node_type: NodeCellType⠀

 # Case 6
 physics: physics_description_schema⠀
Case 1:

material_name is a pre-defined key and you can just inform the value (string).

Example

material_name: Steel

Check the String section for more information on the possible ways to enter a string

Case 2:

Both key and value must be informed (note the string indication)

Example

PVTModelName: some_name

Check the String section for more information on the possible ways to enter a string

Case 3:

The key mass_fractions is creating a mapping with the string informed as key, and for each entry, two keys are required value and unit.

Example

mass_fractions:
  first entry:
    value: 42
    unit: m
  second entry:
    value: 1.5
    unit: m

Info

All entries that accept a string as a key can have multiples entries, as demonstrated above.

About the unit

The unit depends on the category of the attribute, the Full API Reference lists the category and the valid units for each attribute.

Check the Number section for more information on the possible ways to enter a number

Case 4:

Similar to Case 3, but instead of a single value it accepts multiples values

Example

position:
  values: [ 1.5, 4.5 ]
  unit: m

Check the section List for more information about how to creates a list

Case 5:

In this case, the value is an Enum and one of the options must be filled, each attribute listed on Full API Reference has a link for the respective Enum to check all options, on the example, bellow is used a NodeCellType that has the following options

class NodeCellType(value)

An enumeration.

Example

node_type: mass_source_boundary⠀
Case 6:

The last case is a composition of components, the definition is informing that the value of physics must be filled with the key and values defined for PhysicsDescription

Example

physics:
  hydrodynamic_model: hydrodynamic_model_4_fields
  simulation_regime: simulation_regime_transient

All the definitions offer default values, this allows us to abbreviate the syntax and let ALFAsim-SDK just use its defaults. Check the Full API Reference section which informs all the default values of each attribute on each Description.

The next sections go deep on the syntax, showing different ways to fill some values.

String

string syntax
 # key: value
 material_name: Another value goes here.

 # It is possible to put quotes in a string, but it is not necessary
 material_name: 'A string, enclosed in quotes.'

 # variable: variable
 key with spaces: value

Number

number syntax
 # Integer
 value: 100

 # Float
 value: 1.5

 # Scientific Notation
 value: 1e+12

List

list is a sequence of values and on ALFAcase list is denoted by a series of dashes (-) It is possible to define a list in a compressed inserting the value between brackets ([ ]):

list syntax
 values:
   - 1
   - 2
   - 3

 # Flow style
 values: [ 1, 2 , 3 ]

Bool

bool is case-insensitive and accepts the following options:

boolean syntax
enable_solver_caching: True     # True
enable_solver_caching: true     # True
enable_solver_caching: yes      # True
enable_solver_caching: on       # True
enable_solver_caching: 1        # True
enable_solver_caching: False    # False
enable_solver_caching: false    # False
enable_solver_caching: no       # False
enable_solver_caching: off      # False
enable_solver_caching: 0        # False