Skip to content

Commit

Permalink
small formatting changes & comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wandadars committed Jan 6, 2024
1 parent a93ae70 commit 4f34788
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
10 changes: 6 additions & 4 deletions src/oneD/Boundary1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down
27 changes: 16 additions & 11 deletions src/oneD/StFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<AnyMap>();
if (pc["type"] == "two-point") {
Expand All @@ -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)
Expand Down

0 comments on commit 4f34788

Please sign in to comment.