Domain: Physics — Physics (general)

Problem:
Find the non-dimensional distance $\eta$ in the Blasius laminar flat-plate boundary layer so that the $u$ velocity is greater than $0.8U_0$ where $U_0$ is the free stream velocity. Round the final answer to two decimal places. Assume the boundary layer satisfies the similarity equation $f^{\prime\prime\prime}+\frac{1}{2}ff^{\prime\prime}+\beta(1-(f^\prime)^2)=0$, where $f(\eta)$ is the similarity function and the last term on the left hand side is the pressure gradient term, $\beta=0.3$.

Answer: $1.77$

Solution code:
import numpy as np
from scipy.integrate import solve_bvp
from scipy.optimize import brentq


def falkner_skan_ode(eta, y, beta):
    f = y[0]
    fp = y[1]
    fpp = y[2]

    f3 = -0.5 * f * fpp - beta * (1.0 - fp**2)
    return np.vstack((fp, fpp, f3))


def boundary_conditions(ya, yb):
    return np.array([
        ya[0],     
        ya[1],      
        yb[1] - 1.0  
    ])


def solve_falkner_skan(beta=0.3, eta_max=20.0, n_points=200):
    eta = np.linspace(0.0, eta_max, n_points)

    y_init = np.zeros((3, eta.size))
    y_init[1] = 1.0 - np.exp(-eta)
    y_init[0] = eta - (1.0 - np.exp(-eta))

    sol = solve_bvp(
        lambda x, y: falkner_skan_ode(x, y, beta),
        boundary_conditions,
        eta,
        y_init,
        max_nodes=10000,
        tol=1e-5,
    )

    if sol.status != 0:
        print("Warning: BVP solver did not fully converge:", sol.message)

    return sol


def find_eta_for_u_ratio(sol, target_ratio=0.8):
    eta_max = sol.x[-1]

    eta_dense = np.linspace(0.0, eta_max, 2000)
    fp_dense = sol.sol(eta_dense)[1]

    if target_ratio < fp_dense[0] or target_ratio > fp_dense[-1]:
        raise RuntimeError("Target velocity ratio is outside the computed range.")

    idx_candidates = np.where(fp_dense >= target_ratio)[0]
    if len(idx_candidates) == 0:
        raise RuntimeError("Failed to bracket the target velocity ratio.")
    idx = idx_candidates[0]

    if idx == 0:
        eta_left = eta_dense[0]
        eta_right = eta_dense[1]
    else:
        eta_left = eta_dense[idx - 1]
        eta_right = eta_dense[idx]

    def root_fun(e):
        return sol.sol(e)[1] - target_ratio

    eta_star = brentq(root_fun, eta_left, eta_right)

    return eta_star


if __name__ == "__main__":
    beta = 0.3

    solution = solve_falkner_skan(beta=beta, eta_max=20.0, n_points=200)

    target_u_over_U0 = 0.8
    eta_star = find_eta_for_u_ratio(solution, target_ratio=target_u_over_U0)

    print(f"Non-dimensional distance eta where u/U0 = {target_u_over_U0}: {eta_star:.5f}")