Example #1
0
 def CBLFun(U, y):
     u, F, h, G, g = U.T
     T = 1.0 + 0.5 * h * (gamma - 1.0) * MaInf**2
     assert T > 0
     mu = ConstPropMix.GetViscosity(T * TInf, config) / muInf
     return [
         F / mu, -0.5 * g * F / mu, Pr * G / mu,
         -0.5 * Pr * G * g / mu - 2 * F**2 / mu, u / T
     ]
Example #2
0
def process(frac):
    RhoInf = ConstPropMix.GetDensity(TInf, P, data)
    muInf = ConstPropMix.GetViscosity(TInf, data)
    nuInf = muInf / RhoInf

    dt = data["Integrator"]["fixedDeltaTime"]
    nstep = int(data["Integrator"]["maxIter"])
    time = dt * nstep

    filename = os.path.join(
        dir_name, 'sample0/fluid_iter' + str(nstep).zfill(10) + '/0,0,0-' +
        str(xNum + 1) + ',' + str(yNum + 1) + ',0.hdf')
    exists = os.path.isfile(filename)

    if (not exists):
        # merge files from different tiles
        merge_command = 'python {} {}'.format(
            os.path.expandvars('$HTR_DIR/scripts/merge.py'),
            os.path.join(
                dir_name,
                'sample0/fluid_iter' + str(nstep).zfill(10) + '/*.hdf'))
        mv_command = 'mv {} {}'.format(
            './0,0,0-' + str(xNum + 1) + ',' + str(yNum + 1) + ',0.hdf',
            os.path.join(dir_name,
                         'sample0/fluid_iter' + str(nstep).zfill(10) + '/'))

        try:
            subprocess.call(merge_command, shell=True)
        except OSError:
            print("Failed command: {}".format(merge_command))
            sys.exit()

        try:
            subprocess.call(mv_command, shell=True)
        except OSError:
            print("Failed command: {}".format(mv_command))
            sys.exit()

##############################################################################
#                        Read Prometeo Output Data                           #
##############################################################################

    f = h5py.File(filename, 'r')

    # Get the data
    centerCoordinates = f['centerCoordinates']
    cellWidth = f['cellWidth']
    pressure = f['pressure']
    temperature = f['temperature']
    density = f['rho']
    velocity = f['velocity']

    # Get simulation data along a line (ignore ghost cells)
    x_slice_idx = int(frac * xNum)

    x0 = centerCoordinates[0, 0, 0][0] - xOrigin
    x = centerCoordinates[0, 0, x_slice_idx][0] - xOrigin
    y = centerCoordinates[0, :, x_slice_idx][:, 1] - yOrigin
    u = velocity[0, :, x_slice_idx][:, 0]
    v = velocity[0, :, x_slice_idx][:, 1]
    T = temperature[0, :, x_slice_idx]
    p = pressure[0, :, x_slice_idx]
    rho = density[0, :, x_slice_idx]

    x += Re * nuInf / U - x0
    myRe = U * x / nuInf
    print(myRe)

    eta = np.zeros(y.size)
    for i in range(y.size):
        if (i > 0):
            rhoMid = 0.5 * (rho[i] + rho[i - 1])
            eta[i] = eta[i - 1] + U / (muInf * np.sqrt(2 * myRe)) * rhoMid * (
                y[i] - y[i - 1])

    return eta, u / U, v * np.sqrt(2.0 * myRe) / U, T / TInf, p
Example #3
0
assert config["BC"]["yBCRight"]["TemperatureProfile"]["type"] == "Constant"
assert config["BC"]["yBCLeft"]["TemperatureProfile"]["temperature"] == config[
    "BC"]["yBCRight"]["TemperatureProfile"]["temperature"]
Tw = config["BC"]["yBCLeft"]["TemperatureProfile"]["temperature"]

# Read properties
Pb = config["Flow"]["initParams"][0]
Tb = config["Flow"]["initParams"][1]
gamma = config["Flow"]["gamma"]
R = config["Flow"]["gasConstant"]
assert config["Flow"]["turbForcing"]["type"] == "CHANNEL"
assert config["Flow"]["initCase"] == "ChannelFlow"
assert Tw == Tb

cW = np.sqrt(gamma * R * Tw)
muW = ConstPropMix.GetViscosity(Tw, config)

uB = cW * MaB
rhoB = Pb / (R * Tb)

