Skip to content

Commit

Permalink
feat: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mkundu1 committed Oct 29, 2024
1 parent 5008aaa commit 28b26de
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ansys/fluent/core/solver/settings_builtin_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,8 @@
FluentVersion.v231: "results.report.simulation_reports",
},
),
"ParametricStudies": ("Singleton", "parametric_studies"),
"ParametricStudy": ("NamedObject", "parametric_studies"),
"DesignPoints": ("Singleton", "parametric_studies.design_points"),
"DesignPoint": ("NamedObject", "parametric_studies.design_points"),
}
28 changes: 28 additions & 0 deletions tests/test_builtin_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from pathlib import Path
import tempfile

import pytest

try:
Expand All @@ -19,6 +22,8 @@
CumulativePlots,
CustomFieldFunctions,
CustomVectors,
DesignPoint,
DesignPoints,
DiscretePhase,
DiscretePhaseHistogram,
DynamicMesh,
Expand Down Expand Up @@ -56,6 +61,8 @@
NamedExpressions,
Optics,
OutputParameters,
ParametricStudies,
ParametricStudy,
ParticleTracks,
PartitionSurfaces,
Pathlines,
Expand Down Expand Up @@ -112,6 +119,7 @@
)
except ImportError:
pass # for no-codegen testing workflow
import ansys.fluent.core as pyfluent
from ansys.fluent.core.examples import download_file
from ansys.fluent.core.utils.fluent_version import FluentVersion

Expand Down Expand Up @@ -630,6 +638,26 @@ def test_builtin_settings(mixing_elbow_case_data_session):
else:
with pytest.raises(RuntimeError):
CustomVectors(settings_source=solver)
tmp_save_path = tempfile.mkdtemp(dir=pyfluent.EXAMPLES_PATH)
project_file = Path(tmp_save_path) / "mixing_elbow_param.flprj"
solver.settings.parametric_studies.initialize(project_filename=str(project_file))
assert ParametricStudies(settings_source=solver) == solver.parametric_studies
assert (
ParametricStudy(settings_source=solver, name="mixing_elbow-Solve")
== solver.parametric_studies["mixing_elbow-Solve"]
)
assert (
DesignPoints(settings_source=solver, parametric_studies="mixing_elbow-Solve")
== solver.parametric_studies["mixing_elbow-Solve"].design_points
)
assert (
DesignPoint(
settings_source=solver,
parametric_studies="mixing_elbow-Solve",
name="Base DP",
)
== solver.parametric_studies["mixing_elbow-Solve"].design_points["Base DP"]
)


@pytest.mark.codegen_required
Expand Down

0 comments on commit 28b26de

Please sign in to comment.