opm-simulators icon indicating copy to clipboard operation
opm-simulators copied to clipboard

Simulation Errors

Open loveduah1 opened this issue 2 years ago • 3 comments

          thanks for the reporting, the following is some of my investigation. 

At the first time step,

the well PROD enters the following code in BlackoilWellModel_impl.hpp

        if (alternative_well_rate_init_) {
            // Update the well rates of well_state_, if only single-phase rates, to
            // have proper multi-phase rates proportional to rates at bhp zero.
            // This is done only for producers, as injectors will only have a single
            // nonzero phase anyway.
            for (auto& well : well_container_) {
                if (well->isProducer()) {
                    well->updateWellStateRates(ebosSimulator_, this->wellState(), local_deferredLogger);
                }
            }

It enters the function updateWellStateRates.

In the function updateWellStateRates, the initial well rates in the well state is [0] = {double} 0 [1] = {double} -0.022081568740000002 [2] = {double} 0

With code

 std::vector<double> well_q_s = computeCurrentWellRates(ebosSimulator, deferred_logger);

well_q_s is [0] = {double} 0 [1] = {double} -0.71818269344579422 [2] = {double} 0

then the following code is used to scale the well rates

        const double initial_nonzero_rate = ws.surface_rates[nonzero_rate_index];
        const int comp_idx_nz = this->flowPhaseToEbosCompIdx(nonzero_rate_index);
        for (int p = 0; p < this->number_of_phases_; ++p) {
            if (p != nonzero_rate_index) {
                const int comp_idx = this->flowPhaseToEbosCompIdx(p);
                double& rate = ws.surface_rates[p];
                rate = (initial_nonzero_rate/well_q_s[comp_idx_nz]) * (well_q_s[comp_idx]);
            }
        }

For this case, nonzero_rate_index is 1, comp_idx_nz is 0. then you will see you will get a inf and nan during the scaling for the surface_rates of the well. [0] = {double} inf [1] = {double} -0.022081568740000002 [2] = {double} -nan(0x8000000000000)

we should not scale the well rates when well_q_s[comp_idx_nz] == 0.

my best guess is that you are trying to produce oil in a region there is no oil at all? but it is just a guess.

Originally posted by @GitPaean in https://github.com/OPM/opm-simulators/issues/4649#issuecomment-1599500271

Please could you point me in a particular direction as to why there might be no oil in the model? I am faced with the challenge of initiating an investigation, as the model serves as the base file for numerous episodes of an AI simulation. In each episode, the agent duplicates the base file and subsequently determines the course of action to undertake (i.e. inject water or gas) after permeability and porosity has been determined geostatistically. It is crucial to mention these details since the model operated successfully for more than 800 episodes before encountering the error reported yesterday. Unfortunately, due to the practice of overwriting output files to maintain tidiness, all historical data from the simulation has been erased.

loveduah1 avatar Jun 21 '23 13:06 loveduah1

No, please, the attached is the case I am referring to. START.txt

loveduah1 avatar Jun 21 '23 14:06 loveduah1

Ah ok, thank you. I see you have only one layer reservoir (11x11x1) with top at 8325 (TOPS) and bottom 8625 (DZ = 300). You set the water-oil contact in EQUIL inside this layer, at 8450. Do you want the reservoir to have water and oil zones? If yes, have you tried to discretize your model in the z-direction? If you don't want to have both zones, you could skip the EQUIL keyword and set the initial and gas saturation explicitly...

goncalvesmachadoc avatar Jun 21 '23 14:06 goncalvesmachadoc

@goncalvesmachadoc Thank you. I am on it

loveduah1 avatar Jun 21 '23 14:06 loveduah1