Example #1
0
problem.add_bc("left(v) = 0")
problem.add_bc("left(w) = 0")

EP = Eigenproblem(problem, sparse=True)

if find_crit:

    def shim(x, y):
        gr, indx, freq = EP.growth_rate({"Ra": x, "ky": y})
        ret = gr + 1j * freq
        if type(ret) == np.ndarray:
            return ret[0]
        else:
            return ret

    cf = CriticalFinder(shim, comm)

    # generating the grid is the longest part
    start = time.time()
    mins = np.array((10, 0.25))
    maxs = np.array((50, 0.75))
    nums = np.array((10, 10))
    try:
        cf.load_grid('TASBL_Re0_growth_rates.h5')
    except:
        cf.grid_generator(mins, maxs, nums)
        if comm.rank == 0:
            cf.save_grid('TASBL_Re0_growth_rates')
    end = time.time()
    if comm.rank == 0:
        print("grid generation time: {:10.5f} sec".format(end - start))
rayleigh_benard.add_bc('right(b) = 0')
#Impenetrable
rayleigh_benard.add_bc('left(w) = 0')
rayleigh_benard.add_bc('right(w) = 0')

if no_slip:
    rayleigh_benard.add_bc('left(u) = 0')
    rayleigh_benard.add_bc('right(u) = 0')
elif stress_free:
    rayleigh_benard.add_bc('left(uz) = 0')
    rayleigh_benard.add_bc('right(uz) = 0')

# create an Eigenproblem object
EP = Eigenproblem(rayleigh_benard)

cf = CriticalFinder(EP, ("k", "Ra"), comm, find_freq=True)

# generating the grid is the longest part
start = time.time()
if no_slip:
    nx = 20
    ny = 20
    xpoints = np.linspace(2, 4, ny)
    ypoints = np.linspace(1000, 3000, nx)
elif stress_free:
    #657.5, 2.221
    nx = 10
    ny = 10
    xpoints = np.linspace(2, 2.4, ny)
    ypoints = np.linspace(550, 700, nx)
Example #3
0
"""finds the critical Renoylds number and wave number for the
Orr-Somerfeld eigenvalue equation.

"""
from mpi4py import MPI
from eigentools import Eigenproblem, CriticalFinder
import h5py


def fake(x, y):
    return x, y


comm = MPI.COMM_WORLD

cf = CriticalFinder(fake, comm)
cf.load_grid("orr_sommerfeld_growth_rates.h5")

cf.root_finder()
crit = cf.crit_finder()

if comm.rank == 0:
    print("critical wavenumber alpha = {:10.5f}".format(crit[0]))
    print("critical Re = {:10.5f}".format(crit[1]))

    cf.plot_crit()
Example #4
0
)
orr_somerfeld.add_equation('dz(w)-wz = 0')
orr_somerfeld.add_equation('dz(wz)-wzz = 0')
orr_somerfeld.add_equation('dz(wzz)-wzzz = 0')

orr_somerfeld.add_bc('left(w) = 0')
orr_somerfeld.add_bc('right(w) = 0')
orr_somerfeld.add_bc('left(wz) = 0')
orr_somerfeld.add_bc('right(wz) = 0')

# create an Eigenproblem object
EP = Eigenproblem(orr_somerfeld)

# create a shim function to translate (x, y) to the parameters for the eigenvalue problem:

cf = CriticalFinder(EP, ("alpha", "Re"), comm, find_freq=True)

# generating the grid is the longest part
start = time.time()
nx = 20
ny = 20
xpoints = np.linspace(1.0, 1.1, nx)
ypoints = np.linspace(5500, 6000, ny)
try:
    cf.load_grid('{}.h5'.format(file_name))
except:
    cf.grid_generator((xpoints, ypoints), sparse=True)
    if comm.rank == 0:
        cf.save_grid(file_name)
end = time.time()
if comm.rank == 0:
Example #5
0
mri.add_bc("left(u) = 0")
mri.add_bc("right(u) = 0")
mri.add_bc("left(psi) = 0")
mri.add_bc("right(psi) = 0")
mri.add_bc("left(A) = 0")
mri.add_bc("right(A) = 0")
mri.add_bc("left(psix) = 0")
mri.add_bc("right(psix) = 0")
mri.add_bc("left(Bx) = 0")
mri.add_bc("right(Bx) = 0")

# create an Eigenproblem object
EP = Eigenproblem(mri)

cf = CriticalFinder(EP, ("Q", "Rm"), comm, find_freq=False)

# generating the grid is the longest part
nx = 20
ny = 20
xpoints = np.linspace(0.5, 1.5, nx)
ypoints = np.linspace(4.6, 5.5, ny)

file_name = 'mri_growth_rate'
try:
    cf.load_grid('{}.h5'.format(file_name))
except:
    start = time.time()
    cf.grid_generator((xpoints, ypoints), sparse=True)
    end = time.time()