Cleaned up and removed unused code.
This commit is contained in:
@@ -1,77 +1,12 @@
|
|||||||
/* Copyright 2011 (c) Jostein R. Natvig <Jostein.R.Natvig at sintef.no> */
|
/* Copyright 2011 (c) Jostein R. Natvig <Jostein.R.Natvig at sintef.no> */
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <opm/core/grid.h>
|
|
||||||
#include <opm/core/transport/reorder/reordersequence.h>
|
|
||||||
#include <opm/core/transport/reorder/tarjan.h>
|
|
||||||
#include <opm/core/transport/reorder/nlsolvers.h>
|
|
||||||
#include <opm/core/transport/reorder/twophase.hpp>
|
|
||||||
#include <opm/core/transport/reorder/twophasetransport.hpp>
|
#include <opm/core/transport/reorder/twophasetransport.hpp>
|
||||||
|
#include <opm/core/transport/reorder/reordersequence.h>
|
||||||
#include <opm/core/transport/reorder/TransportModelTwophase.hpp>
|
#include <opm/core/transport/reorder/TransportModelTwophase.hpp>
|
||||||
|
#include <opm/core/grid.h>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
void twophasetransport(
|
|
||||||
const double *porevolume,
|
|
||||||
const double *source,
|
|
||||||
double dt,
|
|
||||||
struct UnstructuredGrid *grid,
|
|
||||||
const Opm::IncompPropertiesInterface* props,
|
|
||||||
const double *darcyflux,
|
|
||||||
double *saturation)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
int ncomponents;
|
|
||||||
int *sequence;
|
|
||||||
int *components;
|
|
||||||
|
|
||||||
struct SolverData *data = init_solverdata(grid, props, darcyflux,
|
|
||||||
porevolume, source, dt, saturation);
|
|
||||||
|
|
||||||
|
|
||||||
struct NonlinearSolverCtrl ctrl;
|
|
||||||
|
|
||||||
|
|
||||||
/* Compute sequence of single-cell problems */
|
|
||||||
sequence = (int*) malloc( grid->number_of_cells * sizeof *sequence);
|
|
||||||
components = (int*) malloc(( grid->number_of_cells+1) * sizeof *components);
|
|
||||||
|
|
||||||
compute_sequence(grid, darcyflux, sequence, components, &ncomponents);
|
|
||||||
assert(ncomponents == grid->number_of_cells);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctrl.maxiterations = 20;
|
|
||||||
ctrl.nltolerance = 1e-9;
|
|
||||||
ctrl.method = NonlinearSolverCtrl::REGULAFALSI;
|
|
||||||
ctrl.initialguess = 0.5;
|
|
||||||
ctrl.min_bracket = 0.0;
|
|
||||||
ctrl.max_bracket = 1.0;
|
|
||||||
|
|
||||||
/* Assume all strong components are single-cell domains. */
|
|
||||||
for(i=0; i<grid->number_of_cells; ++i)
|
|
||||||
{
|
|
||||||
#ifdef MATLAB_MEX_FILE
|
|
||||||
if (interrupt_signal)
|
|
||||||
{
|
|
||||||
mexPrintf("Reorder loop interrupted by user: %d of %d "
|
|
||||||
"cells finished.\n", i, grid->number_of_cells);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
solvecell(data, &ctrl, sequence[i]);
|
|
||||||
/*print("iterations:%d residual:%20.16f\n",
|
|
||||||
* ctrl.iterations, ctrl.residual);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy_solverdata(data);
|
|
||||||
|
|
||||||
free(sequence);
|
|
||||||
free(components);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Opm::reorderTransportTwophase(const double *porevolume,
|
void Opm::reorderTransportTwophase(const double *porevolume,
|
||||||
@@ -82,6 +17,7 @@ void Opm::reorderTransportTwophase(const double *porevolume,
|
|||||||
const double *darcyflux,
|
const double *darcyflux,
|
||||||
double *saturation)
|
double *saturation)
|
||||||
{
|
{
|
||||||
|
// Set up transport model.
|
||||||
TransportModelTwophase tmodel(grid, props, darcyflux,
|
TransportModelTwophase tmodel(grid, props, darcyflux,
|
||||||
porevolume, source, dt, saturation);
|
porevolume, source, dt, saturation);
|
||||||
|
|
||||||
@@ -90,23 +26,18 @@ void Opm::reorderTransportTwophase(const double *porevolume,
|
|||||||
std::vector<int> components(grid->number_of_cells + 1);
|
std::vector<int> components(grid->number_of_cells + 1);
|
||||||
int ncomponents;
|
int ncomponents;
|
||||||
compute_sequence(grid, darcyflux, &sequence[0], &components[0], &ncomponents);
|
compute_sequence(grid, darcyflux, &sequence[0], &components[0], &ncomponents);
|
||||||
assert(ncomponents == grid->number_of_cells);
|
|
||||||
|
|
||||||
|
|
||||||
// Assume all strong components are single-cell domains.
|
// Assume all strong components are single-cell domains.
|
||||||
for (int i = 0; i < grid->number_of_cells; ++i)
|
assert(ncomponents == grid->number_of_cells);
|
||||||
{
|
for (int i = 0; i < grid->number_of_cells; ++i) {
|
||||||
#ifdef MATLAB_MEX_FILE
|
#ifdef MATLAB_MEX_FILE
|
||||||
if (interrupt_signal)
|
if (interrupt_signal) {
|
||||||
{
|
|
||||||
mexPrintf("Reorder loop interrupted by user: %d of %d "
|
mexPrintf("Reorder loop interrupted by user: %d of %d "
|
||||||
"cells finished.\n", i, grid->number_of_cells);
|
"cells finished.\n", i, grid->number_of_cells);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tmodel.solveSingleCell(sequence[i]);
|
tmodel.solveSingleCell(sequence[i]);
|
||||||
// print("iterations:%d residual:%20.16f\n",
|
|
||||||
// ctrl.iterations, ctrl.residual);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,25 +3,14 @@
|
|||||||
#ifndef TWOPHASETRANSPORT_HPP_INCLUDED
|
#ifndef TWOPHASETRANSPORT_HPP_INCLUDED
|
||||||
#define TWOPHASETRANSPORT_HPP_INCLUDED
|
#define TWOPHASETRANSPORT_HPP_INCLUDED
|
||||||
|
|
||||||
namespace Opm
|
|
||||||
{
|
|
||||||
class IncompPropertiesInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
|
|
||||||
void twophasetransport(
|
|
||||||
const double *porevolume,
|
|
||||||
const double *source,
|
|
||||||
double dt,
|
|
||||||
struct UnstructuredGrid *grid,
|
|
||||||
const Opm::IncompPropertiesInterface* props,
|
|
||||||
const double *darcyflux,
|
|
||||||
double *saturation);
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class IncompPropertiesInterface;
|
||||||
|
|
||||||
void reorderTransportTwophase(const double *porevolume,
|
void reorderTransportTwophase(const double *porevolume,
|
||||||
const double *source,
|
const double *source,
|
||||||
const double dt,
|
const double dt,
|
||||||
|
|||||||
Reference in New Issue
Block a user