h = ReB * muW / (rhoB * uB)
print("h = ", h)

rhoW = rhoB
uTau = ReTau * muW / (rhoW * h)
deltaNu = muW / (uTau * rhoW)
TauW = uTau**2 * rhoB

yPlusTrg = 0.8

Example #4
0
ReIn = config["Case"]["ReInlet"]
MaInf = config["Case"]["MaInf"]
TInf = config["Case"]["TInf"]
PInf = config["Case"]["PInf"]
TwOvT = config["Case"]["TwOvTInf"]
xTurb = config["Case"]["xTurb"]
yPlus = config["Case"]["yPlus"]

R = config["Flow"]["gasConstant"]
gamma = config["Flow"]["gamma"]
Pr = config["Flow"]["prandtl"]

# Free-stream mixture properties
cInf = np.sqrt(gamma * R * TInf)
muInf = ConstPropMix.GetViscosity(TInf, config)

# Free-stream conditions
UInf = cInf * MaInf
rhoInf = ConstPropMix.GetDensity(TInf, PInf, config)

# Inlet displacement thickness
deltaStarIn = muInf * ReIn / (UInf * rhoInf)

# Wall properties
Tw = TInf * TwOvT
muW = ConstPropMix.GetViscosity(Tw, config)
rhoW = ConstPropMix.GetDensity(Tw, PInf, config)

r = Pr**(1.0 / 3.0)
Taw = TInf * (1.0 + r * 0.5 * (gamma - 1.0) * MaInf**2)
Example #5
0
assert config["Flow"]["initCase"] == "Restart"
restartDir = config["Flow"]["restartDir"]

config["BC"]["xBCLeftInflowProfile"]["FileDir"] = restartDir
config["BC"]["xBCLeftHeat"]["FileDir"] = restartDir
TInf = config["BC"]["xBCLeftHeat"]["temperature"]
Tw = config["BC"]["xBCLeftHeat"]["temperature"]
P = config["BC"]["xBCLeftP"]
UInf = config["BC"]["xBCLeftInflowProfile"]["velocity"]
Rex0 = config["BC"]["xBCLeftInflowProfile"]["Reynolds"]

aInf = np.sqrt(gamma * R * TInf)
MaInf = UInf / aInf

RhoInf = ConstPropMix.GetDensity(TInf, P, config)
muInf = ConstPropMix.GetViscosity(TInf, config)
nuInf = ConstPropMix.GetViscosity(TInf, config) / RhoInf

##############################################################################
#                              Generate Grid                                 #
##############################################################################

xGrid, dx = gridGen.GetGrid(config["Grid"]["origin"][0],
                            config["Grid"]["xWidth"], config["Grid"]["xNum"],
                            config["Grid"]["xType"],
                            config["Grid"]["xStretching"], False)

yGrid, dy = gridGen.GetGrid(config["Grid"]["origin"][1],
                            config["Grid"]["yWidth"], config["Grid"]["yNum"],
                            config["Grid"]["yType"],
                            config["Grid"]["yStretching"], False)
Example #6
0
gamma = data["Flow"]["mixture"]["gamma"]
R     = data["Flow"]["mixture"]["gasConstant"]
Pr    = data["Flow"]["mixture"]["prandtl"]

TInf = data["BC"]["xBCLeft"]["TemperatureProfile"]["temperature"]
Tw   = data["BC"]["xBCLeft"]["TemperatureProfile"]["temperature"]
P    = data["BC"]["xBCLeft"]["P"]
U    = data["BC"]["xBCLeft"]["VelocityProfile"]["velocity"]
Re   = data["BC"]["xBCLeft"]["VelocityProfile"]["Reynolds"]
 
aInf = np.sqrt(gamma*R*TInf)
MaInf = U/aInf

RhoInf = ConstPropMix.GetDensity(TInf, P, data)
muInf = ConstPropMix.GetViscosity(TInf, data)
nuInf = muInf/RhoInf

##############################################################################
#                           Compute Blasius Solution                         #
##############################################################################
def GetCBL():
   def CBLFun(U, y):
      u, F, h, G, g = U.T
      T = 1.0 + 0.5*h*(gamma - 1.0)*MaInf**2
      mu = T**0.7
      return [ F/mu,
               -0.5*g*F/mu,
               Pr*G/mu,
               -0.5*Pr*G*g/mu - 2*F**2/mu,
               u/T ]