Improve a little on tutorial 1.
This commit is contained in:
parent
f386ffa804
commit
c37bd27237
@ -18,17 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
/// \page tutorial1 A simple cartesian grid
|
/// \page tutorial1 A simple cartesian grid
|
||||||
/// This tutorial explains how to construct a simple cartesian grid.
|
/// This tutorial explains how to construct a simple cartesian grid,
|
||||||
|
/// and we will take a look at some output facilities.
|
||||||
|
|
||||||
|
/// \page tutorial1
|
||||||
|
/// \section commentedsource1 Program walkthrough.
|
||||||
|
/// All headers from opm-core are found in the opm/core/ directory.
|
||||||
|
/// Some important headers are at the root, other headers are found
|
||||||
|
/// in subdirectories.
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/GridManager.hpp>
|
#include <opm/core/GridManager.hpp>
|
||||||
#include <opm/core/utility/writeVtkData.hpp>
|
#include <opm/core/utility/writeVtkData.hpp>
|
||||||
@ -36,14 +38,21 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
\code
|
||||||
|
#include <opm/core/grid.h>
|
||||||
|
#include <opm/core/GridManager.hpp>
|
||||||
|
#include <opm/core/utility/writeVtkData.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
|
||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
|
|
||||||
/// \page tutorial1
|
|
||||||
/// \section commentedsource1 Commented source code:
|
|
||||||
/// \code
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
/// \endcode
|
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// We set the number of blocks in each direction.
|
/// We set the number of blocks in each direction.
|
||||||
/// \code
|
/// \code
|
||||||
@ -51,7 +60,7 @@ int main()
|
|||||||
int ny = 3;
|
int ny = 3;
|
||||||
int nz = 2;
|
int nz = 2;
|
||||||
/// \endcode
|
/// \endcode
|
||||||
/// The size of each block is 1x1x1. The default units are allways the
|
/// The size of each block is 1m x 1m x 1m. The default units are always the
|
||||||
/// standard units (SI). But other units can easily be dealt with, see Opm::unit.
|
/// standard units (SI). But other units can easily be dealt with, see Opm::unit.
|
||||||
/// \code
|
/// \code
|
||||||
double dx = 1.0;
|
double dx = 1.0;
|
||||||
@ -59,24 +68,31 @@ int main()
|
|||||||
double dz = 1.0;
|
double dz = 1.0;
|
||||||
/// \endcode
|
/// \endcode
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// One of the constructors of the class Opm::GridManager takes <code>nx,ny,nz,dx,dy,dz</code>
|
/// In opm-core, grid information is accessed via the UnstructuredGrid data structure.
|
||||||
|
/// This data structure has a pure C API, including helper functions to construct and
|
||||||
|
/// destroy the data structure. In this tutorial however, we will use Opm::GridManager,
|
||||||
|
/// which is a C++ class that wraps the UnstructuredGrid and takes care of
|
||||||
|
/// object lifetime issues.
|
||||||
|
/// One of the constructors of the class Opm::GridManager takes <code>nx, ny, nz, dx, dy, dz</code>
|
||||||
/// and construct the corresponding cartesian grid.
|
/// and construct the corresponding cartesian grid.
|
||||||
/// \code
|
/// \code
|
||||||
Opm::GridManager grid(nx, ny, nz, dx, dy, dz);
|
Opm::GridManager grid(nx, ny, nz, dx, dy, dz);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// We open a file to write down the output
|
/// We open an output file stream for the output
|
||||||
/// \code
|
/// \code
|
||||||
std::ofstream vtkfile("tutorial1.vtu");
|
std::ofstream vtkfile("tutorial1.vtu");
|
||||||
/// \endcode
|
/// \endcode
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// The Opm::writeVtkData() function writes output data. Here, we just want to visualize the
|
/// The Opm::writeVtkData() function writes a grid together with
|
||||||
/// grid. We construct an empty Opm::DataMap object, which we send to Opm::writeVtkData() together with the grid
|
/// data to a stream. Here, we just want to visualize the grid. We
|
||||||
|
/// construct an empty Opm::DataMap object, which we send to
|
||||||
|
/// Opm::writeVtkData() together with the grid
|
||||||
/// \code
|
/// \code
|
||||||
Opm::DataMap dm;
|
Opm::DataMap dm;
|
||||||
/// \endcode
|
/// \endcode
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// The function Opm::writeVtkData() writes down the output.
|
/// Call Opm::writeVtkData() to write the output file.
|
||||||
/// \code
|
/// \code
|
||||||
Opm::writeVtkData(*grid.c_grid(), dm, vtkfile);
|
Opm::writeVtkData(*grid.c_grid(), dm, vtkfile);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user