diff --git a/precicecasegenerate/helper.py b/precicecasegenerate/helper.py index e184b40..091c881 100644 --- a/precicecasegenerate/helper.py +++ b/precicecasegenerate/helper.py @@ -37,7 +37,8 @@ "pressure", "velocity", "heat-flux", - "heatflux" + "heatflux", + "traction" ] class DataKind(Enum): diff --git a/tests/compositional-coupling-experiment/precice-config.xml b/tests/compositional-coupling-experiment/precice-config.xml new file mode 100644 index 0000000..20f42ae --- /dev/null +++ b/tests/compositional-coupling-experiment/precice-config.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/compositional-coupling-experiment/test_equivalence.py b/tests/compositional-coupling-experiment/test_equivalence.py new file mode 100644 index 0000000..bdaa9a5 --- /dev/null +++ b/tests/compositional-coupling-experiment/test_equivalence.py @@ -0,0 +1,26 @@ +""" +Test that exchanges between participants correctly lead to data renaming if only the specified patches are unique. +""" + +from pathlib import Path +from precice_config_graph.graph import operations +from preciceconfigcheck.cli import runCheck + +from precicecasegenerate.cli import generate_case + +# This directory is the same for all tests in this file. +test_directory: Path = Path(__file__).parent +def test_compositional_coupling_experiment(): + """ + Test if the created config-file matches the expected one. + """ + case_directory: Path = test_directory + input_file: Path = case_directory / "topology.yaml" + + generate_case(input_file, case_directory / "_generated") + + expected: Path = case_directory / "precice-config.xml" + actual: Path = case_directory / "_generated/precice-config.xml" + assert not operations.check_config_equivalence(expected, actual), "Configs are equivalent with different naming." + assert operations.check_config_equivalence(expected, actual, ignore_names=True), "Configs are not equivalent up to naming." + assert runCheck(actual, True) == 0, "The config failed to validate." diff --git a/tests/compositional-coupling-experiment/topology.yaml b/tests/compositional-coupling-experiment/topology.yaml new file mode 100644 index 0000000..d45de70 --- /dev/null +++ b/tests/compositional-coupling-experiment/topology.yaml @@ -0,0 +1,89 @@ +participants: + - name: MuscleMechanics + solver: ASolver + - name: TendonBottom + solver: BSolver + - name: TendonTopA + solver: BSolver + - name: TendonTopB + solver: BSolver + - name: MuscleFibers + solver: ASolver +exchanges: + - from: MuscleFibers + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Gamma + type: weak + data-type: scalar + - from: MuscleMechanics + to: MuscleFibers + from-patch: interface + to-patch: interface + data: Geometry + type: weak + data-type: vector + - from: TendonBottom + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Displacement + type: strong + data-type: vector + - from: TendonBottom + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Velocity + type: strong + data-type: vector + - from: MuscleMechanics + to: TendonBottom + from-patch: interface + to-patch: interface + data: Traction + type: strong + data-type: vector + - from: TendonTopA + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Displacement + type: strong + data-type: vector + - from: TendonTopA + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Velocity + type: strong + data-type: vector + - from: MuscleMechanics + to: TendonTopA + from-patch: interface + to-patch: interface + data: Traction + type: strong + data-type: vector + - from: TendonTopB + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Displacement + type: strong + data-type: vector + - from: TendonTopB + to: MuscleMechanics + from-patch: interface + to-patch: interface + data: Velocity + type: strong + data-type: vector + - from: MuscleMechanics + to: TendonTopB + from-patch: interface + to-patch: interface + data: Traction + type: strong + data-type: vector \ No newline at end of file