setup Package¶
setup Package¶
This package holds methods and modules to define proper simulation setup. It includes boundary conditions (bc), mesh, CAD and model inputs.
bc Module¶
-
class
transat.setup.bc.BC(raw)¶ Bases:
objectGeneric boundary condition object Different types of boundary conditions are derived from this class:
-
write()¶
-
-
exception
transat.setup.bc.BCError(msg, code=2)¶ Bases:
exceptions.ExceptionBase class for exceptions in Boundary Conditions
Parameters: - msg (str) – Human readable string describing the exception.
- code (int, optional) – Error code, defaults to 2.
-
msg¶ str
Human readable string describing the exception.
-
code¶ int
Exception error code.
-
class
transat.setup.bc.BoundaryConditions(stt_data, mesher)¶ Bases:
objectStores all boundary conditions
-
bc_file¶ str
Input file of TransAT containing the boundary conditions, generated by the GUI
-
bcs¶ list of BC
All the boundary condition objects
-
create_surfaces_tree()¶
-
get_bc(name)¶ Get a boundary condition object from its name
Parameters: name (str) – Name of the boundary, as labelled in TransAT GUI Returns: Boundary condition object Return type: BC
-
get_bc_names()¶
-
get_surface_tree()¶
-
get_surfaces_from_mesher()¶
-
write(stt_file)¶
-
write_boundaries()¶
-
write_surfaces()¶
-
-
class
transat.setup.bc.Inflow(raw)¶ Bases:
transat.setup.bc.BCInflow Boundary Condition
-
set_coupling(coupling)¶
-
set_phase_velocities(phase, velocity, volume_fraction)¶
-
set_temperature(temperature)¶
-
set_velocities(velocity)¶
-
set_volumeflowrate(volumeflowrate)¶
-
-
class
transat.setup.bc.Opflow(raw)¶ Bases:
transat.setup.bc.BCOutput pressure Boundary Condition
-
set_coupling(coupling)¶
-
set_pressure(pressure)¶
-
-
class
transat.setup.bc.Surface¶ Bases:
object- A Surface is an ensemble of rectangles that:
- are connected together
- have the same orientation
-
bc¶ str
Boundary condition name. Should correspond to one of
BoundaryConditions.get_bc_names()
-
id¶ int
-
surface_id¶ int
-
rectangles¶ list
-
set_bc_key(bc_key)¶
-
set_id(id)¶
-
set_rectangles(rectangles)¶
-
set_surface_id(surface_id)¶
-
unwrap(data)¶
-
class
transat.setup.bc.SurfaceTree(surfaces)¶ Bases:
objectA SurfaceTree is collection of surfaces. The order in which the tree is sorted matters for the definition of the boundaries.
-
get_all_surfaces()¶
-
get_surface_with_normal(normal)¶
-
get_surface_with_point(point)¶
-
sort()¶
-
-
class
transat.setup.bc.SurfacesList(surfaces)¶ Bases:
object-
for_dir(dir)¶
-
for_value(value)¶
-
get_all()¶
-
get_surface_with_normal(axis)¶
-
get_surface_with_point(point)¶
-
get_values()¶
-
minmax(name)¶
-
set_bc_name(bc_name)¶
-
-
class
transat.setup.bc.Wall(name, raw)¶ Bases:
transat.setup.bc.BCWall Boundary Condition
-
set_coupling(coupling)¶
-
set_temperature(temperature)¶
-
cad Module¶
-
class
transat.setup.cad.BoundBox(xmin, xmax, ymin, ymax, zmin, zmax)¶ Bases:
object-
contains(edge)¶
-
contains_point(point)¶
-
equal(bbox)¶
-
from_points_to_bbox(points)¶
-
get_intersection(bbox)¶
-
get_points()¶
-
make_points_unique(points)¶
-
remove(bbox)¶
-
unwrap()¶
-
-
class
transat.setup.cad.CAD(freecad_path)¶ Bases:
object-
create_cylinder(cylinder, path='', name='cylinder.stl')¶
-
load_freecad()¶
-
make_circle(radius, o, d)¶
-
make_pipe(wire, circle, filename)¶
-
make_wire(segments)¶
-
-
class
transat.setup.cad.Edge(p1, p2)¶ Bases:
object-
distances_to_surface(surface, x0)¶
-
get_dir_vector()¶
-
get_intersection_point(surface)¶
-
has_intersection_with_surface(surface)¶
-
is_aligned()¶
-
is_collinear_with(edge)¶
-
is_equal(edge)¶
-
is_normal_to_surface(surface)¶
-
-
class
transat.setup.cad.Network(cad, pipes)¶ -
create(path)¶
-
get_blocks()¶
-
get_pipes_name()¶
-
remove_intersection(bboxes, bbox)¶
-
remove_intersections(bboxes)¶
-
-
class
transat.setup.cad.Pipe(name, radius, junctions=['open', 'open'])¶ Bases:
transat.setup.cad.CAD-
add_point(point=[], radius=None)¶
-
create(cad, path)¶
-
get_bounding_boxes()¶
-
get_inlet_point()¶
-
get_name()¶
-
get_outlet_point()¶
-
-
exception
transat.setup.cad.PointsAreTheSameError(p0, p1)¶ Bases:
exceptions.Exception
-
class
transat.setup.cad.Surface(p1, p2, p3, p4)¶ Bases:
object-
contains(point)¶
-
get_normal()¶
-
get_points()¶
-
-
transat.setup.cad.load_module(freecad_path)¶
input Module¶
-
class
transat.setup.input.ControlSection(data)¶ Bases:
transat.setup.input.InputSection-
set_final_time(time)¶
-
set_maxit(maxit)¶
-
set_maxit_max(maxit)¶
-
set_nbr_timestep(timestep)¶
-
write()¶
-
-
class
transat.setup.input.Input(path)¶ Bases:
object-
get_control_section()¶
-
get_flow_conditions()¶
-
get_phases()¶
-
get_section(name, lines)¶
-
get_sections_names(lines)¶
-
parse()¶
-
set_final_time(time)¶
-
set_maxit(maxit)¶
-
set_maxit_max(maxit)¶
-
set_nbr_timestep(timestep)¶
-
write()¶
-
-
class
transat.setup.input.InputSection(data)¶ Bases:
object-
get_vector_id(key)¶
-
get_vector_name(key)¶
-
is_vector(key)¶
-
parse(data)¶
-
write()¶
-
ist Module¶
mesh Module¶
-
class
transat.setup.mesh.Block(stt_data=None, dimensions=None)¶ Bases:
object-
get_lengths()¶
-
get_rectangles()¶
-
get_volume()¶
-
make_2D(axis, value)¶
-
set_dimensions(xmin, xmax, ymin, ymax, zmin, zmax)¶
-
set_id(id)¶
-
split()¶
-
unwrap(stt_data)¶
-
write()¶
-
-
class
transat.setup.mesh.Mesher(stt_data)¶ Bases:
object-
add_block(block)¶
-
get_all_blocks_rectangles()¶
-
get_center(dir)¶
-
get_max(dir)¶
-
get_min(dir)¶
-
get_number_of_blocks()¶
-
get_rectangles()¶
-
set_2D(axis1, axis2, offset=1e-07)¶
-
set_blocks(bboxes)¶
-
set_dx(dx)¶
-
set_grid_spacing(axis, dx)¶
-
set_number_of_cells(nx, ny, nz)¶
-
set_ratios(rx, ry, rz)¶
-
sort_surfaces_in_dict(surfaces)¶
-
split_blocks()¶
-
static
split_surfaces(surfaces)¶
-
write(stt_file)¶
-
-
class
transat.setup.mesh.Rectangle(normal, dimensions, value, orientiation)¶ Bases:
object-
contains(surface)¶
-
contains_point(point)¶
-
equal(surface)¶
-
get_1d_intersection(surface, dir)¶
-
get_nine_surfaces(values)¶
-
has_same_dimensions(dimensions)¶
-
intersection(surface)¶
-
is_connected(surface)¶
-
remove(surfaces, surface)¶
-
stt_helper_functions Module¶
-
transat.setup.stt_helper_functions.add_section(raw, stt_file)¶
-
transat.setup.stt_helper_functions.add_section_headers(data, section, extra='')¶
-
transat.setup.stt_helper_functions.auto_parser(lines)¶
-
transat.setup.stt_helper_functions.bbmr_parser(lines)¶
-
transat.setup.stt_helper_functions.change_attribute_value(key, value, data)¶
-
transat.setup.stt_helper_functions.dict2array(data)¶
-
transat.setup.stt_helper_functions.extract_attribute(data)¶
-
transat.setup.stt_helper_functions.extract_file(data)¶
-
transat.setup.stt_helper_functions.find_all_sections(data)¶
-
transat.setup.stt_helper_functions.find_first_section_occurence(lines, sections)¶
-
transat.setup.stt_helper_functions.get_attribute_value(row, keyword)¶
-
transat.setup.stt_helper_functions.get_grid_sections_and_remove(lines)¶
-
transat.setup.stt_helper_functions.get_section(keyword, stt_file=None, data=None)¶
-
transat.setup.stt_helper_functions.parser(stt_file)¶
-
transat.setup.stt_helper_functions.remove_filename_from_file(data)¶
-
transat.setup.stt_helper_functions.remove_grid_sections(lines)¶
-
transat.setup.stt_helper_functions.remove_section(keyword, stt_file=None, data=None)¶
-
transat.setup.stt_helper_functions.remove_section_headers(data)¶
-
transat.setup.stt_helper_functions.write_section(section, section_data, stt_file)¶