eqn.force_boundary = False
eqn.tol = 1e-7
eqn.solve()
dJdbeta = eqn.calc_sensitivity()
dns, wilcox, wilcox_kw = load_data()
dJdbeta_cs = np.zeros_like(dJdbeta)

dbeta = 1e-30
for i in range(len(dJdbeta)):
    eqn.beta[i] = eqn.beta[i] + 1j*dbeta
    eqn.solve()
    dJdbeta_cs[i] = np.imag(eqn.objective.objective(eqn.q, eqn.beta))/dbeta
    eqn.beta[i] = eqn.beta[i] - 1j*dbeta

plt.figure(4)
dJdbeta11, dJdbeta12, dJdbeta22, dJdbeta33 = get_beta(dJdbeta)
dJdbeta11_cs, dJdbeta12_cs, dJdbeta22_cs, dJdbeta33_cs = get_beta(dJdbeta_cs)
plt.semilogx(eqn.yp, dJdbeta11, 'r-', label=r'R11')
plt.semilogx(eqn.yp, dJdbeta12, 'g-', label=r'R12')
plt.semilogx(eqn.yp, dJdbeta22, 'b-', label=r'R22')
plt.semilogx(eqn.yp, dJdbeta33, 'c-', label=r'R33')
plt.semilogx(eqn.yp, dJdbeta11_cs, 'rx')
plt.semilogx(eqn.yp, dJdbeta12_cs, 'gx')
plt.semilogx(eqn.yp, dJdbeta22_cs, 'bx')
plt.semilogx(eqn.yp, dJdbeta33_cs, 'cx')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$dJdbeta^+$")
plt.legend(loc=2)
plt.tight_layout()
plt.savefig("figs/stress_omega_adjoints.pdf")
plt.show()
inverse_solver.stepsize = 0.1
inverse_solver.algo = "gn"
eqn = inverse_solver.solve()

plt.figure(11)
plt.semilogx(eqn.yp, up_prior, 'g-', label=r'Prior')
plt.semilogx(eqn.yp, eqn.up, 'r-', label=r'Posterior')
plt.semilogx(eqn.yp[::5], utarget[::5]/utau, 'b.', label=r'DNS')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$u^+$")
plt.legend(loc=2)
plt.tight_layout()
plt.savefig("figs/inverse_matchu_u.pdf")

plt.figure(4)
beta11, beta12, beta22, beta33 = get_beta(eqn.beta)
plt.semilogx(eqn.yp, beta11, 'r-', label=r'R11')
plt.semilogx(eqn.yp, beta12, 'g-', label=r'R12')
plt.semilogx(eqn.yp, beta22, 'b-', label=r'R22')
plt.semilogx(eqn.yp, beta33, 'c-', label=r'R33')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$\beta$")
plt.legend()
plt.savefig("figs/inverse_matchu_beta.pdf")



dns, wilcox, wilcox_kw = load_data()
plt.figure(3)
plt.subplot(222)
plt.plot(eqn.yp, -eqn_prior.R11, 'g-', label=r'Prior')
Exemplo n.º 3
0
plt.subplot(223)
plt.plot(eqn.yp, -eqn.R22, 'g-', label=r'$stress-\omega$')
plt.plot(dns.yp[::5], dns.vb[::5]**2, 'b.', label=r'DNS')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$vv^+$")
plt.gca().set_ylim(bottom=0)

plt.subplot(224)
plt.plot(eqn.yp, -eqn.R33, 'g-', label=r'$stress-\omega$')
plt.plot(dns.yp[::5], dns.wb[::5]**2, 'b.', label=r'DNS')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$ww^+$")
plt.gca().set_ylim(bottom=0)
plt.tight_layout()
plt.savefig("figs/stress_omega_reystress.pdf")



plt.figure(4)
dJdbeta11, dJdbeta12, dJdbeta22, dJdbeta33 = get_beta(dJdbeta)
plt.semilogx(eqn.yp, dJdbeta11, '-', label=r'R11')
plt.semilogx(eqn.yp, dJdbeta12, '--', label=r'R12')
plt.semilogx(eqn.yp, dJdbeta22, '-', label=r'R22')
plt.semilogx(eqn.yp, dJdbeta33, '-', label=r'R33')
plt.xlabel(r"$y^+$")
plt.ylabel(r"$dJdbeta^+$")
plt.legend(loc=2)
plt.tight_layout()

plt.show()