Difference between revisions of "FSI 3D Upgrade"

From CUSF Wiki
Jump to navigation Jump to search
(→‎Install mesh conversion software: Added further instructions)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
''This page is incomplete''
This page follows on from the standard [[FSI installation instructions]]. Follow those instructions first before continuing with this page.
 
TODO:
 
* Installing the modified files
* Verify it works
* Mesh conversion process


This page follows on from the standard [[FSI installation instructions]]. Follow those instructions first before continuing with this page.
If you experience any issues, please let Nik Lebedenko know.


=== Modify the adapter for 3D FSI ===
== Modify the adapter for 3D FSI ==
Download all the files for the 3D version from this Drive folder [todo add link]
Download all the files from this [https://github.com/cuspaceflight/fsi-3D-upgrade GitHub repository] using <code>git clone <nowiki>https://github.com/cuspaceflight/fsi-3D-upgrade</nowiki></code>


Locate this installation location of the FEniCS-preCICE using <code>python3 -m pip show fenicsprecice</code>  
Locate this installation location of your FEniCS-preCICE adapter using <code>python3 -m pip show fenicsprecice</code>  


Navigate to this location, in my case: <code>cd /home/nik/.local/lib/python3.8/site-packages/fenicsprecice</code>
Navigate to this location, in my case: <code>cd /home/nik/.local/lib/python3.8/site-packages/fenicsprecice</code>


Replace each file in your installation location with the 3D version you downloaded earlier.
Replace each file in your installation location with the version found in <code>fsi-3D-upgrade/fenicsprecice-3D</code>


=== Verify everything is working correctly ===
== Verify everything is working correctly ==
Download this modified tutorial case [todo add link]
Navigate to the <code>perpendicular-flap-3D</code> tutorial case downloaded from the [https://github.com/cuspaceflight/fsi-3D-upgrade GitHub repository] earlier.


Navigate to the <code>solid-fenics</code> folder and do <code>./run.sh</code> - there should be no errors, and the output should pause after a short setup period.
Navigate to the <code>solid-fenics</code> folder and do <code>./run.sh</code> - there should be no errors, and the output should pause after a short setup period.
Line 27: Line 21:
Both terminals should now have command outputs flying, similar to the original 2D tutorial case you ran when installing the 2D FSI software.
Both terminals should now have command outputs flying, similar to the original 2D tutorial case you ran when installing the 2D FSI software.


After a while, both terminals should stop. View the results in ParaView, and verify it looks similar to the original 2D tutorial case.
After 2-3 mins, both terminals should stop. View the results in ParaView, and verify it looks similar to the original 2D tutorial case.
 
View the fluid domain by navigating to <code>fluid-openfoam</code> and running <code>paraview.exe fluid-openfoam.foam</code>
 
View the solid's displacement by navigating to <code>solid-fenics</code> and running <code>paraview.exe Solid/FSI-S/u_fsi.pvd</code>
 
* By default, the solid will appear stationary. To visualise its movement, add a "Warp By Vector" filter with the Displacement vector and scale factor 1.
 
== Install mesh conversion software ==
''Update 05/02/2022 - Although initially .xml files were used for the final mesh output due to mpi version compatibility issues within the h5 file format library preventing the use of .xdmf, this issue is (seemingly) now resolved. (todo update this page & github) [https://jorgensd.github.io/dolfinx-tutorial/chapter3/subdomains.html#subdomains-defined-from-external-mesh-data link]''


=== Install mesh conversion software ===
FEniCS sadly does not natively support the import of ANSYS or OpenFOAM meshes, so a workaround must be used to generate its <code>.xml</code> mesh files.
FEniCS sadly does not natively support the import of ANSYS or OpenFOAM meshes, so a workaround must be used to generate its <code>.xml</code> mesh files.


Install <code>meshio</code> with all optional dependencies using <code>python3 -m pip install meshio[all]</code>
Install <code>meshio</code> with all optional dependencies using <code>python3 -m pip install meshio[all]</code>


Download the <code>foamToFenics</code> OpenFOAM case [todo add link].
Download the <code>foamToFenics</code> OpenFOAM case from the [https://github.com/cuspaceflight/fsi-3D-upgrade GitHub repository] (should already be present).


==== Convert between ANSYS mesh and FEniCS mesh ====
=== Convert between ANSYS mesh and FEniCS mesh ===


# Export the ANSYS mesh as <code>.msh</code>
# Export the ANSYS mesh as <code>.msh</code>
Line 43: Line 45:
# Run <code>./exportFenics</code>
# Run <code>./exportFenics</code>


==== Convert between OpenFOAM mesh and FEniCS mesh ====
=== Convert between OpenFOAM mesh and FEniCS mesh ===


# Copy the <code>polyMesh</code> directory into <code>foamToFenics/constant</code>
# Open an Ubuntu terminal and navigate to the <code>foamToFenics</code> OpenFOAM case.
#Copy the <code>polyMesh</code> directory from your OpenFOAM case with your mesh into <code>foamToFenics/constant</code>
# Run <code>./exportFenics</code>
# Run <code>./exportFenics</code>

Latest revision as of 10:20, 5 February 2022

This page follows on from the standard FSI installation instructions. Follow those instructions first before continuing with this page.

If you experience any issues, please let Nik Lebedenko know.

Modify the adapter for 3D FSI

Download all the files from this GitHub repository using git clone https://github.com/cuspaceflight/fsi-3D-upgrade

Locate this installation location of your FEniCS-preCICE adapter using python3 -m pip show fenicsprecice

Navigate to this location, in my case: cd /home/nik/.local/lib/python3.8/site-packages/fenicsprecice

Replace each file in your installation location with the version found in fsi-3D-upgrade/fenicsprecice-3D

Verify everything is working correctly

Navigate to the perpendicular-flap-3D tutorial case downloaded from the GitHub repository earlier.

Navigate to the solid-fenics folder and do ./run.sh - there should be no errors, and the output should pause after a short setup period.

Now open another Ubuntu terminal, and navigate to the fluid-openfoam folder and do ./run.sh

Both terminals should now have command outputs flying, similar to the original 2D tutorial case you ran when installing the 2D FSI software.

After 2-3 mins, both terminals should stop. View the results in ParaView, and verify it looks similar to the original 2D tutorial case.

View the fluid domain by navigating to fluid-openfoam and running paraview.exe fluid-openfoam.foam

View the solid's displacement by navigating to solid-fenics and running paraview.exe Solid/FSI-S/u_fsi.pvd

  • By default, the solid will appear stationary. To visualise its movement, add a "Warp By Vector" filter with the Displacement vector and scale factor 1.

Install mesh conversion software

Update 05/02/2022 - Although initially .xml files were used for the final mesh output due to mpi version compatibility issues within the h5 file format library preventing the use of .xdmf, this issue is (seemingly) now resolved. (todo update this page & github) link

FEniCS sadly does not natively support the import of ANSYS or OpenFOAM meshes, so a workaround must be used to generate its .xml mesh files.

Install meshio with all optional dependencies using python3 -m pip install meshio[all]

Download the foamToFenics OpenFOAM case from the GitHub repository (should already be present).

Convert between ANSYS mesh and FEniCS mesh

  1. Export the ANSYS mesh as .msh
  2. Open an Ubuntu terminal, navigate to the foamToFenics OpenFOAM case, and copy the .msh file there.
  3. Import the mesh with fluentMeshToFoam <your msh file>, replacing <your msh file> with the full filename and extension of your .msh file.
  4. Run ./exportFenics

Convert between OpenFOAM mesh and FEniCS mesh

  1. Open an Ubuntu terminal and navigate to the foamToFenics OpenFOAM case.
  2. Copy the polyMesh directory from your OpenFOAM case with your mesh into foamToFenics/constant
  3. Run ./exportFenics