Diffusion
-
enum tug::APPROACH
Enum defining the implemented solution approaches.
Values:
-
enumerator FTCS_APPROACH
Forward Time-Centered Space
-
enumerator BTCS_APPROACH
Backward Time-Centered Space
-
enumerator CRANK_NICOLSON_APPROACH
Crank-Nicolson method
-
enumerator FTCS_APPROACH
-
enum tug::SOLVER
Enum defining the Linear Equation solvers.
Values:
-
enumerator EIGEN_LU_SOLVER
EigenLU solver
-
enumerator THOMAS_ALGORITHM_SOLVER
Thomas Algorithm solver; more efficient for tridiagonal matrices
-
enumerator EIGEN_LU_SOLVER
-
enum class tug::CSV_OUTPUT
Enum holding different options for .csv output.
Values:
-
enumerator OFF
do not produce csv output
-
enumerator ON
produce csv output with last concentration matrix
-
enumerator VERBOSE
produce csv output with all concentration matrices
-
enumerator XTREME
csv output like VERBOSE but additional boundary conditions at beginning
-
enumerator OFF
-
enum class tug::CONSOLE_OUTPUT
Enum holding different options for console output.
Values:
-
enumerator OFF
do not print any output to console
-
enumerator ON
print before and after concentrations to console
-
enumerator VERBOSE
print all concentration matrices to console
-
enumerator OFF
-
enum class tug::TIME_MEASURE
Enum holding different options for time measurement.
Values:
-
enumerator OFF
do not print any time measures
-
enumerator ON
print time measure after last iteration
-
enumerator OFF
-
template<class T, APPROACH approach = BTCS_APPROACH, SOLVER solver = THOMAS_ALGORITHM_SOLVER>
class Diffusion : public tug::BaseSimulationGrid<T> The class forms the interface for performing the diffusion simulations and contains all the methods for controlling the desired parameters, such as time step, number of simulations, etc.
- Template Parameters:
T – the type of the internal data structures for grid, boundary condition and timestep
approach – Set the SLE scheme to be used
solver – Set the solver to be used
Public Functions
-
inline Diffusion(T *data, int rows, int cols)
Construct a new 2D Diffusion object from a given data pointer and the dimensions.
-
inline Diffusion(T *data, std::size_t length)
Construct a new 1D Diffusion object from a given data pointer and the length.
-
inline RowMajMat<T> &getAlphaX()
Get the alphaX matrix.
- Returns:
RowMajMat<T>& Reference to the alphaX matrix.
-
inline RowMajMat<T> &getAlphaY()
Get the alphaY matrix.
- Returns:
RowMajMat<T>& Reference to the alphaY matrix.
-
inline void setAlphaX(const RowMajMat<T> &alphaX)
Set the alphaX matrix.
- Parameters:
alphaX – The new alphaX matrix.
-
inline void setAlphaY(const RowMajMat<T> &alphaY)
Set the alphaY matrix.
- Parameters:
alphaY – The new alphaY matrix.
-
inline virtual void setTimestep(T timestep) override
Setting the time step for each iteration step. Time step must be greater than zero. Setting the timestep is required.
- Parameters:
timestep – Valid timestep greater than zero.
-
inline void setNumberThreads(int numThreads)
Set the number of desired openMP Threads.
- Parameters:
num_threads – Number of desired threads. Must have a value between 1 and the maximum available number of processors. The maximum number of processors is set as the default case during Simulation construction.
-
inline void printConcentrationsConsole() const
Outputs the current concentrations of the grid on the console.
-
inline std::string createCSVfile() const
Creates a CSV file with a name containing the current simulation parameters. If the data name already exists, an additional counter is appended to the name. The name of the file is built up as follows: <approach> + <number rows> + <number columns> + <number of
iterations>+<counter>.csv.
- Returns:
string Filename with configured simulation parameters.
-
inline void printConcentrationsCSV(const std::string &filename) const
Writes the currently calculated concentration values of the grid into the CSV file with the passed filename.
- Parameters:
filename – Name of the file to which the concentration values are to be written.
-
inline virtual void run() override
Method starts the simulation process with the previously set parameters.