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

More options for gen_rectangle_mesh #79

Merged
merged 3 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/mesh/gmsh_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@
order = 1,
bnd_names = ("North", "South", "East", "West"),
n_partitions = 0,
write_geo = false,
transfinite_lines = true,
lc = 1e-1,
kwargs...
)

Expand All @@ -355,6 +358,9 @@
order = 1,
bnd_names = ("North", "South", "East", "West"),
n_partitions = 0,
write_geo = false,
transfinite_lines = true,
lc = 1e-1,
kwargs...,
)
# North
Expand All @@ -366,7 +372,6 @@
# South
gmsh.initialize()
_apply_gmsh_options(; kwargs...)
lc = 1e-1

# Points
A = gmsh.model.geo.addPoint(xc - lx / 2, yc - ly / 2, 0, lc)
Expand All @@ -387,10 +392,12 @@
surf = gmsh.model.geo.addPlaneSurface([ABCD])

# Mesh settings
gmsh.model.geo.mesh.setTransfiniteCurve(AB, nx)
gmsh.model.geo.mesh.setTransfiniteCurve(BC, ny)
gmsh.model.geo.mesh.setTransfiniteCurve(CD, nx)
gmsh.model.geo.mesh.setTransfiniteCurve(DA, ny)
if transfinite_lines
gmsh.model.geo.mesh.setTransfiniteCurve(AB, nx)
gmsh.model.geo.mesh.setTransfiniteCurve(BC, ny)
gmsh.model.geo.mesh.setTransfiniteCurve(CD, nx)
gmsh.model.geo.mesh.setTransfiniteCurve(DA, ny)
end

(transfinite || type == :quad) && gmsh.model.geo.mesh.setTransfiniteSurface(surf)
ghislainb marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -417,7 +424,13 @@
gmsh.model.mesh.partition(n_partitions)

# Write result
rm(output; force = true)
ghislainb marked this conversation as resolved.
Show resolved Hide resolved
gmsh.write(output)
if write_geo
ghislainb marked this conversation as resolved.
Show resolved Hide resolved
output_geo = first(splitext(output)) * ".geo_unrolled"
rm(output_geo; force = true)
ghislainb marked this conversation as resolved.
Show resolved Hide resolved
gmsh.write(output_geo)

Check warning on line 432 in src/mesh/gmsh_utils.jl

View check run for this annotation

Codecov / codecov/patch

src/mesh/gmsh_utils.jl#L430-L432

Added lines #L430 - L432 were not covered by tests
end

# End
gmsh.finalize()
Expand Down Expand Up @@ -1340,6 +1353,7 @@
nodes_gmsh2cgns(e::Type{Quad4_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Quad8_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Quad9_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Quad16_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Tetra4_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Tetra10_t}) = nodes(e) #same numbering between CGNS and Gmsh
nodes_gmsh2cgns(e::Type{Hexa8_t}) = nodes(e) #same numbering between CGNS and Gmsh
Expand Down
Loading