TrixiParticles.jl
TrixiParticles.jl copied to clipboard
Define boundary zone from STL-file
With this PR, we can pass arbitrary oriented planes (stl-file format) to the InFlow and OutFlow zones.
The reason for this is that for real-world problems one do not need to specify the plane points for the in- and outflow zones.
I basically added a function to calculate the oriented bounding box of an arbitrary oriented plane in space.
An example:
using TrixiParticles
particle_spacing = 0.01
density = 1000.0
open_boundary_layers = 8
filename_plane = "inflow_region_plane"
file_plane = joinpath(expanduser("~/"), "Data", "stl-files", "aorta", filename_plane * ".stl")
filename = "inflow_region"
file = joinpath(expanduser("~/"), "Data", "stl-files", "aorta", filename * ".stl")
geometry_plane = load_geometry(file_plane)
geometry = load_geometry(file)
algorithm = WindingNumberJacobson(; geometry, hierarchical_winding=true)
shape_sampled = ComplexShape(geometry; particle_spacing, density,
point_in_geometry_algorithm=algorithm)
flow_direction = TrixiParticles.normalize(sum(geometry_plane.face_normals) /
TrixiParticles.nfaces(geometry_plane))
inflow = InFlow(; plane=geometry_plane, initial_condition=shape_sampled, flow_direction,
open_boundary_layers, density, particle_spacing)
points = stack(inflow.spanning_set) .+ inflow.zone_origin
points[:, 1] .+= flow_direction*inflow.zone_width
trixi2vtk(points, flow_direction=fill(inflow.flow_direction, 3))