The HydroflowModel class#
What it does#
HydroflowModel builds a hydrodynamic physical model. This class controls the hydrodynamic simulation:
set up of the appropriate initial and boundary conditions
modification of the specific simulation properties such as CFL number, flux scheme, etc.
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.hydroflow.HydroflowModel(mesh: Mesh)#
Hydrodynamic simulation model. 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 solve() is used to launch the simulation by calling the C++ solver.
- property Cfl_number#
- Convergence condition by Courant-Friedrichs-Lewy
Must always be below 1
- Getter:
Returns Courant-Friedrichs-Lewy number
- Setter:
Sets Courant-Friedrichs-Lewy number
- Type:
float
- export_data() None #
Calls the export class to export the needed files in the input folder Please inspect the input folder to see the designed problem. Informations about initial conditions, nodes, edges or eventual gauges places are included
- property flux_order#
order used to compute the fluxes
- Getter:
returns the order used to compute the fluxes
- Setter:
Sets the order used to compute the fluxes (1 or 2)
- Type:
int (default : 1)
- property flux_scheme#
- Scheme used to compute the fluxes at the interfaces of the mesh
FOR THE MOMENT ONLY HLLC AVAILABLE
- Getter:
returns the flux scheme
- Setter:
Sets scheme used to compute the fluxes at the interfaces of each edge (HLLC, Roe or other)
- Type:
string
- get_boundary_conditions()#
Returns the boundary conditions in a dictionary
- property is_fixed_bed_level#
Indicates to the c++ code if there is a fixed bed level :return: 0 or 1 :rtype: Boolean of type int (0,1)
- property is_friction#
Indicates to the c++ code if there is friction to be considered
- Returns:
0 or 1
- Return type:
Boolean of type int (0,1)
- property is_sediments#
Indicates to the c++ code if there is sediments to be considered
- Returns:
0 or 1
- Return type:
Boolean of type int (0,1)
- resume_simulation(pic_file, display=True, isParallel=False, isSameMesh=True)#
Allows the user to restart a simulation from a former pic.txt file.
- Parameters:
pic_file (string) – pic.txt file used as initial conditions for the simulation
display (bool, optional) – if True shows the cpp outputed informations, defaults to True
isParallel (bool, optional) – if True the parallel version of the code is used, defaults to False
isSameMesh (bool, optional) – if True no interpolation is performed. Initial conditions are not interpolated, defaults to True
- set_bedrock_level(regions, bedrock_levels)#
Sets the initial bedrock level to the cells in the domain.
- Parameters:
bedrock_levels (float or list) – the values to be given to the cells in the corresponding region.
- set_boundary_hydrogram(boundaries, hydrogram_paths)#
Sets a hydrogram type of boundary condition Your file must be organized as follows : nData : t0 -Q0 t1 -Q1 t2 -Q3 etc….
- Parameters:
boundaries (string or int) – the boundary names (string) or the boundary tags (int)
hydrogram_paths (string or list) – the paths of the hydrograms associated to the edges in the corresponding boundary.
- set_boundary_limnigram(boundaries, limnigram_paths)#
Sets a limnigram type of boundary condition
- Parameters:
boundaries (string or int) – the boundary names (string) or the boundary tags (int)
limnigram_paths (string or list) – the paths of the limnigrams associated to the edges in the corresponding boundary.
- set_boundary_water_discharge(boundaries, water_discharges)#
Defines the imposed water discharge through the edges of the boundaries. You must introduce the total discharge. Positive value flows in the system
- Parameters:
boundaries (string or int) – the boundary names (string) or the boundary tags (int)
water_discharges (float or list) – the values to be given to the edges in the corresponding boundary.
- set_boundary_water_level(boundaries, water_levels)#
Defines the imposed water level at edges of the boundaries.
- Parameters:
boundaries (string or tag) – the boundary names (string) or the boundary tags (int)
water_levels (float or list) – the values to be given to the edges in the corresponding boundary.
- set_friction_coefficient(regions, friction_coefficients)#
Sets the friction coefficients associated to each cell in the domain. If only one value is given, all cells will get the same value.
- Parameters:
regions (string or int) – the regions names (string) or the regions tags (int)
friction_coefficients (float or list or .tif file) – the values to be given to the cells in the corresponding region.
- set_initial_water_discharge(regions, discharges)#
- Sets the initial water levels to the cells in the domain.
If only one value is given, all cells will get the same value.
- Parameters:
regions (string or int) – the regions names (string) or the regions tags (int)
discharges (List) – the values to be given to the cells in the correspondint region. Each entry must be composed of two elements (discharge x and discharge y).
- set_initial_water_height(regions, water_heights)#
- Sets the initial water height to the cells in the domain.
If only one value is given, all cells will get the same value.
- Parameters:
regions (string or int) – the regions names (string) or the regions tags (int)
water_heights (float or list) – the values to be given to the cells in the correspondant region.
- set_initial_water_level(regions, water_levels)#
- Sets the initial water levels to the cells in the domain.
If only one value is given, all cells will get the same value.
- Parameters:
regions (string or int) – the regions names (string) or the regions tags (int)
water_levels (float or list) – the values to be given to the cells in the correspondant region.
- set_transmissive_boundaries(boundaries)#
Defines which edges behave like a transmissive interfaces.
- Parameters:
boundaries (string or int) – the boundary names (string) or the boundary tags (int) where the edges behave like transmissive interfaces.
- set_wall_boundaries(boundaries)#
Defines which edges behave like wall interfaces.
- Parameters:
boundaries (string or int) – the boundary names (string) or the boundary tags (int) where the edges behave like wall interfaces.
- property slope_limiter#
This function assigns slope_limiter
- Getter:
returns the slope_limiter
- Setter:
1 or 2 ???
- Type:
int (default : 0)
- solve(display=True, isParallel=False) None #
Calls the C++ executable of meshchecker if the parameter meshchecking of mesh is set to True Calls the C++ executable and solve the current designed model