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

Cylindrical packed bed #1369

Merged
merged 8 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Cylindrical Packed Bed
==================================

It is strongly recommended to visit `DEM parameters <../../../parameters/dem/dem.html>`_ and `CFD-DEM parameters <../../../parameters/unresolved-cfd-dem/unresolved-cfd-dem.html>`_ for more detailed information on the concepts and physical meaning of the parameters ind DEM and CFD-DEM.
It is strongly recommended to visit `DEM parameters <../../../parameters/dem/dem.html>`_ and `CFD-DEM parameters <../../../parameters/unresolved-cfd-dem/unresolved-cfd-dem.html>`_ for more detailed information on the concepts and physical meaning of the parameters in DEM and CFD-DEM.


----------------------------------
Expand All @@ -16,7 +16,7 @@ Features


---------------------------
Files Used in This Example
Files Used in this Example
---------------------------

Both files mentioned below are located in the example's folder (``examples/unresolved-cfd-dem/cylindrical-packed-bed``).
Expand Down Expand Up @@ -51,7 +51,7 @@ The ``mesh`` subsection specifies the computational grid:
set type = dealii
set grid type = subdivided_cylinder
set grid arguments = 16:0.01:0.1
set initial refinement = 1
set initial refinement = 2
end

Simulation Control
Expand Down Expand Up @@ -95,7 +95,6 @@ The section on model parameters is explained in the DEM examples. We show the ch

subsection model parameters
set contact detection method = dynamic
set contact detection frequency = 10
set neighborhood threshold = 1.3
set particle particle contact force method = hertz_mindlin_limit_overlap
set particle wall contact force method = nonlinear
Expand Down Expand Up @@ -227,9 +226,8 @@ The simulation is run in steady state. The simulation control section is shown:
.. code-block:: text

subsection simulation control
set method = bdf1
set output name = result
set output path = ./output/
set method = bdf1
set output path = ./output/
end

Physical Properties
Expand Down Expand Up @@ -263,7 +261,7 @@ For the initial conditions, we choose zero initial conditions for the velocity.
Boundary Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For the boundary conditions, we choose a slip boundary condition on the walls of the cylinder (ID = 0) and an inlet velocity of 0.2 m/s at the lower face of the cylinder (ID = 1).
For the boundary conditions, we set a slip boundary condition on the walls of the cylinder (ID = 0), an inlet velocity of 0.2 m/s at the lower face of the cylinder (ID = 1) and an outlet at the upper face of the cylinder (ID = 2).

.. code-block:: text

Expand All @@ -286,6 +284,10 @@ For the boundary conditions, we choose a slip boundary condition on the walls of
set Function expression = 0
end
end
subsection bc 2
set id = 2
set type = outlet
end
end


Expand Down Expand Up @@ -351,12 +353,13 @@ Linear Solver
subsection linear solver
subsection fluid dynamics
set method = gmres
set max iters = 5000
set max iters = 2000
set max krylov vectors = 2000
set relative residual = 1e-3
set minimum residual = 1e-11
set minimum residual = 1e-10
set preconditioner = ilu
set ilu preconditioner fill = 1
set ilu preconditioner absolute tolerance = 1e-14
set ilu preconditioner fill = 4
set ilu preconditioner absolute tolerance = 1e-12
set ilu preconditioner relative tolerance = 1.00
set verbosity = verbose
end
Expand All @@ -372,18 +375,18 @@ The simulation is run using the ``lethe-fluid-vans`` application. Assuming that
.. code-block:: text
:class: copy-button

lethe-fluid-vans parameter_file.prm
mpirun -np 8 lethe-fluid-vans flow-in-bed.prm


-------------
Results VANS
-------------
The results are shown in the plots below. We visualise the velocity of the fluid, the void fraction calculated using the particles' locations, and the pressure drop resulting from the particle-fluid interactions (drag). The plots to the right show the local distribution of the quantities at the center-line of the cylinder.
The results are shown in the plots below. The first plot visualises the velocity of the fluid and the void fraction along the center axis of the cylinder. We see that the fluid rapidly accelerates in as the void fraction decreases to ensure mass conservation. The second plot displays the pressure drop resulting from the particle-fluid interactions. The quasi totality of the pressure drop occurs within the bed of particles.

