Conversation
…on, probably an artifact of this unit test
| // and sum contributions to each component's perforation rate | ||
| for( integer ip = 0; ip < NP; ++ip ) | ||
| { | ||
| // skip the rest of the calculation if the phase is absent |
There was a problem hiding this comment.
The isothermal case does quite a bit of this calculation as well. Can we unify it somewhere perhaps?
|
|
||
| dDens[CP_Deriv::dP] = m_dResPhaseDens[er][esr][ei][0][ip][Deriv::dP]; | ||
| if constexpr ( IS_THERMAL ) | ||
| { |
There was a problem hiding this comment.
I think all these temperature derivatives are not used here and are recalculated in the thermal version.
| m_dEnergyPerfFlux[iperf][TAG::WELL][CP_Deriv::dC+jc] += phaseFlux * dProp_dC[jc]; | ||
| dMult[CP_Deriv::dC+jc] += m_wellElemPhaseVolFrac[iwelem][iphase] * m_wellElemPhaseDensity[iwelem][0][iphase] * dProp_dC[jc] | ||
| + m_wellElemPhaseEnthalpy[iwelem][0][iphase] * m_wellElemPhaseVolFrac[iwelem][iphase] * dProp_dD[jc] | ||
| + m_wellElemPhaseEnthalpy[iwelem][0][iphase] * m_wellElemPhaseDensity[iwelem][0][iphase] * m_dWellElemPhaseVolFrac[iwelem][iphase][Deriv::dC+jc]; |
There was a problem hiding this comment.
| + m_wellElemPhaseEnthalpy[iwelem][0][iphase] * m_wellElemPhaseDensity[iwelem][0][iphase] * m_dWellElemPhaseVolFrac[iwelem][iphase][Deriv::dC+jc]; | |
| + m_wellElemPhaseEnthalpy[iwelem][0][iphase] * m_wellElemPhaseDensity[iwelem][0][iphase] * dProp_dF[jc]; |
Looks to me like dProp_dF is unused.
| { | ||
| real64 dMult[CP_Deriv::nDer]{}; | ||
| real64 totalEnthalpy=0; | ||
| dMult[CP_Deriv::dP] = 0; |
There was a problem hiding this comment.
| dMult[CP_Deriv::dP] = 0; |
dMult[CP_Deriv::nDer]{}; should normally initialise to zero. Otherwise we have to initialise everything including dT and dC.
| m_wellElemPhaseEnthalpy[iwelem][0][iphase] * m_wellElemPhaseVolFrac[iwelem][iphase] * m_dWellElemPhaseDensity[iwelem][0][iphase][Deriv::dT]; | ||
| real64 dProp_dC[numComp]{}; | ||
| applyChainRule( NC, | ||
| m_dWellElemCompFrac_dCompDens[iwelem], |
There was a problem hiding this comment.
Instead of having these chain rules within the loop. Can't we calculate the dC derivative and then do the chain rule after summing over the loop. It would remove a few flops in the loop and the dProp allocations.
| discretization="fluidTPFA" | ||
| temperature="368.15" | ||
| useMass="1" | ||
| useMass="0" |
There was a problem hiding this comment.
I'm guessing the removal of thermal here is for debugging?
Fix to thermal well inflow derivatives.