diff --git a/README.md b/README.md index 799ccd2..1693cdd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ MacroUtils is a collection of high-level APIs in order to make your life easier ## Requires -1. Simcenter STAR-CCM+ v2021.3 libraries; +1. Simcenter STAR-CCM+ v2022.1 libraries; 1. Integrated development environment (IDE) supporting JDK 11 and gradle -- e.g.: NetBeans 11 or later. diff --git a/macroutils/src/macroutils/MacroUtils.java b/macroutils/src/macroutils/MacroUtils.java index 781c4ea..1aaeac7 100644 --- a/macroutils/src/macroutils/MacroUtils.java +++ b/macroutils/src/macroutils/MacroUtils.java @@ -25,12 +25,12 @@ * * Requires: * * * @since STAR-CCM+ v7.02, May of 2012 * @author Fabio Kasper - * @version 2021.3 + * @version 2022.1 */ public final class MacroUtils { diff --git a/macroutils/src/macroutils/creator/CreatePhysicsContinua.java b/macroutils/src/macroutils/creator/CreatePhysicsContinua.java index fba1042..b81e64e 100644 --- a/macroutils/src/macroutils/creator/CreatePhysicsContinua.java +++ b/macroutils/src/macroutils/creator/CreatePhysicsContinua.java @@ -8,6 +8,7 @@ import star.common.CompositeArrayProfileMethod; import star.common.EulerianPhase; import star.common.ExplicitUnsteadyModel; +import star.common.FieldFunction; import star.common.FunctionScalarProfileMethod; import star.common.FunctionVectorProfileMethod; import star.common.ImplicitUnsteadyModel; @@ -129,20 +130,24 @@ public FlatVofWave createWave(PhysicsContinuum pc, double[] ptLvl, double[] vert _ud.unit_kgpm3, "Heavy Fluid Density", true); //-- //-- Apply Wave Initial Conditions + FieldFunction ffp = _get.objects.fieldFunction("Hydrostatic Pressure.*", true); + FieldFunction ffvfh = _get.objects.fieldFunction("Volume Fraction.*Heavy.*", true); + FieldFunction ffvfl = _get.objects.fieldFunction("Volume Fraction.*Light.*", true); + FieldFunction ffvel = _get.objects.fieldFunction("Velocity of .*Wave.*", true); InitialPressureProfile ipp = pc.getInitialConditions().get(InitialPressureProfile.class); ipp.setMethod(FunctionScalarProfileMethod.class); - ipp.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(fvw.getPressureFF()); + ipp.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(ffp); VolumeFractionProfile vfp = pc.getInitialConditions().get(VolumeFractionProfile.class); vfp.setMethod(CompositeArrayProfileMethod.class); ScalarProfile sp0 = vfp.getMethod(CompositeArrayProfileMethod.class).getProfile(0); sp0.setMethod(FunctionScalarProfileMethod.class); ScalarProfile sp1 = vfp.getMethod(CompositeArrayProfileMethod.class).getProfile(1); sp1.setMethod(FunctionScalarProfileMethod.class); - sp0.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(fvw.getVofHeavyFF()); - sp1.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(fvw.getVofLightFF()); + sp0.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(ffvfh); + sp1.getMethod(FunctionScalarProfileMethod.class).setFieldFunction(ffvfl); VelocityProfile vpp = pc.getInitialConditions().get(VelocityProfile.class); vpp.setMethod(FunctionVectorProfileMethod.class); - vpp.getMethod(FunctionVectorProfileMethod.class).setFieldFunction(fvw.getVelocityFF()); + vpp.getMethod(FunctionVectorProfileMethod.class).setFieldFunction(ffvel); //-- _io.say.created(fvw, true); return fvw; diff --git a/macroutils/src/macroutils/setter/SetSolver.java b/macroutils/src/macroutils/setter/SetSolver.java index e9f16ee..85a7932 100644 --- a/macroutils/src/macroutils/setter/SetSolver.java +++ b/macroutils/src/macroutils/setter/SetSolver.java @@ -561,10 +561,12 @@ private void _updateURFs_EMP() { SegregatedMultiPhaseSolver emps = _get.solver.byClass(SegregatedMultiPhaseSolver.class); MultiPhaseVelocitySolver empv = emps.getVelocitySolver(); MultiPhasePressureSolver empp = emps.getPressureSolver(); - empv.setUrf(_ud.urfPhsCplVel); - empp.setUrf(_ud.urfP); - _io.say.value("URF Phase Couple Velocity", empv.getUrf(), true); - _io.say.value("URF Pressure", empp.getUrf(), true); + ScalarPhysicalQuantity urfp = empp.getUrfQuantity(); + ScalarPhysicalQuantity urfv = empv.getUrfQuantity(); + urfp.setValue(_ud.urfP); + urfv.setValue(_ud.urfPhsCplVel); + _io.say.value("URF Phase Couple Velocity", urfv.getRawValue(), true); + _io.say.value("URF Pressure", urfp.getRawValue(), true); } private void _updateURFs_OtherSolvers() { diff --git a/tests/requirements.txt b/tests/requirements.txt index f5f2e8a..ee5d899 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,8 +1,8 @@ -attrs==20.3.0 +attrs==21.4.0 iniconfig==1.1.1 -packaging==20.9 -pluggy==0.13.1 -py==1.10.0 -pyparsing==2.4.7 -pytest==6.2.2 -toml==0.10.2 +packaging==21.3 +pluggy==1.0.0 +py==1.11.0 +pyparsing==3.0.7 +pytest==7.0.1 +tomli==2.0.1 diff --git a/tests/test/test_bugs.py b/tests/test/test_bugs.py index 2b4e28d..d7dc1bd 100644 --- a/tests/test/test_bugs.py +++ b/tests/test/test_bugs.py @@ -6,7 +6,7 @@ def _assert_opacity_bug_14(key, expected): - re_patt = 'Scene -> \w+ -> \w+ -> %s Opacity:\s(.*)\n' % key + re_patt = r'Scene -> \w+ -> \w+ -> %s Opacity:\s(.*)\n' % key actual = _float(re_patt, _bug_sim(1)) test_utils.assert_value(actual, expected, tolerance=0) diff --git a/tests/test/test_demo05.py b/tests/test/test_demo05.py index 19daf17..b45ee5b 100644 --- a/tests/test/test_demo05.py +++ b/tests/test/test_demo05.py @@ -18,7 +18,7 @@ def test_kart_wrap_part_surfaces_count(): def test_cell_count(): - test_utils.assert_cell_count(DEMO_ID, 621000, tolerance=0.01) + test_utils.assert_cell_count(DEMO_ID, 610000, tolerance=0.025) def test_solution(): @@ -40,12 +40,12 @@ def test_cl_report(): def test_scalar_pressure_kart_min(): - test_utils.assert_scene_min(DEMO_ID, 'Pressure Kart', 'Scalar', -2.0, + test_utils.assert_scene_min(DEMO_ID, 'Pressure Kart', 'Scalar', -1.5, tolerance=0.2, relative=False) def test_scalar_pressure_kart_max(): - test_utils.assert_scene_max(DEMO_ID, 'Pressure Kart', 'Scalar', 5.2, + test_utils.assert_scene_max(DEMO_ID, 'Pressure Kart', 'Scalar', 4.3, tolerance=0.1, relative=True) @@ -55,7 +55,7 @@ def test_scalar_pressure_section_min(): def test_scalar_pressure_section_max(): - test_utils.assert_scene_max(DEMO_ID, 'Pressure Section', 'Scalar', 5.3, + test_utils.assert_scene_max(DEMO_ID, 'Pressure Section', 'Scalar', 4.3, tolerance=0.1, relative=True) diff --git a/tests/test/test_demo11.py b/tests/test/test_demo11.py index 9492115..41e9233 100644 --- a/tests/test/test_demo11.py +++ b/tests/test/test_demo11.py @@ -23,7 +23,7 @@ def test_subtract_part_surfaces_count(): def test_cell_count(): - test_utils.assert_cell_count(DEMO_ID, 156500, tolerance=0.01) + test_utils.assert_cell_count(DEMO_ID, 165000, tolerance=0.025) def test_scalar_min(): diff --git a/tests/test/test_demo12.py b/tests/test/test_demo12.py index 9eb6bfa..f3f0060 100644 --- a/tests/test/test_demo12.py +++ b/tests/test/test_demo12.py @@ -37,8 +37,8 @@ def test_cfl_avg_report(): def test_cfl_max_report(): - test_utils.assert_report(DEMO_ID, 'CFL_max', 8.0, - tolerance=0.7, relative=False) + test_utils.assert_report(DEMO_ID, 'CFL_max', 8.5, + tolerance=1.0, relative=False) def test_time_report(): diff --git a/tests/test/test_utils.py b/tests/test/test_utils.py index 189bac7..99a6254 100644 --- a/tests/test/test_utils.py +++ b/tests/test/test_utils.py @@ -18,7 +18,7 @@ def _assert_content_count(key, argument, expected, tolerance, relative): - actual = _float_from_argument('%s Count:\s(.*)\n' % key, argument) + actual = _float_from_argument(r'%s Count:\s(.*)\n' % key, argument) print('\n[assert %s Count]: ' % key), assert_value(actual, expected, tolerance, relative) @@ -28,14 +28,14 @@ def _assert_exists(filename): def _assert_report(argument, report_name, expected, tolerance, relative): - re_patt = 'Report -> %s:\s(.*)\n' % report_name + re_patt = r'Report -> %s:\s(.*)\n' % report_name actual = _float_from_argument(re_patt, argument) print('\n[assert Report] %s: ' % report_name), assert_value(actual, expected, tolerance, relative) def _assert_scene(argument, scene, displayer, expected, tol, relative, key): - re_patt = 'Scene -> %s -> \w+ -> %s %s:\s(.*)\n' % (scene, displayer, key) + re_patt = r'Scene -> %s -> \w+ -> %s %s:\s(.*)\n' % (scene, displayer, key) actual = _float_from_argument(re_patt, argument) print('\n[assert Scene] %s -> %s: ' % (scene, displayer)), assert_value(actual, expected, tol, relative) @@ -189,14 +189,14 @@ def assert_pictures_count_in_folder(glob_pattern, expected): def assert_part_surfaces_count(argument, part_name, expected, tolerance=0, relative=False): - actual = _float_from_argument('Part -> %s:\s(\d+) Part' % part_name, + actual = _float_from_argument(r'Part -> %s:\s(\d+) Part' % part_name, argument) print('\n[assert Part Surfaces Count]: '), assert_value(actual, expected, tolerance, relative) def assert_iteration(argument, expected, tolerance=0.0, relative=False): - actual = _int_from_argument('Iteration:\s(\d+)', argument) + actual = _int_from_argument(r'Iteration:\s(\d+)', argument) assert_value(actual, expected, tolerance, relative) @@ -228,7 +228,7 @@ def assert_summary_contents_by_sim_file(filename): def assert_time(argument, expected, tolerance=0.0001, relative=True): - actual = _float_from_argument('Time:\s(.*)\n', argument) + actual = _float_from_argument(r'Time:\s(.*)\n', argument) assert_value(actual, expected, tolerance, relative) @@ -260,8 +260,8 @@ def assert_vertex_count(argument, expected, tolerance=0.005, relative=True): def demo_id(filename): """Get the demo_number from a test macro""" - b1 = re.match('.*/test_demo\d{2}\.py', filename) - found = re.findall('.*/test_demo(\d{2})\.py', filename) + b1 = re.match(r'.*/test_demo\d{2}\.py', filename) + found = re.findall(r'.*/test_demo(\d{2})\.py', filename) b2 = len(found) == 1 is_test_file = b1 and b2 assert is_test_file, 'Not a test file: "%s"' % filename