Commit 8454bf7a authored by Mads Christian Baungaard's avatar Mads Christian Baungaard
Browse files

added Gaussian hill example

parent 79fa04ee
# Gaussian hill
Based on the example from the Sørensen (1998)<sup>[1](#Sorensen1998)</sup> HypGrid2D report (Section 6). A recirculation zone is known to appear on the leeward side of the hill, e.g. Liu and Stevens (2020)<sup>[2](#Liu2020)</sup>, and this is indeed also observed in EllipSys2D.
## Case setup
Running the case consists of three steps:
1. Creating the grid with HypGrid2D
2. Creating the block connectivity with Basis2D
3. Running the simulation with EllipSys2D
#### Hypgrid2D
The hill is parametrized with a Gaussian function (see Sørensen (1998)<sup>[1](#Sorensen1998)</sup>, p.32) and is created with a simple python script:
$ cd h2d
$ python
It should create the "prof.dat" file. Next, the grid can be created (assuming you have access to a hypgrid2d executable):
$ ./hypgrid
Choose "no" (i.e. press 2 and enter), when the program asks "if you want to change this". This will create a bunch of files, e.g. the, which can easily be visualized, if you have a Paraview installation:
$ paraview
#### Basis2d
To create the grid and connectivity files, use Basis2D (assuming you have access to a basis2d exectuable):
$ cd ../b2d
$ ln -s ../h2d/grid.X2D grid.x2d
$ ./basis2d
Write "grid", when prompted for the project name and choose yes to "full interface matching". This will create the binary grid.X2D and grid.T2D, which are read by EllipSys2D.
#### EllipSys2D
First create links to the files created previously:
$ cd ..
$ ln -s b2d/grid.X2D .
$ ln -s b2d/grid.T2D .
Then, the simulation can be run (assuming you have access to the EllipSys2D executable):
$ ./flowfieldMPI
Output files are:
- grid.RST.01: The restart file, which can be used for visualization, if you have a Paraview installation and the ellipsys_paraview_plugin.
- grid.res: Iteration history of the residuals.
- grid.OUT: Information about the solver settings.
## References
<a name="Sorensen1998">1</a>:
Niels N. Sørensen,
*HypGrid2D: a 2-D Mesh Generator*,
Risø-R-1035, Risø National Laboratory, Roskilde, Denmark, 1998
<a name="Liu2020">2</a>:
L. Liu and R. Stevens,
*Effects of Two-Dimensional Steep Hills on the Performance of Wind Turbines and Wind Farms*,
import numpy as np
import matplotlib.pyplot as plt
# Parameters
N = 200
h0 = 300
L = 250
x = np.linspace(-1000,1000,N)
h = h0*np.exp(-(x/L)**2*np.log(2))
# Write to file
f = open("prof.dat",'w')
f.write('# %d\n'%(N))
for i in range(N):
f.write(' %.4f %.4f\n'%(x[i],h[i]))
# Plot
fig = plt.figure(figsize=(7.5,4))
ax = fig.gca()
plt.xlabel('$x$ [m]')
plt.ylabel('$y$ [m]')
plt.fill_between(x,np.zeros(len(h)), h, color='gray', alpha=0.5)
plt.title('Gaussian hill',fontsize=20)
\ No newline at end of file
#--------- meshtype to generate
meshtype hmesh
#--------- number of mesh points (in ksi and eta dirs)
meshpoints 128 32
#--------- block size (how grid is split into blocks)
# block-size 32
#--------- height of domain and height of first cell
domain-height 3.d3 1.d-1
# distribution functions:: np x/lmax delta i/imax ......
# surface-distribution 3 0.0d0 0.001d0 0.0d0 0.500d0 0.002d0 0.50130d0 1.0d0 0.001d0 1.0d0
# normal-distribution 2 0.0 1.5d-6 0.0 1.0d0 2.0d0 1.d0
#--------- stretching function
# stretching-function tanh
#--------- surface representation
surface-representation spline
#-------- volume blend factor
# volume-blend 0.0d0
#-------- dissipation factor
# dissipation-factor 1.0d0
#-------- smoothing sweeps and smooth factor
# explicit-smoothing 0 0.d0
#-------- Cells in wake and length of wake
wake-geometry 32 3.0d3
#-------- flow angle
# flow-angle 0.d0
#-------- wake angle
# wake-angle 0.d0
#-------- omesh outelet portion
# omesh-outlet 0 0
#-------- wake contraction for omesh
# wake-contraction 0.d0
# 4
0.00000000000000 0.0
0.30000000000000 0.4
0.70000000000000 0.6
1.00000000000000 1.0
project grid
# --------------------------------------------------------------------
# Solver settings
# --------------------------------------------------------------------
mstep 500
reslim 1.d-22
relaxu 0.7d0
density 1.0d0
viscosity 1.d-5
relaxp .3d0
pres_corr simple
# --------------------------------------------------------------------
# User-defined constants
# --------------------------------------------------------------------
func-const z0 0.03
func-const ustar 0.3
func-const kappa 0.4
func-const cmu 0.03
# remember to also change the roughness further below!
# --------------------------------------------------------------------
# Inlet specification (i.e. inlet and top plane)
# --------------------------------------------------------------------
inlet u 201 300 value ustar/kappa*log((y+z0)/z0)
inlet v 201 300 value 0.0
inlet tke 201 300 value ustar**2/sqrt(cmu)
inlet dtke 201 300 value ustar**3/(kappa*(y+z0))
# --------------------------------------------------------------------
# Field initialization
# --------------------------------------------------------------------
field u value ustar/kappa*log((y+z0)/z0)
field v value 0.0
field tke value ustar**2/sqrt(cmu)
field dtke value ustar**3/(kappa*(y+z0))
# Note1: Turb quanties OK to initialize already here.
# Note2: Turb quantities usually change a lot in the first iterations,
# --------------------------------------------------------------------
# Turbulence model
# --------------------------------------------------------------------
turbulence kepsilon
ke_version rough
loglaw true
# Change constants to atmospheric conditions
kappa 0.4
cmu 0.03
ce1 1.20941505330508
ce2 1.92
pred_ke 1.3
prtke_ke 1.0
roughness 0.03
# Relaxation for turbulence equations
relaxturb 6.0d-1
# -------------------------------------------------------------------
# Extract variables
# -------------------------------------------------------------------
output true
# Iterations between outputting restart files
nrrestart 100
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment