C++ified twophase model code.
This commit is contained in:
parent
a3662637c1
commit
45d603939d
@ -82,7 +82,7 @@ opm/core/transport/spu_implicit.c \
|
||||
opm/core/transport/transport_source.c \
|
||||
opm/core/transport/reorder/fluid.c \
|
||||
opm/core/transport/reorder/reordersequence.c \
|
||||
opm/core/transport/reorder/twophase.c \
|
||||
opm/core/transport/reorder/twophase.cpp \
|
||||
opm/core/transport/reorder/nlsolvers.c \
|
||||
opm/core/transport/reorder/tarjan.c \
|
||||
opm/core/transport/reorder/twophasetransport.cpp
|
||||
@ -199,7 +199,7 @@ opm/core/transport/transport_source.h \
|
||||
opm/core/transport/reorder/fluid.h \
|
||||
opm/core/transport/reorder/nlsolvers.h \
|
||||
opm/core/transport/reorder/reordersequence.h \
|
||||
opm/core/transport/reorder/twophase.h \
|
||||
opm/core/transport/reorder/twophase.hpp \
|
||||
opm/core/transport/reorder/tarjan.h \
|
||||
opm/core/transport/reorder/twophasetransport.hpp
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "fluid.h"
|
||||
#else
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/transport/reorder/twophase.h>
|
||||
#include <opm/core/transport/reorder/twophase.hpp>
|
||||
#include <opm/core/transport/reorder/nlsolvers.h>
|
||||
#include <opm/core/transport/reorder/fluid.h>
|
||||
#endif
|
||||
@ -46,7 +46,7 @@ init_solverdata(struct UnstructuredGrid *grid, const double *darcyflux,
|
||||
const int *satnum, double dt, double *saturation)
|
||||
{
|
||||
int i;
|
||||
struct SolverData *d = malloc(sizeof *d);
|
||||
struct SolverData *d = (struct SolverData*) malloc(sizeof *d);
|
||||
|
||||
if(d!=NULL)
|
||||
{
|
||||
@ -58,8 +58,8 @@ init_solverdata(struct UnstructuredGrid *grid, const double *darcyflux,
|
||||
d->dt = dt;
|
||||
|
||||
d->saturation = saturation;
|
||||
d->fractionalflow = malloc(grid->number_of_cells *
|
||||
sizeof *d->fractionalflow);
|
||||
d->fractionalflow = (double*) malloc(grid->number_of_cells *
|
||||
sizeof *d->fractionalflow);
|
||||
if (d->fractionalflow == NULL)
|
||||
{
|
||||
destroy_solverdata(d);
|
||||
@ -76,8 +76,8 @@ init_solverdata(struct UnstructuredGrid *grid, const double *darcyflux,
|
||||
/* Solver for single-cell bvp calls root-finder in nlsolvers.c */
|
||||
void solvecell(void *data, struct NonlinearSolverCtrl *ctrl, int cell)
|
||||
{
|
||||
struct SolverData *d = data;
|
||||
struct Parameters prm = get_parameters(data, cell);
|
||||
struct SolverData *d = (struct SolverData*) data;
|
||||
struct Parameters prm = get_parameters(d, cell);
|
||||
|
||||
d->saturation[cell] = find_zero(residual, &prm, ctrl);
|
||||
d->fractionalflow[cell] = fluxfun(d->saturation[cell], prm.region);
|
||||
@ -101,7 +101,7 @@ void solvecell(void *data, struct NonlinearSolverCtrl *ctrl, int cell)
|
||||
static double
|
||||
residual(double s, void *data)
|
||||
{
|
||||
struct Parameters *p = data;
|
||||
struct Parameters *p = (struct Parameters*) data;
|
||||
return s - p->s0 + p->dtpv*(p->outflux*fluxfun(s, p->region) + p->influx);
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
/* Copyright 2011 (c) Jostein R. Natvig <Jostein.R.Natvig at sintef.no> */
|
||||
|
||||
#ifndef TWOPHASE_H_INCLUDED
|
||||
#define TWOPHASE_H_INCLUDED
|
||||
#ifndef TWOPHASE_HPP_INCLUDED
|
||||
#define TWOPHASE_HPP_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct UnstructuredGrid;
|
||||
@ -34,9 +31,6 @@ init_solverdata(struct UnstructuredGrid *grid, const double *darcyflux,
|
||||
const double *porevolume, const double *source,
|
||||
const int *satnum, double dt, double *saturation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TWOPHASE_H_INCLUDED */
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "reordersequence.h"
|
||||
#include "tarjan.h"
|
||||
#include "nlsolvers.h"
|
||||
#include "twophase.h"
|
||||
#include "twophase.hpp"
|
||||
#include "twophasetransport.hpp"
|
||||
|
||||
#include <mex.h>
|
||||
@ -25,7 +25,7 @@ extern int interrupt_signal;
|
||||
#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.h>
|
||||
#include <opm/core/transport/reorder/twophase.hpp>
|
||||
#include <opm/core/transport/reorder/twophasetransport.hpp>
|
||||
|
||||
#define print printf
|
||||
|
Loading…
Reference in New Issue
Block a user