Skip to content

Commit

Permalink
refactor to expose y and u
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Apr 12, 2022
1 parent 3a328c8 commit ebd9270
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/ref_phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,13 @@ REF_STATUS ref_phys_spalding_uplus(REF_DBL yplus, REF_DBL *uplus) {
}

REF_STATUS ref_phys_yplus_dist(REF_DBL mach, REF_DBL re, REF_DBL reference_t_k,
REF_DBL rho, REF_DBL t, REF_DBL dudn,
REF_DBL rho, REF_DBL t, REF_DBL y, REF_DBL u,
REF_DBL *yplus_dist) {
REF_DBL mu, nu, tau_wall, u_tau;
REF_DBL dudn;
*yplus_dist = -1.0;
RSS(viscosity_law(t, reference_t_k, &mu), "sutherlands");
dudn = u / y;
tau_wall = mu * dudn * mach / re;
u_tau = sqrt(tau_wall / rho);
nu = mu / rho;
Expand Down Expand Up @@ -760,7 +762,7 @@ REF_STATUS ref_phys_yplus_lengthscale(REF_GRID ref_grid, REF_DBL mach,
REF_INT tri_nodes[REF_CELL_MAX_SIZE_PER];
REF_INT ntri, tri_list[2];
REF_INT off_node, on_node;
REF_DBL dn, du, u0, u1, dxyz[3], edg_norm[3], dudn, tangent[3];
REF_DBL dn, du, u0, u1, dxyz[3], edg_norm[3], tangent[3];
REF_DBL rho, t, yplus_dist;
REF_DBL gamma = 1.4, press;
each_ref_cell_valid_cell_with_nodes(edg_cell, edg, edg_nodes) {
Expand Down Expand Up @@ -792,12 +794,11 @@ REF_STATUS ref_phys_yplus_lengthscale(REF_GRID ref_grid, REF_DBL mach,
dxyz[2] = ref_node_xyz(ref_node, 2, off_node) -
ref_node_xyz(ref_node, 2, on_node);
du = ABS(u0 - u1);
dn = ref_math_dot(dxyz, edg_norm);
dudn = ABS(du / dn);
dn = ABS(ref_math_dot(dxyz, edg_norm));
rho = field[0 + ldim * on_node];
press = field[4 + ldim * on_node];
t = gamma * (press / rho);
RSS(ref_phys_yplus_dist(mach, re, reference_t_k, rho, t, dudn,
RSS(ref_phys_yplus_dist(mach, re, reference_t_k, rho, t, dn, du,
&yplus_dist),
"yplus dist");
lengthscale[edg_nodes[0]] += yplus_dist;
Expand Down
2 changes: 1 addition & 1 deletion src/ref_phys.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ REF_STATUS ref_phys_spalding_dyplus_duplus(REF_DBL uplus,
REF_STATUS ref_phys_spalding_uplus(REF_DBL yplus, REF_DBL *uplus);

REF_STATUS ref_phys_yplus_dist(REF_DBL mach, REF_DBL re, REF_DBL reference_t_k,
REF_DBL rho, REF_DBL t, REF_DBL dudn,
REF_DBL rho, REF_DBL t, REF_DBL y, REF_DBL u,
REF_DBL *yplus_dist);
REF_STATUS ref_phys_u_tau(REF_DBL y, REF_DBL u, REF_DBL nu_mach_re,
REF_DBL *u_tau);
Expand Down
5 changes: 3 additions & 2 deletions src/ref_phys_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,12 +1932,13 @@ int main(int argc, char *argv[]) {
{ /* yplus normal derivative */
REF_DBL t = 1.0;
REF_DBL rho = 1.0;
REF_DBL dudn = 1000.0;
REF_DBL y = 1.0e-4;
REF_DBL u = 0.1;
REF_DBL mach = 0.2;
REF_DBL re = 1.0e6;
REF_DBL reference_t_k = 288.15;
REF_DBL yplus_dist;
RSS(ref_phys_yplus_dist(mach, re, reference_t_k, rho, t, dudn, &yplus_dist),
RSS(ref_phys_yplus_dist(mach, re, reference_t_k, rho, t, y, u, &yplus_dist),
"yplus distance");
RWDS(1.414213562373095e-05, yplus_dist, -1, "uplus");
}
Expand Down

0 comments on commit ebd9270

Please sign in to comment.