code is now included using \snippet. Apparently this looks better with the new Doxygen version. The HTML_EXTRA_STYLESHEET is now used rather then the HTML_STYLESHEET in order to include used-defined styles for the same reason

This commit is contained in:
Tor Harald Sandve
2013-03-06 10:17:27 +01:00
parent 98fbb80fdc
commit c2506c9fb2
7 changed files with 364 additions and 1009 deletions

View File

@@ -24,7 +24,7 @@
/// \f${\bf u}\f$ denotes the velocity and \f$p\f$ the pressure. The permeability tensor is
/// given by \f$K\f$ and \f$\mu\f$ denotes the viscosity.
///
/// We solve the flow equations for a cartesian grid and we set the source term
/// We solve the flow equations for a Cartesian grid and we set the source term
/// \f$q\f$ be zero except at the left-lower and right-upper corner, where it is equal
/// with opposite sign (inflow equal to outflow).
@@ -49,28 +49,33 @@
#include <opm/core/simulator/WellState.hpp>
/// \page tutorial2
/// \section commentedcode2 Program walkthrough.
/// \code
/// \section commentedcode2 Program walk-through.
///
int main()
{
/// \endcode
/// \page tutorial2
/// We construct a cartesian grid
/// \code
/// We construct a Cartesian grid
/// \snippet tutorial2.cpp cartesian grid
/// \internal [cartesian grid]
int dim = 3;
int nx = 40;
int ny = 40;
int nz = 1;
Opm::GridManager grid(nx, ny, nz);
/// \endcode
/// \internal [cartesian grid]
/// \endinternal
/// \page tutorial2
/// \details We access the unstructured grid through
/// the pointer given by \c grid.c_grid(). For more details on the
/// UnstructuredGrid data structure, see grid.h.
/// \code
/// \snippet tutorial2.cpp access grid
/// \internal [access grid]
int num_cells = grid.c_grid()->number_of_cells;
int num_faces = grid.c_grid()->number_of_faces;
/// \endcode
/// \internal [access grid]
/// endinternal
/// \page tutorial2
@@ -80,90 +85,107 @@ int main()
/// The <opm/core/utility/Units.hpp> header contains support
/// for common units and prefixes, in the namespaces Opm::unit
/// and Opm::prefix.
/// \code
/// \snippet tutorial2.cpp fluid
/// \internal [fluid]
using namespace Opm::unit;
using namespace Opm::prefix;
int num_phases = 1;
std::vector<double> mu(num_phases, 1.0*centi*Poise);
std::vector<double> rho(num_phases, 1000.0*kilogram/cubic(meter));
/// \endcode
/// \internal [fluid]
/// \endinternal
/// \page tutorial2
/// \details
/// We define a permeability equal to 100 mD.
/// \code
/// \snippet tutorial2.cpp perm
/// \internal [perm]
double k = 100.0*milli*darcy;
/// \endcode
/// \page tutorial2
/// \details
/// \internal [perm]
/// \endinternal
/// \page tutorial2
/// \details
/// We set up a simple property object for a single-phase situation.
/// \code
/// \snippet tutorial2.cpp single-phase property
/// \internal [single-phase property]
Opm::IncompPropertiesBasic props(1, Opm::SaturationPropsBasic::Constant, rho,
mu, 1.0, k, dim, num_cells);
/// \endcode
/// \internal [single-phase property]
/// /endinternal
/// \page tutorial2
/// \details
/// We take UMFPACK as the linear solver for the pressure solver
/// (this library has therefore to be installed).
/// \code
/// \snippet tutorial2.cpp linsolver
/// \internal [linsolver]
Opm::LinearSolverUmfpack linsolver;
/// \endcode
/// \page tutorial2
/// \internal [linsolver]
/// \endinternal
/// \endcode
/// \page tutorial2
/// We define the source term.
/// \code
/// \snippet tutorial2.cpp source
/// \internal [source]
std::vector<double> src(num_cells, 0.0);
src[0] = 100.;
src[num_cells-1] = -100.;
/// \endcode
/// \internal [source]
/// \endinternal
/// \page tutorial2
/// \details We set up the boundary conditions.
/// By default, we obtain no-flow boundary conditions.
/// \code
/// \snippet tutorial2.cpp boundary
/// \internal [boundary]
Opm::FlowBCManager bcs;
/// \endcode
/// \internal [boundary]
/// \endinternal
/// We set up a pressure solver for the incompressible problem,
/// using the two-point flux approximation discretization. The
/// null pointers correspond to arguments for gravity, wells and
/// boundary conditions, which are all defaulted (to zero gravity,
/// no wells, and no-flow boundaries).
/// \code
/// \snippet tutorial2.cpp tpfa
/// \internal [tpfa]
Opm::IncompTpfa psolver(*grid.c_grid(), props, linsolver, NULL, NULL, src, NULL);
/// \internal [tpfa]
/// \endinternal
/// \page tutorial2
/// We declare the state object, that will contain the pressure and face
/// flux vectors we are going to compute. The well state
/// object is needed for interface compatibility with the
/// <CODE>solve()</CODE> method of class
/// <CODE>Opm::IncompTPFA</CODE>.
/// \code
/// \snippet tutorial2.cpp state
/// \internal [state]
Opm::TwophaseState state;
state.pressure().resize(num_cells, 0.0);
state.faceflux().resize(num_faces, 0.0);
state.saturation().resize(num_cells, 1.0);
Opm::WellState well_state;
/// \endcode
/// \internal [state]
/// \endinternal
/// \page tutorial2
/// We call the pressure solver.
/// The first (timestep) argument does not matter for this
/// incompressible case.
/// \code
/// \snippet tutorial2.cpp pressure solver
/// \internal [pressure solver]
psolver.solve(1.0*day, state, well_state);
/// \endcode
/// \internal [pressure solver]
/// \endinternal
/// \page tutorial2
/// We write the results to a file in VTK format.
/// The data vectors added to the Opm::DataMap must
/// contain cell data. They may be a scalar per cell
/// (pressure) or a vector per cell (cell_velocity).
/// \code
/// \snippet tutorial2.cpp write output
/// \internal [write output]
std::ofstream vtkfile("tutorial2.vtu");
Opm::DataMap dm;
dm["pressure"] = &state.pressure();
@@ -171,8 +193,10 @@ int main()
Opm::estimateCellVelocity(*grid.c_grid(), state.faceflux(), cell_velocity);
dm["velocity"] = &cell_velocity;
Opm::writeVtkData(*grid.c_grid(), dm, vtkfile);
/// \internal [write output]
/// \endinternal
}
/// \endcode
/// \page tutorial2
/// We read the vtu output file in \a Paraview and obtain the following pressure
/// distribution. \image html tutorial2.png
@@ -181,3 +205,8 @@ int main()
/// \page tutorial2
/// \section completecode2 Complete source code:
/// \include tutorial2.cpp
/// \page tutorial2
/// \details
/// \section pythonscript2 python script to generate figures:
/// \snippet generate_doc_figures.py tutorial2