mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
doc: update example pages
This commit is contained in:
parent
77914ea69f
commit
5a39f5377e
@ -11,18 +11,21 @@ Two dimensional grid with constant boundaries and FTCS method
|
|||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
**Initialization of the grid**
|
**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
|
For example, the initalization of a grid with 20 by 20 cells using double values
|
||||||
also 20 by 20 length units can be done as follows. The setting of the domain is optional here and is set to the
|
and a domain size (physical extent of the grid) of also 20 by 20 length units
|
||||||
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
|
can be done as follows. The setting of the domain is optional here and is set to
|
||||||
initial value of 0 and only in the upper left corner (0,0) the starting concentration is set to the value 20.
|
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
|
.. code-block:: cpp
|
||||||
|
|
||||||
int row = 20
|
int row = 20
|
||||||
int col = 20;
|
int col = 20;
|
||||||
Grid grid = Grid(row,col);
|
Grid<double> grid(row,col);
|
||||||
grid.setDomain(row, col);
|
grid.setDomain(row, col);
|
||||||
MatrixXd concentrations = MatrixXd::Constant(row,col,0);
|
MatrixXd concentrations = MatrixXd::Constant(row,col,0);
|
||||||
|
// or MatrixX<double> concentrations = MatrixX<double>::Constant(row,col,0);
|
||||||
concentrations(0,0) = 20;
|
concentrations(0,0) = 20;
|
||||||
grid.setConcentrations(concentrations);
|
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);
|
bc.setBoundarySideConstant(BC_SIDE_BOTTOM, 0);
|
||||||
|
|
||||||
**Setting of the simulation parameters and simulation start**
|
**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
|
In the last block, a simulation class is created and the objects of the grid and
|
||||||
parameter specifies the output of the simulated results in a CSV file. In the present case, the result of each iteration step is written
|
the boundary conditions are passed. The solution method is also specified
|
||||||
one below the other into the corresponding CSV file.
|
(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
|
.. code-block:: cpp
|
||||||
|
|
||||||
Simulation simulation = Simulation(grid, bc, FTCS_APPROACH);
|
Simulation<double, FTCS_APPROACH> simulation(grid, bc);
|
||||||
simulation.setTimestep(0.1);
|
simulation.setTimestep(0.1);
|
||||||
simulation.setIterations(1000);
|
simulation.setIterations(1000);
|
||||||
simulation.setOutputCSV(CSV_OUTPUT_VERBOSE);
|
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
|
Setting special boundary conditions on individual cells
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user