transat package

Submodules

transat.simulation Top-level module for TransAT simulation projects
transat.appbuilder

transat.simulation module

Top-level module for TransAT simulation projects

class transat.simulation.Simulation(name='simulation')

Bases: object

TransAT simulation project

A simulation object contains all the data related to a TransAT project (setup, inputs, workflow, individual tasks, result data, etc...)

add_postprocess(module_name, worker_name='local')

register a postprocessing module for use with this simulation object

Extended description of function.

Parameters:
  • module_name (str) – path to the postprocessing module
  • worker_name (str optional) – name of the worker, default is local
get_bc(name)

Get a Boundary Condition object by name

The name of the boundary condition refers to the label of that boundary condition in TransAT GUI

Parameters:name (str) – name (or label) of the boundary condition, as in TransAT GUI
Returns:Boundary Condition object
Return type:transat.setup.bc.BC

See also

The list of available boundary conditions is returned by the function get_bc_names()

get_bc_names()

Get the list of all Boundary Conditions by name

The names of the boundary condition refer to the label of these boundary conditions in TransAT GUI

Parameters:name (str) – name (or label) of the boundary condition, as in TransAT GUI
Returns:Boundary Condition object
Return type:transat.setup.bc.BC

See also

To access a given Boundary Condition object, use the get_bc() function

load(key)

Load object from database

All types of objects can be stored and retrieved

Parameters:key (str) – Primary key
Returns:data stored under this key for the current simulation object
Return type:Data
load_path(key)

Load path from the database

Retrive the path for a worker in the database

Parameters:key (str) – worker name
Returns:path
Return type:str
load_template(dirname)

Load a setup from a template, typically created using a GUI

It is necessary to start a simulation object with a template and then to modify it using the API. If the directory given as input does not exist in the current directory (where the python command is launched), the function will go in the installation folder and look in the provided templates.

Parameters:dirname (str) – path to the project directory
prepare_simulation_files()

Write the input files for TransAT solvers

This function should be run after the template is loaded and after all the parameters have been changed

run(worker=None, nprocs=1, url=None)

Run TransAT simulation to steady state

Run TransAT solver. If URL is passed it will run it on TransAT-Server.

Parameters:
  • worker (Worker, optional) – Worker where the task will be executed, default to localhost
  • nprocs (int, optional) – Number of processor
  • url (str, optional) – URL of the TransAT-server
run_init(worker=None, nprocs=1, url=None)

Initialize TransAT simulation

Compile and run the initial conditions. If URL is passed it will run it on TransAT-Server.

Parameters:
  • worker (Worker, optional) – Worker where the task will be executed, default to localhost
  • nprocs (int, optional) – Number of processor
  • url (str, optional) – URL of the TransAT-server
run_postprocess(*args, **kwargs)

run a postprocessing function

The postprocessing functions are entirely user-defined and can take any number of arguments

Parameters:
  • *args (list of arguments) – List of arguments, the first of which must be the name of the function to call
  • **kwargs (dict) – keyword arguments
Returns:

True if successful

Return type:

bool

Examples

The following example runs the function plot_pressure on the local workstation, using arguments that are passed to the function:

>>>  sim.run_postprocess('plot_pressure',
...                      worker_name='local',
...                      args={'points': sim.pipe_network,
...                            'folder': sim.load('local')}
...                     )

See also

The postprocessing functions must have been previously loaded using the function add_postprocess()

run_until(time, worker=None, nprocs=1, url=None)

Run TransAT unsteady simulation from the current state until a given time

Solve unsteady flow equations using TransAT. If URL is passed it will run it on TransAT-Server.

Parameters:
  • time (float) – Physical time at which the simulation should stop
  • worker (Worker, optional) – Worker where the task will be executed, default to localhost
  • nprocs (int, optional) – Number of processor
  • url (str, optional) – URL of the TransAT-server
set_final_time(time, ntime=100000)

Define the final physical time of the simulation

Set the target final physical time for which the unsteady simulation will run. A value for the the number of time steps is also set (by default to 100000)

Parameters:
  • time (float) – physical time
  • ntime (int) – maximum number of time-steps
set_fluid_properties(densities, viscosities)

Define the fluid properties of the phases

Given two dictionaries of viscosities and densities with their phase name as keys.

Parameters:
  • densities (dict) – density [kg/m^3]
  • viscosities (dict) – dynamic viscosity [Pa.s]
set_folder(folder, worker_names)

Allow the user to set a folder name where the simulation files will be stored

By default unique Ids are generated for the folders name. If set_folder is called, the simulation will be saved in thw working_directory defined in user_config.ini. typically it will have the following path: /{wd}/{Simulation_Name}/{folder}

Parameters:
  • folder (str) – folder name
  • worker_name (str) – name of the worker on which this folder should be used
set_nbr_iteration(maxit=100000)

Args:

set_number_of_timestep(ntime)

Define the number of time step of the simulation

Set the number of time step for which the unsteady simulation will run.

Parameters:ntime (int) – number of time-steps
store(key, data)

Store data into database

The data are stored into the database associated with this simulation. It is stored using a primary key.

Parameters:
  • key (str) – Primary key (private to the current simulation object)
  • data (Data) – Data to be stored
Returns:

Description of return value

Return type:

bool

Raises:

Error – on database write error

store_path(key, data)

Store path into database

The paths of the simulation is stored in the database for all the workers.

Parameters:
  • key (str) – worker name
  • data (str) – path
Returns:

Success

Return type:

bool

transat.appbuilder module

class transat.appbuilder.App(title)

Bases: object

add_input(name, **kwargs)

Define an input for the application

Extended description of function.

Parameters:
  • name (str) – Description of arg1
  • kwargs (dict) – Description of arg2
Returns:

Description of return value

Return type:

bool

add_main(func)

Summary line.

Extended description of function.

Parameters:
  • arg1 (int) – Description of arg1
  • arg2 (str) – Description of arg2
Returns:

Description of return value

Return type:

bool

add_output(name, **kwargs)

Define output of application

Extended description of function.

Parameters:
  • name (name) – Description of arg1
  • kwargs (dict) – Description of arg2
Returns:

Description of return value

Return type:

bool

parse_inputs()

Summary line.

Extended description of function.

Parameters:
  • arg1 (int) – Description of arg1
  • arg2 (str) – Description of arg2
Returns:

Description of return value

Return type:

bool

run(*args, **kwargs)

Summary line.

Extended description of function.

Parameters:
  • arg1 (int) – Description of arg1
  • arg2 (str) – Description of arg2
Returns:

Description of return value

Return type:

bool

set_server(url)
class transat.appbuilder.Inputs

Bases: list

add(name, **kwargs)

Add input

Extended description of function.

Parameters:
  • name (int) – Description of arg1
  • kwargs (dict) – Description of arg2
Returns:

Description of return value

Return type:

bool

class transat.appbuilder.Outputs

Bases: list

add(name, **kwargs)

Add output

Extended description of function.

Parameters:
  • arg1 (int) – Description of arg1
  • arg2 (str) – Description of arg2
Returns:

Description of return value

Return type:

bool

Module contents