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.
CaseDescription
The majority of the values from ALFAcase are based on key and value, the example below illustrates some of these cases:
key
value
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⠀
material_name is a pre-defined key and you can just inform the value (string).
material_name
string
Example
material_name: Steel
Check the String section for more information on the possible ways to enter a string
Both key and value must be informed (note the string indication)
PVTModelName: some_name
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.
mass_fractions
unit
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
number
Similar to Case 3, but instead of a single value it accepts multiples values
Case 3
position: values: [ 1.5, 4.5 ] unit: m
Check the section List for more information about how to creates a list
list
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
Enum
NodeCellType
An enumeration.
node_type: mass_source_boundary⠀
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
PhysicsDescription
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.
Description
The next sections go deep on the syntax, showing different ways to fill some values.
# 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
# Integer value: 100 # Float value: 1.5 # Scientific Notation value: 1e+12
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 ([ ]):
-
[
]
values: - 1 - 2 - 3 # Flow style values: [ 1, 2 , 3 ]
bool is case-insensitive and accepts the following options:
bool
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
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