-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description The steady-state flow withing a cylindrical packed bed example was working fine, but the documentation was outdated. Furthermore, the figures we atrociously bad and were not representative enough. I have updated the example results and I have added new figures which illustrate the behavior of the VANS equation in a better fashion. I have also added a simple python post-processing script to do these calculations. Co-authored-by: Laura Prieto Saavedra <[email protected]>
- Loading branch information
1 parent
add8558
commit cbb0d94
Showing
10 changed files
with
129 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-43.9 KB
...urce/examples/unresolved-cfd-dem/cylindrical-packed-bed/images/packed-bed-p.png
Binary file not shown.
Binary file removed
BIN
-96.6 KB
...ce/examples/unresolved-cfd-dem/cylindrical-packed-bed/images/packed-bed-vel.png
Binary file not shown.
Binary file modified
BIN
+136 KB
(130%)
...source/examples/unresolved-cfd-dem/cylindrical-packed-bed/images/packed-bed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.8 KB
...nresolved-cfd-dem/cylindrical-packed-bed/images/pressure_drop_void_fraction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+84.2 KB
...les/unresolved-cfd-dem/cylindrical-packed-bed/images/velocity_void_fraction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
examples/unresolved-cfd-dem/cylindrical-packed-bed/post_process_packed_bed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters