The WatlabModel class#

What it does#

The Model class is the one you really want to interact with when building your physical Model. The aim of this class is to control the simulation :

  • Selecting appropriate initial and boundary conditions

  • Modifying general simulation properties such as name, ending time, etc.

  • Selecting the amount of output file you want to produce

Whenever you use this class, it is essential to conclude your script by employing the export_data() function and resolving your specified problem through the solve() function.

Documentation#

class watlab.watlab.WatlabModel(mesh: Mesh)#

The WatlabModel class is the template model that should be used by all Watlab simulation tools.

The simulation model is made of a physical Mesh and is linked to the Export class

This class must be used to design your problem by providing a solver, initial and boundary conditions. The function export_data() is used to export the data files describing the simulation.

It has to be done before the solve().

The function solve() is used to launch the simulation by calling the C++ solver.

property discharge_control_edges#
Getter:

The edges corresponding to the chosen line

Return type:

list of edges tags

property discharge_measurement_time_step#
Getter:

The time-step used to measure the discharge accross the section

Return type:

int

property ending_time#

Time corresponding to the end of the simulation

Getter:

Returns ending time of the simulation

Setter:

Sets simulation ending time

Type:

float

property gauge#

Gauge position provided by the used with the set_gauge_function :getter: Array describing the position of the gauge :rtype: array

property gauge_time_step#

Gauge time step recording provided by the used with the set_gauge_function :getter: Time step for the gauge result recording :rtype: float

get_boundary_conditions()#

Returns the boundary conditions in a dictionary

Returns:

a dictionnary with the initial condition type as key and the concerned cells as values

Return type:

key : dictionnary

get_conditions(wanted_keys)#

Returns all boundary or initial conditions imposed by the user

Parameters:

wanted_keys (string) – type of condition desired

Returns:

values of the conditions

Return type:

key : value type

get_initial_conditions()#

Returns the initial conditions in a dictionary

Returns:

a dictionnary with the initial condition type as key and the concerned cells as values

Return type:

key : dictionnary

get_picture_times()#

Provides the list of the times at which the results will be returned

Returns:

list of picture times

Return type:

ndArray

property is_discharge_measurement_section#

1 if generate a discharge measurement section was placed and 0 if not :getter: 1 or 0 :rtype: boolean of type int

property is_gauge#

1 if generate a gauge was placed and 0 if not :getter: 1 or 0 :rtype: boolean of type int

property is_picture#

Boolean of type int. 1 if pictures of results are needed, 0 if not :return: 0 or 1 :rtype: int

property name#

The name of the simulation.

Getter:

Returns this simulation’s name

Setter:

Sets this simulation’s name

Type:

string

property physical_model#

Assigns a physical model : you must decide to use only hydrodynamics or sediments…

Getter:

returns the physical model name

Setter:

Sets Physical model name: Hydroflow, Sediflow, …

Type:

string

set_discharge_measurement_section(section_name=None, time_step=1)#

Tool to control the discharge across a section

Parameters:
  • section_name (string or int , optional) – string or int corresponding to the tag of the desired boundary or interior line in the mesh, defaults to None

  • time_step (int, optional) – time step used to measure the discharge accross the section, defaults to 1

Raises:

Exception – throws exception if the boundary does not exist

set_gauge(gauge_position=[], time_step=1)#

The method allows to put a measurement gauge at a desired place A gauge file will be generated in the output folder

Parameters:
  • gauge_position (list, optional) – list [[X1,Y1,Z1],[X2,Y2,Z2]] of the chosen gauges positions, defaults to []

  • time_step (int, optional) – time step for measurement, defaults to 1

set_picture_times(n_pic=0, dt_picture=0, pic_array=None)#

Sets the times at which pictures (outputs) should be taken based on three possible methods:

  1. If a time step (dt_picture) is provided, picture times will be set at intervals of dt_picture seconds.

  2. If a number of pictures (n_pic) is provided, picture times will be evenly distributed over the entire duration.

  3. If a list of specific picture times (pic_array) is provided, it will be used directly.

Parameters:
  • n_pic (int, optional) – Number of desired pictures, defaults to 0. Used if no time step is provided.

  • dt_picture (float, optional) – Time step at which the pictures should be taken, defaults to 0.

  • pic_array (list or numpy array, optional) – A list of desired picture times, defaults to None.

Raises:

ValueError – If no method for setting picture times is provided.

property starting_time#

Time corresponding to the beginning of the simulation

Getter:

Returns starting time of the simulation

Setter:

Sets simulation starting time

Type:

float

property time_step_enveloppe#

time interval dt used for the computation of the enveloppe of results The enveloppe corresponds to the maximum values of height and velocities for each cell of the computationnal domain :getter: returns the enveloppe time step :setter: sets a desired enveloppe time step :type: float