Skip to content

Commit

Permalink
test: mesh data
Browse files Browse the repository at this point in the history
  • Loading branch information
mkundu1 committed Jan 8, 2025
1 parent c286e02 commit 90391a6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_field_data.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import numpy as np
import pytest
from test_utils import pytest_approx

from ansys.fluent.core import examples
from ansys.fluent.core.examples.downloads import download_file
from ansys.fluent.core.exceptions import DisallowedValuesError
from ansys.fluent.core.services.field_data import FieldUnavailable, SurfaceDataType
from ansys.fluent.core.services.field_data import (
CellElementType,
FieldUnavailable,
SurfaceDataType,
)

HOT_INLET_TEMPERATURE = 313.15

Expand Down Expand Up @@ -464,3 +469,19 @@ def plot_mesh(index, field_name, data):
assert len(mesh_data[5]["faces"]) == 80

assert list(mesh_data[12].keys()) == ["vertices", "faces"]


@pytest.mark.fluent_version(">=25.2")
def test_mesh_data(static_mixer_case_session):
solver = static_mixer_case_session
mesh = solver.fields.field_data.get_mesh(zone_id=97)
assert len(mesh.nodes) == 82247
assert len(mesh.elements) == 22771
assert mesh.elements[0].element_type == CellElementType.POLYHEDRON
assert len(mesh.elements[0].node_indices) == 19
assert min(mesh.nodes, key=lambda x: x.x).x == pytest_approx(-1.999075e-03)
assert max(mesh.nodes, key=lambda x: x.x).x == pytest_approx(1.999125e-03)
assert min(mesh.nodes, key=lambda x: x.y).y == pytest_approx(-3.000000e-03)
assert max(mesh.nodes, key=lambda x: x.y).y == pytest_approx(3.000000e-03)
assert min(mesh.nodes, key=lambda x: x.z).z == pytest_approx(-2.000000e-03)
assert max(mesh.nodes, key=lambda x: x.z).z == pytest_approx(2.500000e-03)

0 comments on commit 90391a6

Please sign in to comment.