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

87 allow different resolutions for same physical #106

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion tests/generate_references.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source .venv/bin/activate

# Install reference version of the package in editable mode
sudo apt-get install libglu1-mesa
uv pip install git+https://github.com/simbilod/meshwell.git@be4fc001cd573982690c178eb9334b41f64decdd[dev]
uv pip install git+https://github.com/simbilod/meshwell.git@ee10c5ab5da9c1311f5925907e08e494157c702d[dev]

# Execute all Python files in the current directory
python generate_references.py --references-path ./references/
46 changes: 45 additions & 1 deletion tests/test_fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import numpy as np
from meshwell.utils import compare_meshes
from pathlib import Path
from shapely.geometry import box
from meshwell.resolution import ThresholdField


def test_fuse():
Expand Down Expand Up @@ -61,5 +63,47 @@ def test_fuse():
compare_meshes(Path("mesh_unfused.msh"))


def test_different_resolutions_same_physical():
model = Model(n_threads=1)

# Create two different boxes
box1 = box(0, 0, 1, 1)
box2 = box(2, 0, 3, 1)

# Create resolution specifications
resolution1 = ThresholdField(
apply_to="curves", sizemin=0.01, sizemax=0.05, distmax=0.2
)

resolution2 = ThresholdField(
apply_to="curves", sizemin=0.1, sizemax=0.2, distmax=0.2
)

# Create two polysurfaces with same physical name but different resolutions
surface1 = PolySurface(
polygons=box1,
model=model,
physical_name="test_surface",
resolutions=[resolution1],
)

surface2 = PolySurface(
polygons=box2,
model=model,
physical_name="test_surface",
resolutions=[resolution2],
)

# Mesh the model
model.mesh(
entities_list=[surface1, surface2],
default_characteristic_length=10,
filename="test_different_resolutions_same_physical.msh",
)

compare_meshes(Path("test_different_resolutions_same_physical.msh"))


if __name__ == "__main__":
test_fuse()
# test_fuse()
test_different_resolutions_same_physical()
Loading