-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95991d2
commit a0ae26c
Showing
8 changed files
with
522 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.integration | ||
@pytest.mark.quick | ||
@pytest.mark.setup | ||
def test_controls(load_mixing_elbow_mesh): | ||
solver = load_mixing_elbow_mesh | ||
solver.setup.models.multiphase.models = "vof" | ||
assert solver.setup.models.multiphase.models() == "vof" | ||
solver.setup.general.gravity = {"enable": True, "components": [0.0, 0.0, -9.81]} | ||
assert solver.setup.general.gravity.components() == [0, 0, -9.81] | ||
solver.setup.general.solver.time = "steady" | ||
assert solver.setup.general.solver.time() == "steady" | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.laplace_coarsening = ( | ||
True | ||
) | ||
assert solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters() == { | ||
"max_coarse_levels": 40, | ||
"coarsen_by_interval": 8, | ||
"conservative_coarsening": False, | ||
"aggressive_coarsening": False, | ||
"laplace_coarsening": True, | ||
} | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.max_coarse_levels = ( | ||
45 | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.max_coarse_levels() | ||
== 45 | ||
) | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters = { | ||
"max_coarse_levels": 48, | ||
"coarsen_by_interval": 9, | ||
"conservative_coarsening": True, | ||
"aggressive_coarsening": True, | ||
"laplace_coarsening": True, | ||
} | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.max_coarse_levels() | ||
== 48 | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.coarsen_by_interval() | ||
== 9 | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.conservative_coarsening() | ||
== True | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.aggressive_coarsening() | ||
== True | ||
) | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.fixed_cycle_parameters.max_cycle = ( | ||
300 | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.fixed_cycle_parameters.max_cycle() | ||
== 300 | ||
) | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.fixed_cycle_parameters = { | ||
"pre_sweeps": 1, | ||
"post_sweeps": 2, | ||
"max_cycle": 350, | ||
} | ||
assert solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.fixed_cycle_parameters() == { | ||
"pre_sweeps": 1, | ||
"post_sweeps": 2, | ||
"max_cycle": 350, | ||
} | ||
solver.solution.methods.p_v_coupling.flow_scheme = "Coupled" | ||
assert solver.solution.methods.p_v_coupling.flow_scheme() == "Coupled" | ||
solver.solution.methods.p_v_coupling.coupled_form = True | ||
assert solver.solution.methods.p_v_coupling.coupled_form() == True | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.smoother_type = ( | ||
"gauss-seidel" | ||
) | ||
assert ( | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.scalar_parameters.smoother_type() | ||
== "gauss-seidel" | ||
) | ||
assert solver.solution.controls.pseudo_time_explicit_relaxation_factor() == { | ||
"global_dt_pseudo_relax": { | ||
"turb-viscosity": 1.0, | ||
"body-force": 1.0, | ||
"k": 0.75, | ||
"omega": 0.75, | ||
"mp": 0.5, | ||
"density": 1.0, | ||
} | ||
} | ||
solver.solution.controls.pseudo_time_explicit_relaxation_factor = { | ||
"global_dt_pseudo_relax": {"turb-viscosity": 0.9, "body-force": 0.8} | ||
} | ||
assert solver.solution.controls.pseudo_time_explicit_relaxation_factor() == { | ||
"global_dt_pseudo_relax": { | ||
"turb-viscosity": 0.9, | ||
"body-force": 0.8, | ||
"k": 0.75, | ||
"omega": 0.75, | ||
"mp": 0.5, | ||
"density": 1.0, | ||
} | ||
} | ||
solver.solution.methods.p_v_coupling.flow_scheme = "SIMPLE" | ||
solver.solution.controls.under_relaxation = {"pressure": 0.9} | ||
solver.solution.controls.under_relaxation = {"density": 0.9} | ||
assert solver.solution.controls.under_relaxation() == { | ||
"mom": 0.7, | ||
"turb-viscosity": 1, | ||
"density": 0.9, | ||
"omega": 0.8, | ||
"mp": 0.5, | ||
"body-force": 1.0, | ||
"pressure": 0.9, | ||
"k": 0.8, | ||
} | ||
solver.solution.controls.under_relaxation = { | ||
"body-force": 0.7, | ||
"density": 0.75, | ||
"mom": 0.8, | ||
} | ||
assert solver.solution.controls.under_relaxation() == { | ||
"mom": 0.8, | ||
"turb-viscosity": 1, | ||
"density": 0.75, | ||
"omega": 0.8, | ||
"mp": 0.5, | ||
"body-force": 0.7, | ||
"pressure": 0.9, | ||
"k": 0.8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import pytest | ||
from util.fixture_fluent import download_input_file | ||
|
||
|
||
@pytest.mark.quick | ||
@pytest.mark.setup | ||
def test_initialize(launch_fluent_solver_3ddp_t2): | ||
solver = launch_fluent_solver_3ddp_t2 | ||
input_type, input_name = download_input_file("pyfluent/wigley_hull", "wigley.msh") | ||
solver.file.read(file_type=input_type, file_name=input_name) | ||
solver.parallel.partition.set.use_laplace_smoothing = True | ||
solver.parallel.partition.method(partition_method="metis", count=2) | ||
solver.setup.materials.database.copy_by_name(type="fluid", name="air") | ||
solver.setup.materials.database.copy_by_name(type="fluid", name="water-liquid") | ||
solver.setup.models.multiphase.models = "vof" | ||
solver.setup.general.gravity = {"enable": True, "components": [0.0, 0.0, -9.81]} | ||
solver.setup.general.solver.time = "steady" | ||
solver.execute_tui("/define/models/multiphase/vof-sub-models yes no ") | ||
solver.execute_tui( | ||
"/define/phases/set-domain-properties/change-phases-names? water air " | ||
) | ||
solver.setup.boundary_conditions.pressure_inlet["inflow"].phase["mixture"] = { | ||
"open_channel": True, | ||
"direction_spec": "Direction Vector", | ||
"vmag": 1.452, | ||
"ht_bottom": -0.941875, | ||
"turb_intensity": 0.01, | ||
"turb_viscosity_ratio": 1, | ||
} | ||
solver.setup.boundary_conditions.pressure_outlet["outflow"].phase["mixture"] = { | ||
"open_channel": True, | ||
"ht_bottom": -0.941875, | ||
"den_spec": "From Free Surface Level", | ||
"direction_spec": "Normal to Boundary", | ||
"turb_intensity": 0.01, | ||
"turb_viscosity_ratio": 1, | ||
"p_backflow_spec_gen": "Static Pressure", | ||
} | ||
|
||
solver.solution.methods.p_v_coupling.flow_scheme = "Coupled" | ||
solver.solution.methods.p_v_coupling.coupled_form = True | ||
solver.solution.controls.advanced.multi_grid.algebraic_mg_controls.coupled_parameters.coarsening_parameters.laplace_coarsening = ( | ||
True | ||
) | ||
solver.solution.initialization.open_channel_auto_init = { | ||
"boundary_thread": 3, | ||
"flat_init": True, | ||
} | ||
assert solver.solution.initialization.open_channel_auto_init() == { | ||
"boundary_thread": 3, | ||
"flat_init": True, | ||
} | ||
# solver.solution.initialization.hybrid_initialize() | ||
# solver.exit() | ||
|
||
|
||
@pytest.mark.quick | ||
@pytest.mark.setup | ||
def test_fmg_initialize(launch_fluent_solver_3ddp_t2): | ||
solver = launch_fluent_solver_3ddp_t2 | ||
input_type, input_name = download_input_file( | ||
"pyfluent/vki_turbine", "vki_turbine.cas.gz" | ||
) | ||
solver.file.read(file_type=input_type, file_name=input_name) | ||
solver.execute_tui("(rpsetvar 'fmg-init/reorder? #f) ") | ||
solver.mesh.check() | ||
solver.solution.initialization.standard_initialize() | ||
solver.solution.initialization.fmg_initialize = True | ||
# assert solver.solution.initialization.fmg_initialize() == True | ||
solver.execute_tui("(benchmark '(iterate 2)) ") | ||
# solver.solution.initialization.hybrid_initialize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.quick | ||
@pytest.mark.setup | ||
def test_methods(load_mixing_elbow_mesh): | ||
solver = load_mixing_elbow_mesh | ||
solver.setup.models.multiphase.models = "vof" | ||
solver.setup.general.gravity = {"enable": True, "components": [0.0, 0.0, -9.81]} | ||
solver.setup.general.solver.time = "steady" | ||
solver.solution.methods.p_v_coupling.flow_scheme = "Coupled" | ||
solver.solution.methods.p_v_coupling.coupled_form = False | ||
assert solver.solution.methods.p_v_coupling() == { | ||
"flow_scheme": "Coupled", | ||
"coupled_form": False, | ||
} | ||
solver.solution.methods.discretization_scheme = {"pressure": "presto!"} | ||
assert solver.solution.methods.discretization_scheme() == { | ||
"mom": "second-order-upwind", | ||
"omega": "second-order-upwind", | ||
"mp": "compressive", | ||
"pressure": "presto!", | ||
"k": "second-order-upwind", | ||
} | ||
solver.solution.methods.gradient_scheme = "least-square-cell-based" | ||
assert solver.solution.methods.gradient_scheme() == "least-square-cell-based" | ||
solver.solution.methods.warped_face_gradient_correction.enable( | ||
enable=True, gradient_correction_mode="fast-mode" | ||
) | ||
solver.solution.methods.warped_face_gradient_correction.enable( | ||
enable=False, gradient_correction_mode="fast-mode" | ||
) | ||
solver.solution.methods.expert.numerics_pbns.velocity_formulation = "relative" | ||
assert ( | ||
solver.solution.methods.expert.numerics_pbns.velocity_formulation() | ||
== "relative" | ||
) | ||
solver.solution.methods.expert.numerics_pbns = { | ||
"implicit_bodyforce_treatment": True, | ||
"velocity_formulation": "absolute", | ||
"physical_velocity_formulation": True, | ||
"disable_rhie_chow_flux": True, | ||
"presto_pressure_scheme": False, | ||
"first_to_second_order_blending": 2.0, | ||
} | ||
assert solver.solution.methods.expert.numerics_pbns() == { | ||
"implicit_bodyforce_treatment": True, | ||
"velocity_formulation": "absolute", | ||
"physical_velocity_formulation": True, | ||
"disable_rhie_chow_flux": True, | ||
"presto_pressure_scheme": False, | ||
"first_to_second_order_blending": 2.0, | ||
} | ||
solver.solution.methods.expert.numerics_pbns.presto_pressure_scheme = True | ||
assert solver.solution.methods.expert.numerics_pbns.presto_pressure_scheme() == True | ||
solver.solution.methods.gradient_scheme = "green-gauss-node-based" | ||
assert solver.solution.methods.gradient_scheme() == "green-gauss-node-based" | ||
solver.solution.methods.warped_face_gradient_correction.enable( | ||
enable=True, gradient_correction_mode="memory-saving-mode" | ||
) |
Oops, something went wrong.