Skip to content

CO2Store triggers taking square root of a negative value for high temperatures (>304 K) #4512

@blattms

Description

@blattms

This is the case for all activity models in ACTCO2S. In my case I experienced NANS in the well iterations. No warning or exceptions before this. Higher temperatures are clear due to the RTEMPV table.

If value 3 (non-iterated Duan-Sun according to Spycher and Pruess) is used we will end up in Brine_CO2.hpp#L129. For temperatures higher than 304K we will try to compute the power 1.5 on a negative value in CO2.hpp#L148, which has at least undefined behavior, see documentation of std::pow

The floating point exception occurs when we try

(gdb) 
#7  0x0000564814fdab70 in Opm::MathToolbox<double>::pow (base=-0.057369892561418778, exp=1.5) at 
  opm-common/opm/material/common/MathToolbox.hpp:271
271	    { return std::pow(base, exp); }

because the temperature is higher than the critical on in (1-T/critT).

The same holds for 2, because code only starts to iterate if temperature is over 372.15K, see Brine_CO2.hpp#L115. Unfortunately, we still end up in CO2.hpp#148 later.

Finally, value 1 does not work, because Brine_CO2.hpp#L579 actively prevents the fixed point iteration.

Is this intentional? Maybe @daavid00 knows?

We should probably do proper error/exception handling for this case. Is there any reason to not use the fixed point iterations for values 1 and 2?

@gdfldm There should probably be a prominent warning and a known issue in the manual.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions