Viscous Flow Design Project — Viscous Flow Code Optimization
Consider the same fully developed turbulent flow in a channel that was solved in Assignment #8:
Now, improve the Prandtl algebraic code that you wrote in Assignment #8 and submit a new final code that makes the following ratio as high as possible: $$\Phi=\frac{1}{N \times n}$$ In the latter, $N$ is the number of nodes and $n$ is the number of iterations needed to obtain convergence. To maximize $\Phi$, make the following changes:
 (a) Take advantage of the symmetry of the problem: reduce the domain from $0\le y \le 2 H$ to $0 \le y \le H$ by imposing a symmetrical boundary condition at $y=H$. (b) Implement variable grid spacing and cluster more nodes near the wall than near the axis of symmetry. (c) Adjust the relaxation factor alpha for optimal convergence rates (d) Use higher-order polynomials to extrapolate the properties at the cells interfaces (optional: extra bonus given).
You need to edit the functions init_y_u() and find_coefficients_and_rhs() only:
/* initialize y[], u[], k[], omega[] on all nodes given
N -> number of nodes
H -> height of half channel in m
*/
void init_y_u(long N, double H, double dy1, double *y, double *u){
long j;

}

/* finds the discretization coefficients a,b,c in kg/m3s and the RHS rhs in Pa/m for all nodes given
N -> number of nodes
H -> half height of the channel in m
rho -> density in kg/m3
mu -> viscosity in kg/ms
dPdx -> pressure gradient in Pa/m
u[] -> velocity on all nodes in m/s */
void find_coefficients_and_rhs(long N, double *y, double rho, double mu, double dPdx, double *u, double *a, double *b, double *c, double *rhs){

}
Everything else should be left untouched and will work fine (assuming that node 1 is a wall boundary and node N is a symmetry boundary).

 07.01.16
 Notes
 1. The number $n$ must correspond to the number of iterations needed for all properties to reach a relative error of $10^{-7}$. I.e., in the code, relerrmax must be set to 1E-7. 2. The parameter $\Phi$ must be obtained for a “grid converged” solution. That is, you must demonstrate that should $N$ be divided by 2, the bulk velocity $u_{\rm b}$ does not vary by more than 1%.
 07.17.16
 Due on Monday December 10th at 9:00. Do all parts.
 11.28.18
 $\pi$