From 4f34788e2e36225cef6f081df55c42eac822defc Mon Sep 17 00:00:00 2001 From: Christopher Neal Date: Fri, 29 Sep 2023 18:14:41 -0400 Subject: [PATCH] small formatting changes & comments --- src/oneD/Boundary1D.cpp | 10 ++++++---- src/oneD/StFlow.cpp | 27 ++++++++++++++++----------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/oneD/Boundary1D.cpp b/src/oneD/Boundary1D.cpp index 50ef33e7853..7bd6760b23f 100644 --- a/src/oneD/Boundary1D.cpp +++ b/src/oneD/Boundary1D.cpp @@ -210,7 +210,7 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg, // spreading rate. The flow domain sets this to V(0), // so for finite spreading rate subtract m_V0. rb[c_offset_V] -= m_V0; - } else { + } else { //unstrained flow rb[c_offset_U] = m_flow->density(0) * xb[c_offset_U] - m_mdot; } @@ -235,10 +235,12 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg, rb[c_offset_T] -= m_flow->T_fixed(m_flow->nPoints() - 1); } - // For point control adjustments - if (m_flow->twoPointControlEnabled()) { + + if (m_flow->twoPointControlEnabled()) {// For point control adjustments + // At the right boundary, the mdot is dictated by the velocity at the + // right boundary, which comes from the Uo variable. m_mdot = -(m_flow->density(last_index) * xb[c_offset_Uo]); - rb[c_offset_U] += m_mdot; // u + rb[c_offset_U] += m_mdot; } else { rb[c_offset_U] += m_mdot; rb[c_offset_Uo] += m_mdot/m_flow->density(last_index); diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index 837156559a5..2920b6b5535 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -412,6 +412,7 @@ void StFlow::evalContinuity(double* x, double* rsd, int* diag, rsd[index(c_offset_U,jmin)] = -(rho_u(x,jmin + 1) - rho_u(x,jmin))/m_dz[jmin] -(density(jmin + 1)*V(x,jmin + 1) + density(jmin)*V(x,jmin)); + diag[index(c_offset_U,jmin)] = 0; // Algebraic constraint } @@ -435,6 +436,7 @@ void StFlow::evalContinuity(double* x, double* rsd, int* diag, // in the opposite direction. rsd[index(c_offset_U,j)] = -(rho_u(x,j+1) - rho_u(x,j))/m_dz[j] -(density(j+1)*V(x,j+1) + density(j)*V(x,j)); + diag[index(c_offset_U, j)] = 0; // Algebraic constraint } } else if (m_isFree) { // "free-flow" @@ -506,7 +508,7 @@ void StFlow::evalLambda(double* x, double* rsd, int* diag, if (jmin == 0) { // left boundary if (m_twoPointControl) { - rsd[index(c_offset_L, jmin)] = lambda(x,1) - lambda(x,0); + rsd[index(c_offset_L, jmin)] = lambda(x,jmin+1) - lambda(x,jmin); } else { rsd[index(c_offset_L, jmin)] = -rho_u(x, jmin); } @@ -586,6 +588,9 @@ void StFlow::evalUo(double* x, double* rsd, int* diag, } if (jmin == 0) { // left boundary + // Because the Uo equation is used for two-point control, the boundary + // for Uo is located in the domain interior at the right control point, + // thus at the boundary, the rsd[index(c_offset_Uo,jmin)] = Uo(x,jmin+1) - Uo(x,jmin); } @@ -867,14 +872,14 @@ AnyMap StFlow::getMeta() const state["fixed-point"]["temperature"] = m_tfixed; } - // // One and two-point control meta data - // if (m_twoPointControl) { - // state["point-control"]["type"] = "two-point"; - // state["point-control"]["left-location"] = m_zLeft; - // state["point-control"]["right-location"] = m_zRight; - // state["point-control"]["left-temperature"] = m_tLeft; - // state["point-control"]["right-temperature"] = m_tRight; - // } + // Two-point control meta data + if (m_twoPointControl) { + state["point-control"]["type"] = "two-point"; + state["point-control"]["left-location"] = m_zLeft; + state["point-control"]["right-location"] = m_zRight; + state["point-control"]["left-temperature"] = m_tLeft; + state["point-control"]["right-temperature"] = m_tRight; + } return state; } @@ -998,7 +1003,7 @@ void StFlow::setMeta(const AnyMap& state) m_tfixed = state["fixed-point"]["temperature"].asDouble(); } - /* // Two-point control meta data + // Two-point control meta data if (state.hasKey("point-control")) { const AnyMap& pc = state["point-control"].as(); if (pc["type"] == "two-point") { @@ -1008,7 +1013,7 @@ void StFlow::setMeta(const AnyMap& state) m_tLeft = pc["left-temperature"].asDouble(); m_tRight = pc["right-temperature"].asDouble(); } - } */ + } } void StFlow::solveEnergyEqn(size_t j)