.. image:: images/packed-bed-vel.png
.. image:: images/velocity_void_fraction.png
:alt: velocity and void fraction distribution
:align: center

.. image:: images/packed-bed-p.png
.. image:: images/pressure_drop_void_fraction.png
:alt: pressure drop in packed bed
:align: center
Binary file not shown.
Binary file not shown.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 9 additions & 18 deletions examples/unresolved-cfd-dem/cylindrical-packed-bed/flow-in-bed.prm
blaisb marked this conversation as resolved.
Show resolved Hide resolved
blaisb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set dimension = 3

subsection simulation control
set method = steady
set output name = result
set output path = ./output/
end
blaisb marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -44,7 +43,7 @@ subsection mesh
set type = dealii
set grid type = subdivided_cylinder
set grid arguments = 16:0.01:0.1
set initial refinement = 1
set initial refinement = 2
end

#---------------------------------------------------
Expand All @@ -55,7 +54,7 @@ subsection void fraction
set mode = pcm
set read dem = true
set dem file name = dem
set l2 smoothing factor = 0.000005
set l2 smoothing factor = 0.00001
set l2 lower bound = 0
set l2 upper bound = 1
end
Expand Down Expand Up @@ -110,19 +109,11 @@ subsection boundary conditions
end
end
subsection bc 2
set id = 2
set id = 2
set type = outlet
end
end

#---------------------------------------------------
# Mesh Adaptation Control
#---------------------------------------------------

subsection mesh adaptation
set type = none
end

#---------------------------------------------------
# Timer
#---------------------------------------------------
Expand All @@ -137,7 +128,7 @@ end

subsection non-linear solver
subsection fluid dynamics
set tolerance = 1e-9
set tolerance = 1e-8
set max iterations = 20
set verbosity = verbose
end
Expand All @@ -150,13 +141,13 @@ end
subsection linear solver
subsection fluid dynamics
set method = gmres
set max iters = 1000
set max krylov vectors = 1000
set max iters = 2000
set max krylov vectors = 2000
set relative residual = 1e-3
set minimum residual = 1e-11
set minimum residual = 1e-10
set preconditioner = ilu
set ilu preconditioner fill = 3
set ilu preconditioner absolute tolerance = 1e-14
set ilu preconditioner fill = 4
set ilu preconditioner absolute tolerance = 1e-12
set ilu preconditioner relative tolerance = 1.00
set verbosity = verbose
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end
#---------------------------------------------------

subsection timer
set type = none
set type = iteration
end

#---------------------------------------------------
Expand Down Expand Up @@ -119,5 +119,5 @@ subsection mesh
set type = dealii
set grid type = subdivided_cylinder
set grid arguments = 16:0.01:0.1
set initial refinement = 1
set initial refinement = 2
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# SPDX-FileCopyrightText: Copyright (c) 2022, 2024 The Lethe Authors
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later

"""
Postprocessing code for cylindrical packed bed
This code extracts the pressure along the x axis at the center of the cylinder

"""

# Modules
#-------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
import pyvista as pv

# Plot font and colors
#---------------------
font = {'weight' : 'normal',
'size' : 13}

plt.rc('font', **font)
colors=['#1b9e77','#d95f02','#7570b3','#e7298a','#66a61e','#e6ab02']

#--------------------------------------------
# Main
#--------------------------------------------

# Load VTU file
vtu_file="./output/out.00001.00000.vtu"
sim = pv.read(vtu_file)
sim.set_active_scalars("pressure")

# Create begin and end point of line
a = [-0.1, 0, 0]
b = [0.1, 0, 0]

# Extract all field over the line using pyvista
sampled_data=sim.sample_over_line(a, b, resolution=1000)

# Get pressure from sampled data
x = sampled_data["Distance"]
p = sampled_data["pressure"][:]



