Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion opm/material/components/CO2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,17 @@ class CO2 : public Component<Scalar, CO2<Scalar>>

// this is on page 1524 of the reference
Evaluation exponent = 0;
Evaluation critTemp = criticalTemperature();
Evaluation Tred = T/criticalTemperature();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critTemp is Scalar


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use critTemp here since you just copied it.

if (T > critTemp) {
OPM_THROW(std::runtime_error,
"Non-integer exponent for pow function of negative value"
" (because temperature of CO2 is larger than critical temperature.");
}

for (int i = 0; i < 4; ++i)
exponent += a[i]*pow(1 - Tred, t[i]);
exponent += a[i]*pow(1 - T/critTemp, t[i]);
exponent *= 1.0/Tred;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just use Tred here?


return exp(exponent)*criticalPressure();
Expand Down