Skip to content

Add test elastic-tube-1d tests#396

Merged
MakisH merged 7 commits intodevelopfrom
add-test-elastic-tube-1d
Dec 21, 2023
Merged

Add test elastic-tube-1d tests#396
MakisH merged 7 commits intodevelopfrom
add-test-elastic-tube-1d

Conversation

@MakisH
Copy link
Copy Markdown
Member

@MakisH MakisH commented Nov 18, 2023

Adds a test suite for elastic-tube-1d, which is a special case, since it does not rely on any adapter (but relies partially on the python-bindings).

Overview of changes:

  • New component bare, which essentially only relies on the precice Docker image.
  • New component python-bindings
  • Adds a metadata.yml into the elastic-tube-1d tutorial
  • Defines the test suite elastic_tube_1d_test, with the tests:
    • fluid-cpp x solid-cpp: Test the C++ API
    • fluid-python x solid-python: Test the Python API
    • fluid-cpp x solid-python: Test the interoperability between C++ and Python

However, only the last test is being executed: #394

Further observations

This test correctly fails to build the code and run the simulation when executing generate_reference_data.py, since the tutorial is not yet ported to preCICE v3 (#395). However, running the system tests only complains at the stage of comparing the results:

~/repos/precice/tutorials/tools/tests [develop]$ python3 generate_reference_data.py --log-level=DEBUG
Using log-level: DEBUG
INFO: About to run the following tests {Elastic tube 1D (fluid-cpp, solid-python), Flow over heated plate (fluid-openfoam, solid-openfoam), Flow over heated plate (fluid-openfoam, solid-fenics), Perpendicular flap (fluid-openfoam, solid-calculix), Flow over heated plate (fluid-openfoam, solid-nutils)}
INFO: Started running Elastic tube 1D (fluid-cpp, solid-python),  0/5
DEBUG: tools are already copied: [Errno 17] File exists: '/home/gc/repos/precice/tutorials/runs/tools' 
DEBUG: Building docker image for Elastic tube 1D (fluid-cpp, solid-python)
DEBUG: Running tutorial Elastic tube 1D (fluid-cpp, solid-python)
INFO: Running Elastic tube 1D (fluid-cpp, solid-python) took 378.1042361170039 seconds
INFO: Started running Flow over heated plate (fluid-openfoam, solid-openfoam),  1/5
...
Traceback (most recent call last):
  File "/home/gc/repos/precice/tutorials/tools/tests/generate_reference_data.py", line 118, in <module>
    main()
  File "/home/gc/repos/precice/tutorials/tools/tests/generate_reference_data.py", line 104, in main
    raise RuntimeError(
RuntimeError: Error executing: 
 Elastic tube 1D (fluid-cpp, solid-python) 
 Could not find result folder /home/gc/repos/precice/tutorials/runs/elastic-tube-1d_fluid-cpp-solid-python_2023-11-18-125138/precice_exports
 Probably the tutorial did not run through properly. Please check corresponding logs
~/repos/precice/tutorials/tools/tests [develop]$ python3 systemtests.py --suites=elastic_tube_1d_test --log-level=DEBUG
Using log-level: DEBUG
INFO: About to run the following systemtest in the directory /home/gc/repos/precice/tutorials/runs:
 [Elastic tube 1D (fluid-cpp, solid-python)]
INFO: Started running Elastic tube 1D (fluid-cpp, solid-python),  0/1
DEBUG: tools are already copied: [Errno 17] File exists: '/home/gc/repos/precice/tutorials/runs/tools' 
DEBUG: Building docker image for Elastic tube 1D (fluid-cpp, solid-python)
DEBUG: Running tutorial Elastic tube 1D (fluid-cpp, solid-python)
DEBUG: Running fieldcompare for Elastic tube 1D (fluid-cpp, solid-python)
Traceback (most recent call last):
  File "/home/gc/repos/precice/tutorials/tools/tests/systemtests.py", line 96, in <module>
    main()
  File "/home/gc/repos/precice/tutorials/tools/tests/systemtests.py", line 75, in main
    result = systemtest.run(run_directory)
  File "/home/gc/repos/precice/tutorials/tools/tests/systemtests/Systemtest.py", line 524, in run
    fieldcompare_result = self._run_field_compare()
  File "/home/gc/repos/precice/tutorials/tools/tests/systemtests/Systemtest.py", line 334, in _run_field_compare
    self.__unpack_reference_results()
  File "/home/gc/repos/precice/tutorials/tools/tests/systemtests/Systemtest.py", line 316, in __unpack_reference_results
    with tarfile.open(self.reference_result.path) as reference_results_tared:
  File "/usr/lib/python3.10/tarfile.py", line 1797, in open
    return func(name, "r", fileobj, **kwargs)
  File "/usr/lib/python3.10/tarfile.py", line 1863, in gzopen
    fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
  File "/usr/lib/python3.10/gzip.py", line 174, in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/gc/repos/precice/tutorials/elastic-tube-1d/reference-data/fluid-cpp_solid-python.tar.gz'

@MakisH MakisH self-assigned this Nov 18, 2023
@MakisH MakisH changed the title Add test elastic-tube-1d Add test elastic-tube-1d tests Nov 21, 2023
@valentin-seitz valentin-seitz force-pushed the add-test-elastic-tube-1d branch from b1e5eff to 3ea0bde Compare December 12, 2023 16:51
@valentin-seitz
Copy link
Copy Markdown
Contributor

So i had a look at the problem at hand and could identify two things:

  1. The bare component did not have a TUTORIALS_REF build_argument. This prevented the git checkout of the right tutorial reference, so we ended up with an incompatible one.
  2. The elastic-tube-1d fluid-python participant needed matplotlib to work properly, so i added it into the container.

I will try to add reference results now via the pipeline.

@valentin-seitz
Copy link
Copy Markdown
Contributor

valentin-seitz commented Dec 13, 2023

Another problem i found is that we use the v202211.0 tag of the tutorials as a reference. But there the CPP code is not built properly, but assumed to be built manually. (see https://github.com/precice/tutorials/blob/v202211.0/elastic-tube-1d/solid-cpp/run.sh).
This was fixed later in 362606a

So its gonna be tricky to merge this somewhere soon, because we cannot really generate reference results for it?

One way forward would be to cherry pick the commit into the master, before the release?

@MakisH
Copy link
Copy Markdown
Member Author

MakisH commented Dec 14, 2023

Another problem i found is that we use the v202211.0 tag of the tutorials as a reference. But there the CPP code is not built properly, but assumed to be built manually. (see https://github.com/precice/tutorials/blob/v202211.0/elastic-tube-1d/solid-cpp/run.sh). This was fixed later in 362606a

So its gonna be tricky to merge this somewhere soon, because we cannot really generate reference results for it?

One way forward would be to cherry pick the commit into the master, before the release?

Good catch!

Since the new run.sh checks if the build/ directory exists before trying to build it, we can just for now extend the test to build + run the solver. This would only modify the test, and it would still be valid in the new version.

@valentin-seitz valentin-seitz force-pushed the add-test-elastic-tube-1d branch from 3ea0bde to e30df9b Compare December 14, 2023 15:07
@valentin-seitz
Copy link
Copy Markdown
Contributor

dc7335a solved the problems. The VM was able to add the reference results, so i guess we can merge this now.

@valentin-seitz valentin-seitz self-requested a review December 14, 2023 19:20
Copy link
Copy Markdown
Member Author

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated results contributed here look reasonable (I see the pressure and cross-section length oscillations).

@MakisH MakisH merged commit b67ddf5 into develop Dec 21, 2023
@MakisH MakisH deleted the add-test-elastic-tube-1d branch December 21, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants