Skip to content

Commit

Permalink
Add cylinder manifold (#1167)
Browse files Browse the repository at this point in the history
Description
Added cylindrical manifold option to manifolds.cc.
Modified the parameter file input (arg1, arg2, ... arg6 became point coordinates and vector coordinates).
Added a some documentation to explain how the manifold subsection works.
Coarsest meshes were too coarse and lead to geometrical errors even when refined. A manifold makes it possible for the refinements to follow a particular geometry.

Testing
New 3D application test using a cylinder manifold.

Documentation
Modified existing simulation parameters which were unclear. Manifolds can now be described with a center point (spherical/cylindrical) and a direction vector (cylindrical)

Former-commit-id: dabcf1f
  • Loading branch information
mivaia authored Jun 11, 2024
1 parent 0770812 commit 6567cbe
Show file tree
Hide file tree
Showing 21 changed files with 373 additions and 78 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to the Lethe project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## [Master] - 2024-06-05

### Added

- MINOR A cylindrical manifold type has been added in the manifold parameter file option. Input arguments arg1, arg2, arg3, etc. used to describe the manifold geometry were modified to point coordinates and direction vector. A manifold section has been added to the documentation [#1167](https://github.com/chaos-polymtl/lethe/pull/1167)

## [Master] - 2024-05-27

### Changed
Expand Down
1 change: 1 addition & 0 deletions applications_tests/lethe-fluid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ file(COPY square.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY cylinder_structured.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY taylorCouette.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY box.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY cylinder_manifold.msh DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

file(COPY cavity_ht_average_velocity_restart_files/restart.averagevelocities DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/cavity_ht_average_velocity_restart.${_build_type}/mpirun=1/")
file(COPY cavity_ht_average_velocity_restart_files/restart.pvdhandler DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/cavity_ht_average_velocity_restart.${_build_type}/mpirun=1/")
Expand Down
12 changes: 12 additions & 0 deletions applications_tests/lethe-fluid/cylinder_manifold.mpirun=2.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Running on 2 MPI rank(s)...
Number of active cells: 80
Number of degrees of freedom: 500
Volume of triangulation: 2.83
Pressure drop: 0 Pa
Total pressure drop: 0 Pa

*****************************
Steady iteration: 1/1
*****************************
Pressure drop: 5.07 Pa
Total pressure drop: 5.03 Pa
68 changes: 68 additions & 0 deletions applications_tests/lethe-fluid/cylinder_manifold.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
24
1 -1 0 0
2 -6.123233995736766e-17 0 1
3 1 0 1.224646799147353e-16
4 1.83697019872103e-16 0 -1
5 0.5 0 0
6 0 0 0.5
7 0 0 -0.5
8 -0.5 0 0
9 -6.123233995736766e-17 1 1
10 0 1 0.5
11 0 0.5 0.5
12 -6.123233995736766e-17 0.5 1
13 0.5 1 0
14 0.5 0.5 0
15 0 1 -0.5
16 0 0.5 -0.5
17 -0.5 1 0
18 -0.5 0.5 0
19 -1 1 0
20 -1 0.5 0
21 1 1 1.224646799147353e-16
22 1 0.5 1.224646799147353e-16
23 1.83697019872103e-16 1 -1
24 1.83697019872103e-16 0.5 -1
$EndNodes
$Elements
28
1 5 2 1 1 2 6 8 1 12 11 18 20
2 5 2 1 1 6 5 7 8 11 14 16 18
3 5 2 1 1 12 11 18 20 9 10 17 19
4 5 2 1 1 11 14 16 18 10 13 15 17
5 5 2 1 1 2 3 5 6 12 22 14 11
6 5 2 1 1 3 4 7 5 22 24 16 14
7 5 2 1 1 4 1 8 7 24 20 18 16
8 5 2 1 1 12 22 14 11 9 21 13 10
9 5 2 1 1 22 24 16 14 21 23 15 13
10 5 2 1 1 24 20 18 16 23 19 17 15
11 3 2 2 2 2 1 20 12
12 3 2 2 2 12 20 19 9
13 3 2 2 2 2 12 22 3
14 3 2 2 2 12 9 21 22
15 3 2 2 2 3 22 24 4
16 3 2 2 2 22 21 23 24
17 3 2 2 2 4 24 20 1
18 3 2 2 2 24 23 19 20
19 3 2 3 3 6 5 7 8
20 3 2 3 3 2 6 8 1
21 3 2 3 3 4 1 8 7
22 3 2 3 3 3 4 7 5
23 3 2 3 3 2 3 5 6
24 3 2 4 4 9 19 17 10
25 3 2 4 4 10 17 15 13
26 3 2 4 4 9 10 13 21
27 3 2 4 4 21 13 15 23
28 3 2 4 4 23 15 17 19
$EndElements
$PhysicalNames
4
3 1 "Unspecified"
2 2 "cylinder-manifold"
2 3 "inlet"
2 4 "outlet"
$EndPhysicalNames
99 changes: 99 additions & 0 deletions applications_tests/lethe-fluid/cylinder_manifold.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Listing of Parameters
#----------------------

set dimension = 3

#---------------------------------------------------
# Simulation Control
#---------------------------------------------------

subsection simulation control
set method = steady
set output name = output
set output frequency = 0
set log precision = 3
end

#---------------------------------------------------
# Mesh
#---------------------------------------------------

subsection mesh
set type = gmsh
set file name = ../../cylinder_manifold.msh
set initial refinement = 1
end

#---------------------------------------------------
# Boundary Conditions
#---------------------------------------------------

subsection boundary conditions
set number = 3
subsection bc 0
set id = 2
set type = noslip
end
subsection bc 1
set id = 4
set type = outlet
end
subsection bc 2
set id = 3
set type = function
subsection u
set Function expression = 0
end
subsection v
set Function expression = 1
end
end
end

#---------------------------------------------------
# Non-Linear Solver Control
#---------------------------------------------------

subsection non-linear solver
subsection fluid dynamics
set tolerance = 1e-12
set verbosity = quiet
end
end

#---------------------------------------------------
# Linear Solver Control
#---------------------------------------------------

subsection linear solver
subsection fluid dynamics
set verbosity = quiet
end
end

#---------------------------------------------------
# Manifolds
#---------------------------------------------------

subsection manifolds
set number = 1
subsection manifold 0
set id = 2
set type = cylindrical
end
end

#---------------------------------------------------
# Post-processing
#---------------------------------------------------

subsection post-processing
set verbosity = verbose
set output frequency = 1

# Pressure drop calculation
set calculate pressure drop = true
set pressure drop name = cylinder_manifold_pressure_drop
set inlet boundary id = 3
set outlet boundary id = 4
end
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 0
set arg2 = 0
set point coordinates = 0,0
end
subsection manifold 1
set id = 1
set type = spherical
set arg1 = 0
set arg2 = 0
set point coordinates = 0,0
end
end

Expand Down
Empty file modified contrib/utilities/check_parameter_files_in_examples.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@ All the deal.II meshes supported by Lethe that correspond to the `GridGenerator
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 8
set arg2 = 8
set point coordinates = 8, 8
end
end
First the number of manifolds is specified by the ``set number`` command. Then a subsection for each of the manifolds is created starting with the ``manifold 0``. The boundary ``id`` is in this case set to ``0`` as we want to set a cylinder manifold and this is the corresponding id in this example. Then the ``type`` of the manifold is specified. In Lethe, there are two types supported:
First the number of manifolds is specified by the ``set number`` command. Then a subsection for each of the manifolds is created starting with the ``manifold 0``. The boundary ``id`` is in this case set to ``0`` as we want to set a spherical manifold and this is the corresponding id in this example. Then the ``type`` of the manifold is specified. In Lethe, there are three types supported:

* ``spherical`` manifold: The former can be used to describe any sphere, circle, hypesphere or hyperdisc in two or three dimensions and requires as arguments two or three geometrical locations depending on the dimension, that are used to create the circle center where the manifold will be build. In this example we set ``arg1`` and ``arg2`` to ``8``.
* ``spherical`` manifold: The former can be used to describe any sphere, circle, hypesphere or hyperdisc in two or three dimensions and requires the center of the geometry as an input argument. In this example we set ``point coordinates`` to ``8, 8``.

* ``cylindrical`` manifold: Used to describe cylinders in three dimensions. It uses the coordinates of a point and a direction vector located on the axis of the cylinder.

.. caution::
Cylindrical manifolds are not supported in 2D.

* ``iges`` manifold corresponding to a CAD geometry: the last two lines of the ``manifold 0`` subsection are replaced by the following command ``set cad file = file_name.iges`` where the path to the cad file is specified.

Expand Down
1 change: 1 addition & 0 deletions doc/source/parameters/cfd/cfd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ General, CFD and Multiphysics
initial_conditions
laser_heat_source
linear_solver_control
manifolds
mesh
mesh_adaptation_control
multiphysics
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions doc/source/parameters/cfd/manifolds.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
==========
Manifolds
==========
Linking parts of the mesh to manifolds is an interesting way to factor the real geometry of the mesh during refinements. This mesh treatment can lead to reduced geometric approximation error.

.. code-block:: text
subsection manifolds
# Sets the total number of specified manifolds
set number = 0
subsection manifold 0
# Boundary mesh id specified in the .gmsh file
set id = 0
# Type of manifold. Choices are <spherical|cylindrical|iges|none>
set type = none
# Center of the sphere or a point along the cylinder's axis (x, y, z)
set point coordinates = 0, 0, 0 #for 2D, set point coordinates = 0, 0
# Direction vector used only for the cylinder (x, y, z)
set direction vector = 0, 1, 0
end
end
First the number of manifolds is specified by the ``set number`` command. Then a subsection for each of the manifolds is created starting with the ``manifold 0``. The boundary ``id`` is in this case set to ``0`` corresponding to the mesh boundary to which the manifold will be applied. Then the ``type`` of the manifold is specified.

* Lethe supports three types of manifolds:

* ``spherical`` manifold: The former can be used to describe any sphere, circle, hypesphere or hyperdisc in two or three dimensions and requires the center of the geometry to set the manifold.
* ``cylindrical`` manifold: Used to describe cylinders in three dimensions. It uses the coordinates of a point and a direction vector located on the axis of the cylinder.

.. caution::
Cylindrical manifolds are not supported in 2D.

* ``iges``: manifold corresponding to a CAD geometry: the last two lines of the ``manifold 0`` subsection are replaced by the following command ``set cad file = file_name.iges`` where the path to the cad file is specified.

.. note::
For more information about manifolds and the reasons behind them, we invite you to read the documentation page of deal.II: `Manifold description for triangulations <https://www.dealii.org/developer/doxygen/deal.II/group__manifold.html>`_.

------------------------
Understanding Manifolds
------------------------

We can clearly see that the geometry is more similar to an octagon than to a circle. This is a problem because the cells composing the mesh are not aware that they should morph to shape a cylinder. After every refinement, an extra node is added between the existing nodes in order to generate new cells. The octagonal shape is therefore conserved as it is illustrated below:

A really coarse mesh of a cylinder viewed from the top looks like this:

.. image:: images/coarse_cylinder.png
:align: center
:width: 400

Manifolds are added to the geometry in order to solve this issue. Using a point and a direction vector along the axis of the cylinder, the cells of a part of the mesh are restricted to respect a certain geometry while refining the mesh. On the image below, the geometry on the left is obtained by adding a cylindrical manifold to the mesh. The geometry on the right is obtained if no manifold are specified.

.. image:: images/fine_cylinder_manifold.png
:align: center
:width: 800


Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 8
set arg2 = 8
set point coordinates = 8, 8
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 8
set arg2 = 8
set point coordinates = 8,8
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 0 # Co-ordinates of sphere centre
set arg2 = 0
set arg3 = 0
set point coordinates = 0,0,0
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 0 # Co-ordinates of sphere centre
set arg2 = 0
set arg3 = 0
set point coordinates = 0, 0, 0
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ subsection manifolds
subsection manifold 0
set id = 0
set type = spherical
set arg1 = 0 # Co-ordinates of sphere centre
set arg2 = 0
set arg3 = 0
set point coordinates = 0,0,0
end
end

Expand Down
Loading

0 comments on commit 6567cbe

Please sign in to comment.