# Get void fraction from sampled data
sim.set_active_scalars("void_fraction")
sampled_data=sim.sample_over_line(a, b, resolution=1000)
x_2 = sampled_data["Distance"]
void_fraction = sampled_data["void_fraction"][:]

# Create the figure and the first axis
fig, ax1 = plt.subplots()

# Plot the data for the first y-axis
ax1.plot(x,p,label="Pressure drop",color=colors[0])
ax1.set_xlabel('Position') # Common x-axis label
ax1.set_ylabel('Pressure', color=colors[0])
ax1.set_ylim([-1,10])
ax1.tick_params(axis='y', labelcolor=colors[0]) # Set y-axis tick color
ax1.set_xticks([0,0.05,0.1,0.15,0.2]) #xticks(np.arange(min(x), max(x)+1, 1.0))

# Create a second y-axis sharing the same x-axis
ax2 = ax1.twinx()
ax2.plot(x_2,void_fraction,label="Void Fraction",color=colors[1])
ax2.set_ylabel('Void fraction', color=colors[1])
ax2.tick_params(axis='y', labelcolor=colors[1]) # Set y-axis tick color
plt.savefig("pressure_drop_void_fraction.png",dpi=200)
plt.show()


# Get u component of the velocity from sampled data
sim.set_active_vectors("velocity")
y = sampled_data["Distance"]
u = sampled_data["velocity"][:,0]

# Create the figure and the first axis
fig, ax1 = plt.subplots()

# Plot the data for the first y-axis
ax1.plot(x,u,label="Velocity",color=colors[2])
ax1.set_xlabel('Position') # Common x-axis label
ax1.set_ylabel('Velocity', color=colors[2])
#ax1.set_ylim([-1,10])
ax1.tick_params(axis='y', labelcolor=colors[2]) # Set y-axis tick color
ax1.set_xticks([0,0.05,0.1,0.15,0.2]) #xticks(np.arange(min(x), max(x)+1, 1.0))

# Create a second y-axis sharing the same x-axis
ax2 = ax1.twinx()
ax2.plot(x_2,void_fraction,label="Void Fraction",color=colors[1])
ax2.set_ylabel('Void fraction', color=colors[1])
ax2.tick_params(axis='y', labelcolor=colors[1]) # Set y-axis tick color
plt.savefig("velocity_void_fraction.png",dpi=200)
plt.show()

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ set dimension = 3
#---------------------------------------------------

subsection simulation control
set method = bdf2
set number mesh adapt = 0
set output frequency = 50
set time end = 5
set time step = 0.001
set output path = output/
set method = bdf2
set number mesh adapt = 0
set output frequency = 50
set time end = 5
set time step = 0.001
set output path = output/
end

#---------------------------------------------------
Expand Down Expand Up @@ -118,7 +118,6 @@ end
# Boundary Conditions
#---------------------------------------------------


subsection boundary conditions
set time dependent = false
set number = 5
Expand All @@ -144,16 +143,16 @@ subsection boundary conditions
end

subsection bc 2 #wall
set id = 6
set id = 6
set type = slip
end

subsection bc 3 #channel_wall
set id = 5
set id = 5
set type = slip
end
subsection bc 4 #bed_wall_bottom

subsection bc 4 #bed_wall_bottom
set id = 4
set type = function
subsection u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ end
#---------------------------------------------------
# Post-processing
#---------------------------------------------------

subsection post-processing
# Enable output of grid, granular temperature, and particles' average velocity
set lagrangian post-processing = true
# Enable output of grid, granular temperature, and particles' average velocity
set lagrangian post-processing = true
end

#---------------------------------------------------
Expand Down Expand Up @@ -75,7 +76,7 @@ subsection lagrangian physical properties
set size distribution type = uniform
set diameter = 0.005
set number of particles = 100000
set density particles = 100
set density particles = 100
set young modulus particles = 1e7
set poisson ratio particles = 0.25
set restitution coefficient particles = 0.97
Expand Down
Loading