Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

PrepareRandomFieldSimulation Class Reference

Last update: 16.07.2025

A struct collecting export information for random field simulation data. More...

Public Member Functions

 check (Structure database)
 Checks validity of these data. More...
 
bool outputFilesExisting () const
 
 PrepareRandomFieldSimulation (ExportReferenceDesign reference_design, string the_path)
 constructor. It assumes that the base path is one directory level below the base path of the reference design. It further assumes a default for the design directory names and copies the information on the reference design More...
 
 save (Structure database)
 exports multiple designs to disk This method tries to export as much data as possible and does even proceed in case of errors. Important: the design directories to be exported to must already exist. More...
 

Public Attributes

string csv_parameter_file
 the file name of the CSV file containing the amplitudes (relative to More...
 
string database_file
 the file name of the database that stores the simulation data (relative to More...
 
string filelist_file
 the file name of the text file that contains the list of files to be modified (relative to More...
 
string new_filelist_file
 the file name of the text file that contains the list of files to be created (relative to More...
 
string path
 path (absolute path)
 
ExportReferenceDesign reference_design
 stores the information on the reference design/design directory template (defines which data to be exported)
 
bool replace_files
 if true, already existing files are to be replaced
 
string script_file
 the file name of the script to be executed for each design directory (relative to More...
 
string test_run_path
 defines the design directory name which is used for test runs (do nothing if empty). Ss relative to More...
 

Detailed Description

A struct collecting export information for random field simulation data.

The idea is the following:

  • The user generates all data required for simulating a random field in SoS. Example:
    • Import simulation responses from a robustness sampling
    • Perform Karhunen-Loeve expansion: Create amplitudes, create scatter shapes, create shape_mean and local error vectors
  • SoS selects those amplitudes the user wants to use for random field generation
  • SoS exports data to optiSLang:
    • a CSV file containing the amplitudes (needed by optiSLang to estimate the statistical properties of the amplitudes)
    • a SDB file that contains the reference mesh and a few data objects (the minimum set of required objects to generate field objects from given amplitudes). These are essentially scatter shapes and mean value vectors
    • a script file that is called by optiSLang for each design.
    • a text file that lists the files required for export: The first row denotes the base_path of the reference design. All other rows denote a filename (relative to the design path) which is required by the field data exporter. These file names are relative to the reference path.
  • optiSLang then calls for each design:
    • For each design given: the design number, the design path, path to SDB database, path to a csv file that contains the values of the amplitudes of this design (the CSV file only contains 2 rows. first row: amplitude idents; second row: the amplitude values, separated by a comma (",") ).
    • the script then generates the field quantities and exports them using previously defined export definition data...
      • It expects that the design path contains all field data files to be modified. Further it still assumes that the original reference path (for export definition) still exists.

To read a more detailed workflow with examples and so on refer to SectionAutomatedSimulationOfRandomFields .

Constructor & Destructor Documentation

◆ PrepareRandomFieldSimulation()

PrepareRandomFieldSimulation ( ExportReferenceDesign  reference_design,
string  the_path 
)

constructor. It assumes that the base path is one directory level below the base path of the reference design. It further assumes a default for the design directory names and copies the information on the reference design

Parameters
reference_designcontains info on the reference export design
the_pathdefines the output path

Member Function Documentation

◆ check()

check ( Structure  database)

Checks validity of these data.

If any of the specified directories or files does not exist, an exception is thrown It also checks the validity of the reference design It further checks if any of the objects to be exported does not exist. And if the scalar data contain valid amplitudes

Parameters
databasethe data base where the data is stored

◆ outputFilesExisting()

bool outputFilesExisting ( ) const
Returns
true if at least one of the output files are existing.

◆ save()

save ( Structure  database)

exports multiple designs to disk This method tries to export as much data as possible and does even proceed in case of errors. Important: the design directories to be exported to must already exist.

Parameters
databasethe data base where all data is contained.

Member Data Documentation

◆ csv_parameter_file

string csv_parameter_file

the file name of the CSV file containing the amplitudes (relative to

See also
path)

◆ database_file

string database_file

the file name of the database that stores the simulation data (relative to

See also
path)

◆ filelist_file

string filelist_file

the file name of the text file that contains the list of files to be modified (relative to

See also
path)

◆ new_filelist_file

string new_filelist_file

the file name of the text file that contains the list of files to be created (relative to

See also
path)

◆ script_file

string script_file

the file name of the script to be executed for each design directory (relative to

See also
path)

◆ test_run_path

string test_run_path

defines the design directory name which is used for test runs (do nothing if empty). Ss relative to

See also
path. Default: "Design0001".

Connect with Ansys