Skip to content

Commit 647f169

Browse files
TobiKattmannTobiKattmann
andauthored
Feature periodic streamwise (#51)
* Streamwise periodic incompressible testcase mesh added. * Added 3D 1Slice pipe mesh for streamwise periodicity. * Adding 2 small meshes for streamwise periodic flow * Add gmsh .geo files (and other) for streamwise periodicity. * Added cht mesh with FFD box * Added primal solution for DA streamwise periodic case. * Changed solution files for cht streamwise case. * Little change of restart file for streamwise periodic. * Change restart file for cht_pinarry testcase for DA. * Change mesh. * Removing unneccesary files Co-authored-by: TobiKattmann <[email protected]>
1 parent f070b9a commit 647f169

File tree

10 files changed

+147330
-0
lines changed

10 files changed

+147330
-0
lines changed

incomp_navierstokes/streamwise_periodic/chtPinArray_2d/2D-PinArray.su2

Lines changed: 32154 additions & 0 deletions
Large diffs are not rendered by default.

incomp_navierstokes/streamwise_periodic/chtPinArray_2d/2D-PinArray_FFD.su2

Lines changed: 32449 additions & 0 deletions
Large diffs are not rendered by default.

incomp_navierstokes/streamwise_periodic/chtPinArray_2d/chtPinArray_2d.geo

Lines changed: 429 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.

incomp_navierstokes/streamwise_periodic/chtPinArray_3d/3D_chtPinArray_coarse.su2

Lines changed: 59858 additions & 0 deletions
Large diffs are not rendered by default.

incomp_navierstokes/streamwise_periodic/chtPinArray_3d/3D_pinArray.geo

Lines changed: 896 additions & 0 deletions
Large diffs are not rendered by default.

incomp_navierstokes/streamwise_periodic/pipeSlice_3d/pipe1cell3D.su2

Lines changed: 21269 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
//-------------------------------------------------------------------------------------//
2+
// T. Kattmann, 13.05.2018, 3D Butterfly mesh in a circular pipe
3+
// Create the mesh by calling this geo file with 'gmsh <this>.geo'.
4+
//-------------------------------------------------------------------------------------//
5+
6+
// Evoque Meshing Algorithm?
7+
Do_Meshing= 1; // 0=false, 1=true
8+
// Write Mesh files in .su2 format
9+
Write_mesh= 1; // 0=false, 1=true
10+
11+
//Geometric inputs, ch: channel, Pin center is origin
12+
Radius= 0.5e-2; // Pipe Radius
13+
InnerBox= Radius/2; // Distance to the inner Block of the butterfly mesh
14+
15+
//Mesh inputs
16+
gridsize = 0.1; // unimportant once everything is structured
17+
18+
//ch_box
19+
Nbox = 30; // Inner Box points in x direction
20+
21+
Ncircu = 30; // Outer ring circu. points
22+
Rcircu = 0.9; // Spacing towards wall
23+
24+
sqrtTwo = Cos(45*Pi/180);
25+
26+
//-------------------------------------------------------------------------------------//
27+
//Points
28+
// Inner Box
29+
Point(1) = {-InnerBox, -InnerBox, 0, gridsize};
30+
Point(2) = {-InnerBox, InnerBox, 0, gridsize};
31+
Point(3) = {InnerBox, InnerBox, 0, gridsize};
32+
Point(4) = {InnerBox, -InnerBox, 0, gridsize};
33+
34+
// Outer Ring
35+
Point(5) = {-Radius*sqrtTwo, -Radius*sqrtTwo, 0, gridsize};
36+
Point(6) = {-Radius*sqrtTwo, Radius*sqrtTwo, 0, gridsize};
37+
Point(7) = {Radius*sqrtTwo, Radius*sqrtTwo, 0, gridsize};
38+
Point(8) = {Radius*sqrtTwo, -Radius*sqrtTwo, 0, gridsize};
39+
40+
Point(9) = {0,0,0,gridsize}; // Helper Point for circles
41+
42+
//-------------------------------------------------------------------------------------//
43+
//Lines
44+
//Inner Box (clockwise)
45+
Line(1) = {1,2};
46+
Line(2) = {2,3};
47+
Line(3) = {3,4};
48+
Line(4) = {4,1};
49+
50+
//Walls (clockwise)
51+
Circle(5) = {5, 9, 6};
52+
Circle(6) = {6, 9, 7};
53+
Circle(7) = {7, 9, 8};
54+
Circle(8) = {8, 9, 5};
55+
56+
//Connecting lines (outward facing)
57+
Line(9) = {1, 5};
58+
Line(10) = {2, 6};
59+
Line(11) = {3, 7};
60+
Line(12) = {4, 8};
61+
62+
//-------------------------------------------------------------------------------------//
63+
//Lineloops and surfaces
64+
// Inner Box (clockwise)
65+
Line Loop(1) = {1,2,3,4}; Plane Surface(1) = {1};
66+
67+
// Ring sections (clockwise starting at 9 o'clock)
68+
Line Loop(2) = {5, -10, -1, 9}; Plane Surface(2) = {2};
69+
Line Loop(3) = {10, 6, -11, -2}; Plane Surface(3) = {3};
70+
Line Loop(4) = {-3, 11, 7, -12}; Plane Surface(4) = {4};
71+
Line Loop(5) = {12, 8, -9, -4}; Plane Surface(5) = {5};
72+
73+
//make structured mesh with transfinite lines
74+
//radial
75+
Transfinite Line{1, 2, 3, 4, 5, 6, 7, 8} = Nbox;
76+
//circumferential
77+
Transfinite Line{9, 10, 11, 12} = Ncircu Using Progression Rcircu;
78+
79+
Transfinite Surface{1,2,3,4,5};
80+
Recombine Surface{1,2,3,4,5};
81+
82+
//Extrude 1 mesh layer
83+
Extrude {0, 0, 0.0005} {
84+
Surface{1}; Surface{2}; Surface{3}; Surface{4}; Surface{5};
85+
Layers{1};
86+
Recombine;
87+
}
88+
Coherence;
89+
90+
//Physical groups made with GUI
91+
Physical Surface("inlet") = {4, 1, 5, 3, 2};
92+
Physical Surface("outlet") = {100, 122, 56, 78, 34};
93+
Physical Surface("wall") = {69, 95, 113, 43};
94+
Physical Volume("fluid") = {1, 2, 3, 4, 5};
95+
96+
// ----------------------------------------------------------------------------------- //
97+
// Meshing
98+
Transfinite Surface "*";
99+
Recombine Surface "*";
100+
101+
If (Do_Meshing == 1)
102+
Mesh 1; Mesh 2; Mesh 3;
103+
EndIf
104+
105+
// ----------------------------------------------------------------------------------- //
106+
// Write .su2 meshfile
107+
If (Write_mesh == 1)
108+
109+
Mesh.Format = 42; // .su2 mesh format,
110+
Save "pipe1cell3D.su2";
111+
112+
EndIf
113+
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#! /usr/bin/python3
2+
# --------------------------------------------------------------------------- #
3+
# Kattmann, 16.07.2019
4+
# This python script provides some plots to test the match between analytical
5+
# and simulated solution for a 3D circular laminar pipe flow, either from
6+
# streamwise periodic simulation or the outlet of a suitable long pipe.
7+
#
8+
# requires: surface_flow.dat (SURFACE_TECPLOT_ASCII) in current directory
9+
#
10+
# output: plots (opened in separate window, not saved)
11+
#
12+
# optional: which plots to show
13+
showLineplot = True
14+
show2Dsurfaceplots = False
15+
show3Dplots = False
16+
# --------------------------------------------------------------------------- #
17+
import numpy as np
18+
import pandas as pd
19+
import matplotlib.pyplot as plt
20+
21+
from mpl_toolkits.mplot3d import Axes3D
22+
from scipy.spatial import Delaunay
23+
from scipy.interpolate import LinearNDInterpolator
24+
25+
# --------------------------------------------------------------------------- #
26+
# Import data from surface_flow.dat into pandas dataframe
27+
data = pd.read_csv("surface_flow.dat", nrows=4264, skiprows=3, sep='\t', header=None)
28+
x = data[0][:]
29+
y = data[1][:]
30+
vel_z = data[6][:]
31+
32+
# Create Delaunay surface triangulation from scatterd dataset
33+
points2D = np.vstack([x,y]).T
34+
tri = Delaunay(points2D)
35+
36+
# --------------------------------------------------------------------------- #
37+
# Create analytic solution vector on the same points as the imported data
38+
dynanmic_vsicosity = 1.8e-5
39+
pressure_drop = 1e-3
40+
domain_length = 5e-4
41+
radius = 5e-3
42+
43+
analytic_sol = -1/(4*dynanmic_vsicosity) * (-pressure_drop/domain_length) * \
44+
(radius**2 - ((x**2 + y**2)**(0.5))**2 )
45+
46+
perc_devi_from_anal = abs(analytic_sol - vel_z) / max(analytic_sol) * 100
47+
maxvel = max(abs(perc_devi_from_anal)) # get absolute maximum of dataset
48+
49+
# --------------------------------------------------------------------------- #
50+
# Plot velocity on line from domain midpoint to wall
51+
if showLineplot:
52+
plt.close()
53+
54+
# interpolator (ip) for simulated and analytical dataset
55+
ip_sim = LinearNDInterpolator(tri, vel_z)
56+
ip_ana = LinearNDInterpolator(tri, analytic_sol)
57+
# line (which lies on the x-axis) where values will be interpolated
58+
n_sample_points = 30
59+
x_line = np.linspace(0, radius-5e-6, n_sample_points)
60+
y_line = np.zeros(n_sample_points)
61+
ip_pos = np.vstack((x_line,y_line)).T
62+
63+
ax = plt.axes()
64+
plt.plot(ip_sim(ip_pos), x_line, color='b', marker='', linestyle='--', linewidth=3, label='simulated')
65+
plt.plot(ip_ana(ip_pos), x_line, color='r', marker='', linestyle=':' , linewidth=3, label='analytical')
66+
plt.legend()
67+
plt.title('Velocity profile: analytic vs simulated (interpolated values)')
68+
plt.xlabel('velocity [m/s]')
69+
plt.ylabel('radius [m]')
70+
ax.set_aspect(aspect=max(ip_sim(ip_pos)) / max(x_line)) # make plot square
71+
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
72+
plt.grid(True, linestyle='--')
73+
plt.show()
74+
75+
# --------------------------------------------------------------------------- #
76+
# Plot various 2D surface plots of sim. and analy. data
77+
if show2Dsurfaceplots:
78+
plt.close()
79+
80+
fig, ax = plt.subplots(2,2)
81+
82+
# 1. analytical solution
83+
ax_tmp = ax[0,0]
84+
85+
tcf = ax_tmp.tricontourf(x, y, abs(analytic_sol))
86+
ax_tmp.scatter(x,y, s=0.1, color='black', marker='.')
87+
88+
ax_tmp.set_title("Analytical solution")
89+
ax_tmp.set_aspect('equal')
90+
fig.colorbar(tcf, ax=ax_tmp)
91+
92+
# 2. simulated solution
93+
ax_tmp = ax[1,0]
94+
95+
tcf = ax_tmp.tricontourf(x, y, vel_z)
96+
ax_tmp.scatter(x,y, s=0.1, color='black', marker='.')
97+
98+
ax_tmp.set_title("Simulated solution")
99+
ax_tmp.set_aspect('equal')
100+
fig.colorbar(tcf, ax=ax_tmp)
101+
102+
# 3. absolute value deviation between analytic and simulated
103+
ax_tmp = ax[0,1]
104+
105+
tcf = ax_tmp.tricontourf(x, y, abs(analytic_sol-vel_z), cmap=plt.cm.Greys)
106+
ax_tmp.scatter(x,y, s=0.1, color='black', marker='.')
107+
108+
ax_tmp.set_title("abs(analytic-simulated)")
109+
ax_tmp.set_aspect('equal')
110+
fig.colorbar(tcf, ax=ax_tmp)
111+
112+
# 4. percentual deviation scaled by the maximal value
113+
ax_tmp = ax[1,1]
114+
115+
tcf = ax_tmp.tricontourf(x, y, perc_devi_from_anal, cmap=plt.cm.Greys, vmin=0.0, vmax=maxvel)
116+
ax_tmp.scatter(x,y, s=0.1, color='black', marker='.')
117+
118+
ax_tmp.set_title("abs(analytic-simulated) / max(analytic) * 100")
119+
ax_tmp.set_aspect('equal')
120+
fig.colorbar(tcf, ax=ax_tmp)
121+
122+
plt.show()
123+
124+
# --------------------------------------------------------------------------- #
125+
if show3Dplots:
126+
# Plot 3D surfaces of sim. and analy. data
127+
plt.close()
128+
129+
# Scatter plot deviation
130+
fig = plt.figure()
131+
ax = fig.gca(projection='3d')
132+
133+
ax.scatter(x, y, perc_devi_from_anal)
134+
ax.set_xlabel('x [m]')
135+
ax.set_ylabel('y [m]')
136+
ax.set_zlabel('z-Velocity deviation [%]')
137+
138+
plt.show()
139+
140+
# Surface plot deviation
141+
fig = plt.figure()
142+
ax = fig.gca(projection='3d')
143+
144+
surf = ax.plot_trisurf(x, y, perc_devi_from_anal, triangles=tri.simplices, cmap='jet', linewidth=0)
145+
ax.set_xlabel('x [m]')
146+
ax.set_ylabel('y [m]')
147+
ax.set_zlabel('z-Velocity deviation [%]')
148+
fig.colorbar(surf)
149+
150+
plt.show()
151+
152+
# Surface plot of velocity
153+
fig = plt.figure()
154+
ax = fig.gca(projection='3d')
155+
156+
surf = ax.plot_trisurf(x, y, vel_z, triangles=tri.simplices, cmap='jet', linewidth=0)
157+
ax.set_xlabel('x [m]')
158+
ax.set_ylabel('y [m]')
159+
ax.set_zlabel('z-Velocity [m/s]')
160+
fig.colorbar(surf)
161+
162+
plt.show()

0 commit comments

Comments
 (0)