Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.orig messes up VTK output of foamToVTK #95

Closed
BenjaminRodenberg opened this issue Aug 14, 2019 · 2 comments
Closed

0.orig messes up VTK output of foamToVTK #95

BenjaminRodenberg opened this issue Aug 14, 2019 · 2 comments
Labels
compatibility Affecting only specific OpenFOAM / preCICE versions wontfix

Comments

@BenjaminRodenberg
Copy link
Member

foamToVTK uses Fluid/0 and Fluid/0.orig for creating VTK output. This leads to a duplicate output file in the beginning of the simulation that has to be deleted manually in order to make sure that the Fluid and Structure simulation are in sync, when visualized via paraview. Deleting a file before running paraview is no big problem, but very confusing, if you do not know about it.

Can we somehow avoid Fluid/0.orig being parsed by foamToVTK?

As far as I understand, Fluid/0.orig has to be provided with the case such that the openfoam-adapter works correctly; eventhough Fluid/0.orig already exists, the duplicate Fluid/0 is created as soon as the simulation is started.

Eventhough I only observed this behaviour in the FEniCS-OpenFOAM case, I assume that the same behaviour can be observed in other FSI cases (?), where 0.orig is needed. E.g. OpenFOAM-CalculiX or OpenFOAM-deal.II.

More Details

After running an FSI simulation with OpenFOAM + FEniCS (see precice/tutorials#38), I receive the following output in my case directory:

~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ ls Fluid
0  0.1  0.2  0.3  0.4  0.5  0.6  0.7  0.8  0.9  0.orig  1  constant  Fluid.foam  precice-adapter-config.yml  system

Running ~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ foamToVTK -case Fluid/ gives a folder ~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS/Fluid/VTK with the following content:

~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ ls Fluid/VTK/
flap         Fluid_100.vtk  Fluid_1.vtk   Fluid_30.vtk  Fluid_50.vtk  Fluid_70.vtk  Fluid_90.vtk  inlet      outlet
Fluid_0.vtk  Fluid_10.vtk   Fluid_20.vtk  Fluid_40.vtk  Fluid_60.vtk  Fluid_80.vtk  frontAndBack  lowerWall  upperWall

The File Fluid_1.vtk does not really fit into the output and it is actually a duplicate of Fluid_0.vtk:

~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ diff Fluid/VTK/Fluid_0.vtk Fluid/VTK/Fluid_1.vtk 
~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ diff Fluid/VTK/Fluid_0.vtk Fluid/VTK/Fluid_10.vtk 
Binary files Fluid/VTK/Fluid_0.vtk and Fluid/VTK/Fluid_10.vtk differ

Like explained above, before visualizing the results in paraview, the file Fluid/VTK/Fluid_1.vtk has to be deleted manually.

Alternatives to this approach:

  • Delete 0.orig or 0 before running foamToVTK
  • Exclude time 0, by running foamToVTK -time 0.1:1 (however, this excludes all output before time 0.1...)
@BenjaminRodenberg
Copy link
Member Author

There is a simple workaround possible, if we directly modify runFluid such that Fluid/0 is removed at the end of the simulation. See precice/tutorials@e2d9d0a.

BenjaminRodenberg added a commit to richahert/tutorials that referenced this issue Aug 15, 2019
@MakisH
Copy link
Member

MakisH commented Nov 11, 2019

As far as I understand, Fluid/0.orig has to be provided with the case such that the openfoam-adapter works correctly; eventhough Fluid/0.orig already exists, the duplicate Fluid/0 is created as soon as the simulation is started.

The reason for this common practice is a bit different. 0.orig is completely optional and does not have any meaning for OpenFOAM. It is a backup directory.

The 0/ directory stores essentially the boundary and initial conditions for every field. If a BC can be expressed as "the same value for every point", then we assign a value to the complete boundary ("patch"). If we want to e.g. set a parabolic inflow profile, then we would do a pre-processing step, which would modify the value of every point and would replace the general description with a more specific description. In order to be able to easily go back to the general description, we store a backup (the 0.orig/ directory).

To avoid duplication, our scripts start by copying the 0.orig directory to 0. Then, one only needs to manually change the 0.orig/, while all the tools work on 0/.

Running ~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ foamToVTK -case Fluid/ gives a folder ~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS/Fluid/VTK with the following content:

~/tutorials/FSI/flap_perp/OpenFOAM-FEniCS$ ls Fluid/VTK/
flap         Fluid_100.vtk  Fluid_1.vtk   Fluid_30.vtk  Fluid_50.vtk  Fluid_70.vtk  Fluid_90.vtk  inlet      outlet
Fluid_0.vtk  Fluid_10.vtk   Fluid_20.vtk  Fluid_40.vtk  Fluid_60.vtk  Fluid_80.vtk  frontAndBack  lowerWall  upperWall

I tried this with OpenFOAM v1906, 5, 6, 7. I can only reproduce it with OpenFOAM 6, so it is version-specific (and OpenFOAM-specific). I will not fix this.

If you need a workaround, you can use the -time option of foamToVTK:

-time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'

@MakisH MakisH closed this as completed Nov 11, 2019
@MakisH MakisH added compatibility Affecting only specific OpenFOAM / preCICE versions wontfix and removed FSI Fluid-structure interaction labels Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Affecting only specific OpenFOAM / preCICE versions wontfix
Projects
None yet
Development

No branches or pull requests

2 participants