Conversation
There was a problem hiding this comment.
* `tools/cleaning-tools.sh`: Contains one function for each solver (e.g. `clean_openfoam`), one shared function to clean the preCICE log files, and one function `clean_tutorial`. * `<tutorial>/<case>/clean.sh`: Only triggers the right `clean_<solver>`. * `<tutorial>/clean-tutorial.sh`: The same for every tutorial, only triggers `clean_tutorial`. * `clean-all.sh`: Triggers all `clean-tutorial.sh`, cleaning everything: * The scripts cannot be started from arbitrary directories (I may implement this, but I don't see much added value). The check we had before (`cd ${0%/*} || exit 1`) is not correct.
Very nice. The only thing I don't like that much is the duplication on the lowest level. Since we have a naming convention, it might be possible to extract the current participant name from the working path. Using symlinks as you already proposed would be a great idea and then you could just have a single script for all cases on the lowest level.
* In most (all?) OpenFOAM cases we have a first step where we copy the backup `0.orig/` to `0/`. This is normally not needed, so I left this deletion step out of the function and added it explicitly to each case.
I already had cases, where OpenFOAM complains about missing boundary conditions. So, might depend on the version.
* A few more files are intentionally cleaned up now: * The `.foam` files are now deleted and not recreated. This should be done by the `run.sh` (there was some motivation for this in the past, but it is not really relevant anymore). * The `elastic-tube-3d` previously skipped deleting the OpenFOAM mesh, probably to save time. This was always confusing. I now delete them as well and I will add them to the `.gitignore` later.
No, the reason for the elastic-tube-3d was not to to save time, but to keep the mesh. We have no blockMesh script for the mesh (I guess it has been created with an external software). If you delete it here, it will be gone (or you need to restore it from the git tree).
Still open
* Check if the CalculiX, deal.II, Nutils, SU2, and code_aster are cleaned up completely (I just distilled the previous lists for now).
This should be part of the control step in #160.
uekerman
left a comment
There was a problem hiding this comment.
I like the mechanism, great stuff 🚀
(I did not test it right now)
|
@davidscn Thank you very much for the detailed comments!
I would like to keep the deepest level case-specific: it allows to remove special files or do additional tricks (e.g. backup something, then restore it). But I used symlinks for the intermediate level, where all files are identical.
I am not sure what you mean here, but I interpret it as "let's keep it as it is".
Good catch, thank you. I renamed I think we have the same issue in the
I checked and they are working fine: OpenFOAM, CalculiX, deal.II, SU2
|
|
I think the only reliable way to make the scripts work when invoked from any directory would require switching to . "${BASH_SOURCE%/*}/../../tools/cleaning-tools.sh"This will not not work on the standard OpenFOAM works around this issue by specifying the tools path in an environment variable, but we want to avoid going down that road, as it would make more things unnecessarily complicated for the user. At the end of the day, I am not sure if the solvers themselves are so portable and nobody ever complained for the tutorials using |
davidscn
left a comment
There was a problem hiding this comment.
Very, nice 💥
As I said, I will check the cleaning scripts when checking the tutorials again.
* Strip case of everything besides simple heat conduction setup. * Adds precice-config.xml supporting parallel runs. * Add documentation and nutils case. * Add complex case. Based on ae77ae5. * Cleanup and Update to newest version of python bindings. * Use scalar-valued flux. * Apply new structure to complex case. * Remove subcycling. * Simplify heat nutils to one mesh, make config consistent * Fix names. * BCs working. * Minor restructuring * Fix initial condition and output. * Mark nutils case as under construction. See #152. * Add nutils prototype from 679fe8d. * Add instructions on running nutils case to README * Cleanup * Fix geometry. * Add convenience scripts and improve output. * Make output more consistent. * Update convenience scripts. * Fix sign error. * Add monolithic solver for comparison. * Scale flux by element size. * Use identical mesh for FEniCS and Nutils. * Add argument for setting error tolerance. * Update README.md * Remove monolithic case. * Smooth readme of partitioned heat case * More information on error. * Provide cleaning scripts according to #169. * Streamline run and clean scripts. * Cleanup. * Align Nutils vtk output format with Paraview * Make explanation of fenics-nutils error more precise * Comment, format, and rewrite nutils heat code Co-authored-by: uekerman <benjamin.uekermann@gmail.com> Co-authored-by: Benjamin Uekermann <benjamin.uekermann@ipvs.uni-stuttgart.de>
Closes #133.
Main files:
tools/cleaning-tools.sh: Contains one function for each solver (e.g.clean_openfoam), one shared function to clean the preCICE log files, and one functionclean_tutorial.<tutorial>/<case>/clean.sh: Only triggers the rightclean_<solver>.<tutorial>/clean-tutorial.sh: The same for every tutorial, only triggersclean_tutorial.clean-all.sh: Triggers allclean-tutorial.sh, cleaning everything:This design allows to clean the files at any of the three levels, with the assumption "from this level and deeper".
Maintainability is tremendously improved, as now most changes can happen in one place. The rest should be short and static enough (but also trivial to update, as the files are exactly the same). I could even symlink directly to one file in the
tools/(trying to think of counter-arguments).Technical notes and design choices
#!/bin/sh), without any Bash-specific feature.set -e -u. These will make the script exit on errors and on undefined variables.cd ${0%/*} || exit 1) is not correct.clean_precice_logs()lists all types of files explicitly. This should be a sanity check whenever we add new output file types.clean_<solver>executes inside a subshell (( do_stuff )). This makes it a bit more state-independent ("do I need tocdback at the end?").-,--, ...) signifies the level and they serve as separators. Normally, there should be additional output from each file that is removed. The almost duplicate OpenFOAM output comes from thecleanCaseof OpenFOAM.0.orig/to0/. This is normally not needed, so I left this deletion step out of the function and added it explicitly to each case..foamfiles are now deleted and not recreated. This should be done by therun.sh(there was some motivation for this in the past, but it is not really relevant anymore). (update: done)elastic-tube-3dpreviously skipped deleting the OpenFOAM mesh, probably to save time. This was always confusing. I now delete them as well and I will add them to the.gitignorelater. (update: reverted the change, handling similar to0.originrun.sh)Still open
clean.shandclean-tutorial.shto the not yet restructured cases and remove the exclusion fromclean-all.sh. But that's probably a future todo.This is part of a trilogy, with the next steps being a common
.gitignore(#87) and a few fixes in the run scripts (issue pending).Note that running
clean-all.shwill currently fail, until the leftoverFSI/directory is removed (see #168). Just remove it locally to test it.Review
@uekerman Please comment on the mechanism.
@fsimonis Please have a quick look at the scripts: do you see anything problematic?
@davidscn Please try to run 1-2 cases and check that it is working as expected.