From f0b01153af3a01a9c66c18412b5c017396d8150f Mon Sep 17 00:00:00 2001 From: James Wright Date: Tue, 2 Apr 2024 13:28:54 -0600 Subject: [PATCH] refactor(fluids): Make QF comments consistent See discussion: https://github.com/CEED/libCEED/pull/1539#discussion_r1548312418 --- examples/fluids/qfunctions/bc_freestream.h | 16 ++---- examples/fluids/qfunctions/channel.h | 10 +--- examples/fluids/qfunctions/densitycurrent.h | 11 +--- examples/fluids/qfunctions/eulervortex.h | 56 +++++-------------- examples/fluids/qfunctions/mass.h | 5 +- examples/fluids/qfunctions/newtonian.h | 53 +++++------------- examples/fluids/qfunctions/shocktube.h | 30 +++------- examples/fluids/qfunctions/stg_shur14.h | 20 ++----- .../qfunctions/strong_boundary_conditions.h | 9 +-- 9 files changed, 54 insertions(+), 156 deletions(-) diff --git a/examples/fluids/qfunctions/bc_freestream.h b/examples/fluids/qfunctions/bc_freestream.h index 431298e822..5fb4da2289 100644 --- a/examples/fluids/qfunctions/bc_freestream.h +++ b/examples/fluids/qfunctions/bc_freestream.h @@ -220,20 +220,16 @@ CEED_QFUNCTION(RiemannOutflow_Prim)(void *ctx, CeedInt Q, const CeedScalar *cons // ***************************************************************************** CEED_QFUNCTION_HELPER int RiemannOutflow_Jacobian(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, StateVariable state_var) { - // Inputs const CeedScalar(*dq)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*Grad_dq) = in[1]; const CeedScalar(*q_data_sur) = in[2]; const CeedScalar(*jac_data_sur) = in[4]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; const OutflowContext outflow = (OutflowContext)ctx; const NewtonianIdealGasContext gas = &outflow->gas; const bool is_implicit = gas->is_implicit; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar wdetJb, dXdx[2][3], norm[3]; QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, dXdx, norm); @@ -279,7 +275,7 @@ CEED_QFUNCTION_HELPER int RiemannOutflow_Jacobian(void *ctx, CeedInt Q, const Ce FluxTotal_RiemannBoundary(dF_inviscid_normal, dstress, dFe, norm, dFlux); for (int j = 0; j < 5; j++) v[j][i] = -wdetJb * dFlux[j]; - } // End Quadrature Point Loop + } return 0; } @@ -357,20 +353,16 @@ CEED_QFUNCTION(PressureOutflow_Prim)(void *ctx, CeedInt Q, const CeedScalar *con // ***************************************************************************** CEED_QFUNCTION_HELPER int PressureOutflow_Jacobian(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, StateVariable state_var) { - // Inputs const CeedScalar(*dq)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*Grad_dq) = in[1]; const CeedScalar(*q_data_sur) = in[2]; const CeedScalar(*jac_data_sur) = in[4]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; const OutflowContext outflow = (OutflowContext)ctx; const NewtonianIdealGasContext gas = &outflow->gas; const bool is_implicit = gas->is_implicit; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar wdetJb, dXdx[2][3], norm[3]; QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, dXdx, norm); @@ -403,7 +395,7 @@ CEED_QFUNCTION_HELPER int PressureOutflow_Jacobian(void *ctx, CeedInt Q, const C FluxTotal_Boundary(dF_inviscid, dstress, dFe, norm, dFlux); for (int j = 0; j < 5; j++) v[j][i] = -wdetJb * dFlux[j]; - } // End Quadrature Point Loop + } return 0; } diff --git a/examples/fluids/qfunctions/channel.h b/examples/fluids/qfunctions/channel.h index 674bbc7082..7634696c74 100644 --- a/examples/fluids/qfunctions/channel.h +++ b/examples/fluids/qfunctions/channel.h @@ -61,16 +61,11 @@ CEED_QFUNCTION_HELPER State Exact_Channel(CeedInt dim, CeedScalar time, const Ce // This QFunction set the initial condition // ***************************************************************************** CEED_QFUNCTION(ICsChannel)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Outputs - CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - - // Context const ChannelContext context = (ChannelContext)ctx; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { const CeedScalar x[] = {X[0][i], X[1][i], X[2][i]}; State s = Exact_Channel(3, 0., x, 5, ctx); @@ -85,8 +80,7 @@ CEED_QFUNCTION(ICsChannel)(void *ctx, CeedInt Q, const CeedScalar *const *in, Ce } for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; - - } // End of Quadrature Point Loop + } return 0; } diff --git a/examples/fluids/qfunctions/densitycurrent.h b/examples/fluids/qfunctions/densitycurrent.h index df6ef0208c..4d10261b4f 100644 --- a/examples/fluids/qfunctions/densitycurrent.h +++ b/examples/fluids/qfunctions/densitycurrent.h @@ -130,16 +130,11 @@ CEED_QFUNCTION_HELPER State Exact_DC(CeedInt dim, CeedScalar time, const CeedSca // This QFunction sets the initial conditions for density current // ***************************************************************************** CEED_QFUNCTION(ICsDC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Outputs - CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - - // Context const DensityCurrentContext context = (DensityCurrentContext)ctx; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { const CeedScalar x[] = {X[0][i], X[1][i], X[2][i]}; State s = Exact_DC(3, 0., x, 5, ctx); @@ -154,8 +149,6 @@ CEED_QFUNCTION(ICsDC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedSca } for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; - - } // End of Quadrature Point Loop - + } return 0; } diff --git a/examples/fluids/qfunctions/eulervortex.h b/examples/fluids/qfunctions/eulervortex.h index d1a4d4a5f5..308cb50cea 100644 --- a/examples/fluids/qfunctions/eulervortex.h +++ b/examples/fluids/qfunctions/eulervortex.h @@ -170,7 +170,6 @@ CEED_QFUNCTION_HELPER int Exact_Euler(CeedInt dim, CeedScalar time, const CeedSc q[4] = rho * (cv * T + (u[0] * u[0] + u[1] * u[1]) / 2.); break; } - // Return return 0; } @@ -225,24 +224,18 @@ CEED_QFUNCTION_HELPER void Tau_spatial(CeedScalar Tau_x[3], const CeedScalar dXd // This QFunction sets the initial conditions for Euler traveling vortex // ***************************************************************************** CEED_QFUNCTION(ICsEuler)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Outputs - CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - const EulerContext context = (EulerContext)ctx; + const EulerContext context = (EulerContext)ctx; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { const CeedScalar x[] = {X[0][i], X[1][i], X[2][i]}; CeedScalar q[5] = {0.}; Exact_Euler(3, context->curr_time, x, 5, q, ctx); - for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; - } // End of Quadrature Point Loop - - // Return + } return 0; } @@ -271,20 +264,16 @@ CEED_QFUNCTION(ICsEuler)(void *ctx, CeedInt Q, const CeedScalar *const *in, Ceed // gamma = cp / cv, Specific heat ratio // ***************************************************************************** CEED_QFUNCTION(Euler)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*dq)[5][CEED_Q_VLA] = (const CeedScalar(*)[5][CEED_Q_VLA])in[1]; const CeedScalar(*q_data) = in[2]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; EulerContext context = (EulerContext)ctx; const CeedScalar c_tau = context->c_tau; const CeedScalar gamma = 1.4; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { // Setup // -- Interp in @@ -387,10 +376,7 @@ CEED_QFUNCTION(Euler)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedSca case 2: // SUPG is not implemented for explicit scheme break; } - - } // End Quadrature Point Loop - - // Return + } return 0; } @@ -398,23 +384,19 @@ CEED_QFUNCTION(Euler)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedSca // This QFunction implements the Euler equations with (mentioned above) with implicit time stepping method // ***************************************************************************** CEED_QFUNCTION(IFunction_Euler)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*dq)[5][CEED_Q_VLA] = (const CeedScalar(*)[5][CEED_Q_VLA])in[1]; const CeedScalar(*q_dot)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2]; const CeedScalar(*q_data) = in[3]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; - CeedScalar *jac_data = out[2]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; + CeedScalar *jac_data = out[2]; EulerContext context = (EulerContext)ctx; const CeedScalar c_tau = context->c_tau; const CeedScalar gamma = 1.4; const CeedScalar zeros[14] = {0.}; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { // Setup // -- Interp in @@ -532,9 +514,7 @@ CEED_QFUNCTION(IFunction_Euler)(void *ctx, CeedInt Q, const CeedScalar *const *i break; } StoredValuesPack(Q, i, 0, 14, zeros, jac_data); - } // End Quadrature Point Loop - - // Return + } return 0; } // ***************************************************************************** @@ -543,10 +523,9 @@ CEED_QFUNCTION(IFunction_Euler)(void *ctx, CeedInt Q, const CeedScalar *const *i // Prescribed T_inlet and P_inlet are converted to conservative variables and applied weakly. // ***************************************************************************** CEED_QFUNCTION(TravelingVortex_Inflow)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*q_data_sur) = in[2]; - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + EulerContext context = (EulerContext)ctx; const int euler_test = context->euler_test; const bool is_implicit = context->implicit; @@ -565,7 +544,6 @@ CEED_QFUNCTION(TravelingVortex_Inflow)(void *ctx, CeedInt Q, const CeedScalar *c if (euler_test == 1 || euler_test == 2) T_inlet = P_inlet = .4; else T_inlet = P_inlet = 1.; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar wdetJb, norm[3]; QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); @@ -595,8 +573,7 @@ CEED_QFUNCTION(TravelingVortex_Inflow)(void *ctx, CeedInt Q, const CeedScalar *c // -- Total Energy Density v[4][i] -= wdetJb * face_normal * (E_inlet + P_inlet); } - - } // End Quadrature Point Loop + } return 0; } @@ -607,19 +584,16 @@ CEED_QFUNCTION(TravelingVortex_Inflow)(void *ctx, CeedInt Q, const CeedScalar *c // The validity of the weak form of the governing equations is extended to the outflow. // ***************************************************************************** CEED_QFUNCTION(Euler_Outflow)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*q_data_sur) = in[2]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; EulerContext context = (EulerContext)ctx; const bool is_implicit = context->implicit; CeedScalar *mean_velocity = context->mean_velocity; const CeedScalar gamma = 1.4; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { // Setup // -- Interp in @@ -652,6 +626,6 @@ CEED_QFUNCTION(Euler_Outflow)(void *ctx, CeedInt Q, const CeedScalar *const *in, // -- Total Energy Density v[4][i] -= wdetJb * u_normal * (E + P); } - } // End Quadrature Point Loop + } return 0; } diff --git a/examples/fluids/qfunctions/mass.h b/examples/fluids/qfunctions/mass.h index 36522cdeef..1147a2bb31 100644 --- a/examples/fluids/qfunctions/mass.h +++ b/examples/fluids/qfunctions/mass.h @@ -22,12 +22,9 @@ // // ***************************************************************************** CEED_QFUNCTION_HELPER int Mass_N(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, const CeedInt N) { - // Inputs const CeedScalar(*u)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*q_data) = in[1]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedPragmaSIMD for (CeedInt j = 0; j < N; j++) { v[j][i] = q_data[i] * u[j][i]; } diff --git a/examples/fluids/qfunctions/newtonian.h b/examples/fluids/qfunctions/newtonian.h index b10857ee3e..a17385110b 100644 --- a/examples/fluids/qfunctions/newtonian.h +++ b/examples/fluids/qfunctions/newtonian.h @@ -30,21 +30,16 @@ CEED_QFUNCTION_HELPER void InternalDampingLayer(const NewtonianIdealGasContext c // This QFunction sets a "still" initial condition for generic Newtonian IG problems // ***************************************************************************** CEED_QFUNCTION_HELPER int ICsNewtonianIG(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, StateVariable state_var) { - // Inputs - - // Outputs CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Context const SetupContext context = (SetupContext)ctx; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar q[5] = {0.}; State s = StateFromPrimitive(&context->gas, context->reference); StateToQ(&context->gas, s, q, state_var); for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; - } // End of Quadrature Point Loop + } return 0; } @@ -101,21 +96,16 @@ CEED_QFUNCTION(ICsNewtonianIG_Conserv)(void *ctx, CeedInt Q, const CeedScalar *c // gradu ) // ***************************************************************************** CEED_QFUNCTION(RHSFunction_Newtonian)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs - const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; - const CeedScalar(*Grad_q) = in[1]; - const CeedScalar(*q_data) = in[2]; - - // Outputs + const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + const CeedScalar(*Grad_q) = in[1]; + const CeedScalar(*q_data) = in[2]; CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; CeedScalar(*Grad_v)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; - // Context NewtonianIdealGasContext context = (NewtonianIdealGasContext)ctx; const CeedScalar *g = context->g; const CeedScalar dt = context->dt; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar U[5], wdetJ, dXdx[3][3]; for (int j = 0; j < 5; j++) U[j] = q[j][i]; @@ -154,9 +144,7 @@ CEED_QFUNCTION(RHSFunction_Newtonian)(void *ctx, CeedInt Q, const CeedScalar *co for (CeedInt j = 0; j < 5; j++) { for (CeedInt k = 0; k < 3; k++) Grad_v[k][j][i] -= wdetJ * (stab[j][0] * dXdx[k][0] + stab[j][1] * dXdx[k][1] + stab[j][2] * dXdx[k][2]); } - } // End Quadrature Point Loop - - // Return + } return 0; } @@ -168,25 +156,20 @@ CEED_QFUNCTION(RHSFunction_Newtonian)(void *ctx, CeedInt Q, const CeedScalar *co // (diffusive terms will be added later) // ***************************************************************************** CEED_QFUNCTION_HELPER int IFunction_Newtonian(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, StateVariable state_var) { - // Inputs const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*Grad_q) = in[1]; const CeedScalar(*q_dot)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2]; const CeedScalar(*q_data) = in[3]; const CeedScalar(*x)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[4]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*Grad_v)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; + CeedScalar(*jac_data) = out[2]; - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - CeedScalar(*Grad_v)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; - CeedScalar(*jac_data) = out[2]; - - // Context NewtonianIdealGasContext context = (NewtonianIdealGasContext)ctx; const CeedScalar *g = context->g; const CeedScalar dt = context->dt; const CeedScalar P0 = context->P0; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { const CeedScalar qi[5] = {q[0][i], q[1][i], q[2][i], q[3][i], q[4][i]}; const CeedScalar x_i[3] = {x[0][i], x[1][i], x[2][i]}; @@ -244,10 +227,7 @@ CEED_QFUNCTION_HELPER int IFunction_Newtonian(void *ctx, CeedInt Q, const CeedSc StoredValuesPack(Q, i, 0, 5, qi, jac_data); StoredValuesPack(Q, i, 5, 6, kmstress, jac_data); StoredValuesPack(Q, i, 11, 3, Tau_d, jac_data); - - } // End Quadrature Point Loop - - // Return + } return 0; } @@ -263,21 +243,16 @@ CEED_QFUNCTION(IFunction_Newtonian_Prim)(void *ctx, CeedInt Q, const CeedScalar // This QFunction implements the jacobian of the Navier-Stokes equations for implicit time stepping method. // ***************************************************************************** CEED_QFUNCTION_HELPER int IJacobian_Newtonian(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out, StateVariable state_var) { - // Inputs - const CeedScalar(*dq)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; - const CeedScalar(*Grad_dq) = in[1]; - const CeedScalar(*q_data) = in[2]; - const CeedScalar(*jac_data) = in[3]; - - // Outputs + const CeedScalar(*dq)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + const CeedScalar(*Grad_dq) = in[1]; + const CeedScalar(*q_data) = in[2]; + const CeedScalar(*jac_data) = in[3]; CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; CeedScalar(*Grad_v)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; - // Context NewtonianIdealGasContext context = (NewtonianIdealGasContext)ctx; const CeedScalar *g = context->g; - // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { CeedScalar wdetJ, dXdx[3][3]; QdataUnpack_3D(Q, i, q_data, &wdetJ, dXdx); @@ -334,7 +309,7 @@ CEED_QFUNCTION_HELPER int IJacobian_Newtonian(void *ctx, CeedInt Q, const CeedSc for (int j = 0; j < 5; j++) { for (int k = 0; k < 3; k++) Grad_v[k][j][i] += wdetJ * (dstab[j][0] * dXdx[k][0] + dstab[j][1] * dXdx[k][1] + dstab[j][2] * dXdx[k][2]); } - } // End Quadrature Point Loop + } return 0; } diff --git a/examples/fluids/qfunctions/shocktube.h b/examples/fluids/qfunctions/shocktube.h index 6e2de6a917..87cdf73d4d 100644 --- a/examples/fluids/qfunctions/shocktube.h +++ b/examples/fluids/qfunctions/shocktube.h @@ -102,7 +102,6 @@ CEED_QFUNCTION_HELPER CeedInt Exact_ShockTube(CeedInt dim, CeedScalar time, cons q[3] = rho * u[2]; q[4] = P / (gamma - 1.0) + rho * (u[0] * u[0]) / 2.; - // Return return 0; } @@ -178,24 +177,17 @@ CEED_QFUNCTION_HELPER void Tau_spatial(CeedScalar Tau_x[3], const CeedScalar dXd // This QFunction sets the initial conditions for shock tube // ***************************************************************************** CEED_QFUNCTION(ICsShockTube)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; + CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - // Outputs - CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - - CeedPragmaSIMD - // Quadrature Point Loop - for (CeedInt i = 0; i < Q; i++) { + CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { const CeedScalar x[] = {X[0][i], X[1][i], X[2][i]}; CeedScalar q[5]; Exact_ShockTube(3, 0., x, 5, q, ctx); for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; - } // End of Quadrature Point Loop - - // Return + } return 0; } @@ -224,14 +216,11 @@ CEED_QFUNCTION(ICsShockTube)(void *ctx, CeedInt Q, const CeedScalar *const *in, // gamma = cp / cv, Specific heat ratio // ***************************************************************************** CEED_QFUNCTION(EulerShockTube)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*q)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*dq)[5][CEED_Q_VLA] = (const CeedScalar(*)[5][CEED_Q_VLA])in[1]; const CeedScalar(*q_data) = in[2]; - - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*dv)[5][CEED_Q_VLA] = (CeedScalar(*)[5][CEED_Q_VLA])out[1]; const CeedScalar gamma = 1.4; @@ -240,9 +229,7 @@ CEED_QFUNCTION(EulerShockTube)(void *ctx, CeedInt Q, const CeedScalar *const *in const CeedScalar Byzb = context->Byzb; const CeedScalar c_tau = context->c_tau; - CeedPragmaSIMD - // Quadrature Point Loop - for (CeedInt i = 0; i < Q; i++) { + CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { // Setup // -- Interp in const CeedScalar rho = q[0][i]; @@ -377,9 +364,6 @@ CEED_QFUNCTION(EulerShockTube)(void *ctx, CeedInt Q, const CeedScalar *const *in } break; } - - } // End Quadrature Point Loop - - // Return + } return 0; } diff --git a/examples/fluids/qfunctions/stg_shur14.h b/examples/fluids/qfunctions/stg_shur14.h index c96996cae7..d6c7464660 100644 --- a/examples/fluids/qfunctions/stg_shur14.h +++ b/examples/fluids/qfunctions/stg_shur14.h @@ -275,12 +275,9 @@ CEED_QFUNCTION(StgShur14Preprocess)(void *ctx, CeedInt Q, const CeedScalar *cons // Extrude the STGInflow profile through out the domain for an initial condition CEED_QFUNCTION(ICsStg)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*x)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*J)[3][CEED_Q_VLA] = (const CeedScalar(*)[3][CEED_Q_VLA])in[1]; - - // Outputs - CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; const StgShur14Context stg_ctx = (StgShur14Context)ctx; CeedScalar qn[STG_NMODES_MAX], u[3], ubar[3], cij[6], eps, lt; @@ -325,7 +322,7 @@ CEED_QFUNCTION(ICsStg)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedSc q0[4][i] = theta0; break; } - } // End of Quadrature Point Loop + } return 0; } @@ -415,12 +412,10 @@ CEED_QFUNCTION(StgShur14Inflow)(void *ctx, CeedInt Q, const CeedScalar *const *i } CEED_QFUNCTION(StgShur14Inflow_Jacobian)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*dq)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*q_data_sur)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2]; const CeedScalar(*jac_data_sur)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[4]; - // Outputs - CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; const StgShur14Context stg_ctx = (StgShur14Context)ctx; const bool implicit = stg_ctx->is_implicit; @@ -431,9 +426,7 @@ CEED_QFUNCTION(StgShur14Inflow_Jacobian)(void *ctx, CeedInt Q, const CeedScalar const CeedScalar theta0 = stg_ctx->theta0; const bool prescribe_T = stg_ctx->prescribe_T; - CeedPragmaSIMD - // Quadrature Point Loop - for (CeedInt i = 0; i < Q; i++) { + CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { // Setup // -- Interp-to-Interp q_data // For explicit mode, the surface integral is on the RHS of ODE q_dot = f(q). @@ -467,7 +460,7 @@ CEED_QFUNCTION(StgShur14Inflow_Jacobian)(void *ctx, CeedInt Q, const CeedScalar v[0][i] = -wdetJb * drho * u_normal; for (int j = 0; j < 3; j++) v[j + 1][i] = -wdetJb * (drho * u_normal * velocity[j] + norm[j] * dP); v[4][i] = -wdetJb * u_normal * (dE + dP); - } // End Quadrature Point Loop + } return 0; } @@ -482,8 +475,7 @@ CEED_QFUNCTION(StgShur14InflowStrongQF)(void *ctx, CeedInt Q, const CeedScalar * const CeedScalar(*coords)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1]; const CeedScalar(*scale) = (const CeedScalar(*))in[2]; const CeedScalar(*inv_Ektotal) = (const CeedScalar(*))in[3]; - - CeedScalar(*bcval)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*bcval)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; const StgShur14Context stg_ctx = (StgShur14Context)ctx; CeedScalar u[3], ubar[3], cij[6], eps, lt; diff --git a/examples/fluids/qfunctions/strong_boundary_conditions.h b/examples/fluids/qfunctions/strong_boundary_conditions.h index 66a8c754c3..a503a236d9 100644 --- a/examples/fluids/qfunctions/strong_boundary_conditions.h +++ b/examples/fluids/qfunctions/strong_boundary_conditions.h @@ -9,15 +9,12 @@ #include "setupgeo_helpers.h" CEED_QFUNCTION(SetupStrongBC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { - // Inputs const CeedScalar(*coords)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; const CeedScalar(*dxdX_q)[3][CEED_Q_VLA] = (const CeedScalar(*)[3][CEED_Q_VLA])in[1]; const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2]; - - // Outputs - CeedScalar(*coords_stored)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; - CeedScalar(*scale_stored) = out[1]; - CeedScalar(*dXdx_q)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[2]; + CeedScalar(*coords_stored)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; + CeedScalar(*scale_stored) = out[1]; + CeedScalar(*dXdx_q)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[2]; CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { for (int j = 0; j < 3; j++) coords_stored[j][i] = coords[j][i];