doc: update example pages

This commit is contained in:
Max Lübke 2023-10-19 13:09:22 +02:00
parent 77914ea69f
commit 5a39f5377e

View File

@ -11,18 +11,21 @@ Two dimensional grid with constant boundaries and FTCS method
-------------------------------------------------------------
**Initialization of the grid**
For example, the initalization of a grid with 20 by 20 cells and a domain size (physical extent of the grid) of
also 20 by 20 length units can be done as follows. The setting of the domain is optional here and is set to the
same size as the number of cells in the standard case. As seen in the code, the cells of the grid are set to an
initial value of 0 and only in the upper left corner (0,0) the starting concentration is set to the value 20.
For example, the initalization of a grid with 20 by 20 cells using double values
and a domain size (physical extent of the grid) of also 20 by 20 length units
can be done as follows. The setting of the domain is optional here and is set to
the same size as the number of cells in the standard case. As seen in the code,
the cells of the grid are set to an initial value of 0 and only in the upper
left corner (0,0) the starting concentration is set to the value 20.
.. code-block:: cpp
int row = 20
int col = 20;
Grid grid = Grid(row,col);
Grid<double> grid(row,col);
grid.setDomain(row, col);
MatrixXd concentrations = MatrixXd::Constant(row,col,0);
// or MatrixX<double> concentrations = MatrixX<double>::Constant(row,col,0);
concentrations(0,0) = 20;
grid.setConcentrations(concentrations);
@ -40,14 +43,17 @@ of the grid are set as constant edges with a concentration of 0.
bc.setBoundarySideConstant(BC_SIDE_BOTTOM, 0);
**Setting of the simulation parameters and simulation start**
In the last block, a simulation class is created and the objects of the grid and the boundary conditions are passed. The solution
method is also specified (either FCTS or BTCS). Furthermore, the desired time step and the number of iterations are set. The penultimate
parameter specifies the output of the simulated results in a CSV file. In the present case, the result of each iteration step is written
one below the other into the corresponding CSV file.
In the last block, a simulation class is created and the objects of the grid and
the boundary conditions are passed. The solution method is also specified
(either FCTS or BTCS). Furthermore, the desired time step and the number of
iterations are set. The penultimate parameter specifies the output of the
simulated results in a CSV file. In the present case, the result of each
iteration step is written one below the other into the corresponding CSV file.
.. code-block:: cpp
Simulation simulation = Simulation(grid, bc, FTCS_APPROACH);
Simulation<double, FTCS_APPROACH> simulation(grid, bc);
simulation.setTimestep(0.1);
simulation.setIterations(1000);
simulation.setOutputCSV(CSV_OUTPUT_VERBOSE);
@ -59,4 +65,4 @@ one below the other into the corresponding CSV file.
Setting special boundary conditions on individual cells
-------------------------------------------------------
-------------------------------------------------------