Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define boundary zone from STL-file #597

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LasNikas
Copy link
Collaborator

@LasNikas LasNikas commented Aug 7, 2024

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:
image

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))

Screenshot from 2024-08-07 16-00-51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant