mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-15 18:38:23 +01:00
added functions for the summands of the different directions
This commit is contained in:
parent
b7561b93e0
commit
ef01e3f473
55
src/FTCS.cpp
55
src/FTCS.cpp
@ -12,6 +12,59 @@ double calc_alpha_intercell(double alpha1, double alpha2, bool useHarmonic = fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IN PROGRESS
|
||||||
|
double verticalChange(Grid grid, int row, int col) {
|
||||||
|
|
||||||
|
double result =
|
||||||
|
calc_alpha_intercell(grid.getAlphaY()(row+1,col), grid.getAlphaY()(row,col))
|
||||||
|
* grid.getConcentrations()(row+1,col)
|
||||||
|
- (calc_alpha_intercell(grid.getAlphaY()(row+1,col), grid.getAlphaY()(row,col))
|
||||||
|
+ calc_alpha_intercell(grid.getAlphaY()(row-1,col), grid.getAlphaY()(row,col)))
|
||||||
|
* grid.getConcentrations()(row,col)
|
||||||
|
+ calc_alpha_intercell(grid.getAlphaY()(row-1,col), grid.getAlphaY()(row,col))
|
||||||
|
* grid.getConcentrations()(row-1,col);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IN PROGRESS
|
||||||
|
double horizontalChange(Grid grid, int row, int col) {
|
||||||
|
|
||||||
|
double result =
|
||||||
|
calc_alpha_intercell(grid.getAlphaX()(row,col+1), grid.getAlphaX()(row,col))
|
||||||
|
* grid.getConcentrations()(row,col+1)
|
||||||
|
- (calc_alpha_intercell(grid.getAlphaX()(row,col+1), grid.getAlphaX()(row,col))
|
||||||
|
+ calc_alpha_intercell(grid.getAlphaX()(row,col-1), grid.getAlphaX()(row,col)))
|
||||||
|
* grid.getConcentrations()(row,col)
|
||||||
|
+ calc_alpha_intercell(grid.getAlphaX()(row,col-1), grid.getAlphaX()(row,col))
|
||||||
|
* grid.getConcentrations()(row,col-1);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IN PROGRESS
|
||||||
|
MatrixXd FTCS_1D_constant(Grid grid, Boundary bc, double timestep) {
|
||||||
|
int colMax = grid.getCol();
|
||||||
|
double deltaCol = grid.getDeltaCol();
|
||||||
|
|
||||||
|
MatrixXd concentrations_t1 = MatrixXd::Constant(1, colMax, 0);
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
// for (int col = 1; col < colMax-1; col++) {
|
||||||
|
// concentrations_t1 = grid.getConcentrations()(row,col)
|
||||||
|
// + horizontal_term();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// IN PROGRESS
|
||||||
|
MatrixXd FTCS_2D_constant(Grid grid, Boundary bc, double timestep) {
|
||||||
|
int rowMax = grid.getRow();
|
||||||
|
int colMax = grid.getCol();
|
||||||
|
double deltaRow = grid.getDeltaRow();
|
||||||
|
double deltaCol = grid.getDeltaCol();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
MatrixXd FTCS_constant(Grid grid, Boundary bc, double timestep) {
|
MatrixXd FTCS_constant(Grid grid, Boundary bc, double timestep) {
|
||||||
int rowMax = grid.getRow();
|
int rowMax = grid.getRow();
|
||||||
int colMax = grid.getCol();
|
int colMax = grid.getCol();
|
||||||
@ -20,7 +73,7 @@ MatrixXd FTCS_constant(Grid grid, Boundary bc, double timestep) {
|
|||||||
|
|
||||||
// Matrix with concentrations at time t+1
|
// Matrix with concentrations at time t+1
|
||||||
// TODO profiler / only use 2 matrices
|
// TODO profiler / only use 2 matrices
|
||||||
MatrixXd concentrations_t1 = MatrixXd::Constant(rowMax, colMax, 1);
|
MatrixXd concentrations_t1 = MatrixXd::Constant(rowMax, colMax, 0);
|
||||||
|
|
||||||
// inner cells
|
// inner cells
|
||||||
// (should have 7 calls to current concentration)
|
// (should have 7 calls to current concentration)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user