test: added large FTCS testcase
[skip ci]
This commit is contained in:
parent
5660783929
commit
e7f1e3eb23
@ -20,7 +20,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (int j = 0; j < cols; ++j)
|
||||
{
|
||||
concentrations(i, j) = static_cast<double>(i * j) / 1e6;
|
||||
concentrations(i, j) = static_cast<double>((i + 1) * (j + 1)) / 1e2;
|
||||
}
|
||||
}
|
||||
concentrations(10, 10) = 15000;
|
||||
@ -36,17 +36,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (int j = 0; j < cols; ++j)
|
||||
{
|
||||
alphax(i, j) = std::sin(i / 100.0) * std::cos(j / 100.0);
|
||||
alphay(i, j) = std::cos(i / 100.0) * std::sin(j / 100.0);
|
||||
alphax(i, j) = std::sin((i + 1) / 100.0) * std::cos((j + 1) / 100.0);
|
||||
alphay(i, j) = std::cos((i + 1) / 100.0) * std::sin((j + 1) / 100.0);
|
||||
}
|
||||
}
|
||||
grid.setAlpha(alphax, alphay);
|
||||
|
||||
// **** BOUNDARY ****
|
||||
Boundary bc = Boundary(grid);
|
||||
bc.setBoundarySideConstant(BC_SIDE_LEFT, 1.5);
|
||||
bc.setBoundarySideClosed(BC_SIDE_LEFT);
|
||||
bc.setBoundarySideConstant(BC_SIDE_RIGHT, 1.5);
|
||||
bc.setBoundarySideConstant(BC_SIDE_TOP, 0.75);
|
||||
bc.setBoundarySideClosed(BC_SIDE_TOP);
|
||||
bc.setBoundarySideConstant(BC_SIDE_BOTTOM, 0.75);
|
||||
|
||||
// **** SIMULATION ****
|
||||
|
||||
@ -11,8 +11,8 @@ using namespace std::chrono;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// **** GRID ****
|
||||
int rows = 2027;
|
||||
int cols = 1999;
|
||||
int rows = 2000;
|
||||
int cols = 2000;
|
||||
Grid64 grid(rows, cols);
|
||||
|
||||
MatrixXd concentrations(rows, cols);
|
||||
@ -20,13 +20,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (int j = 0; j < cols; ++j)
|
||||
{
|
||||
concentrations(i, j) = static_cast<double>(i * j) / 1e6;
|
||||
concentrations(i, j) = static_cast<double>(((i + 1) * (j + 1)) / 1e6);
|
||||
}
|
||||
}
|
||||
concentrations(10, 10) = 15000;
|
||||
concentrations(2020, 1994) = 7500;
|
||||
concentrations(10, 1994) = 7500;
|
||||
concentrations(2020, 10) = 7500;
|
||||
concentrations(1000, 1000) = 2000;
|
||||
grid.setConcentrations(concentrations);
|
||||
|
||||
// Complex alpha patterns
|
||||
@ -36,23 +33,23 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (int j = 0; j < cols; ++j)
|
||||
{
|
||||
alphax(i, j) = std::sin(i / 100.0) * std::cos(j / 100.0);
|
||||
alphay(i, j) = std::cos(i / 100.0) * std::sin(j / 100.0);
|
||||
alphax(i, j) = std::sin((i + 1) / 100.0) * std::cos((j + 1) / 100.0) + 1;
|
||||
alphay(i, j) = std::cos((i + 1) / 100.0) * std::sin((j + 1) / 100.0) + 1;
|
||||
}
|
||||
}
|
||||
grid.setAlpha(alphax, alphay);
|
||||
|
||||
// **** BOUNDARY ****
|
||||
Boundary bc = Boundary(grid);
|
||||
bc.setBoundarySideConstant(BC_SIDE_LEFT, 1.5);
|
||||
bc.setBoundarySideConstant(BC_SIDE_RIGHT, 1.5);
|
||||
bc.setBoundarySideConstant(BC_SIDE_TOP, 0.75);
|
||||
bc.setBoundarySideClosed(BC_SIDE_LEFT);
|
||||
bc.setBoundarySideClosed(BC_SIDE_RIGHT);
|
||||
bc.setBoundarySideClosed(BC_SIDE_TOP);
|
||||
bc.setBoundarySideConstant(BC_SIDE_BOTTOM, 0.75);
|
||||
|
||||
// **** SIMULATION ****
|
||||
Simulation simulation = Simulation<double, tug::FTCS_APPROACH>(grid, bc);
|
||||
simulation.setTimestep(0.005);
|
||||
simulation.setIterations(200);
|
||||
simulation.setIterations(500);
|
||||
simulation.setOutputCSV(CSV_OUTPUT_ON);
|
||||
simulation.setOutputConsole(CONSOLE_OUTPUT_OFF);
|
||||
|
||||
@ -10,7 +10,7 @@ function main()
|
||||
|
||||
grid::Grid = Grid{Float64}(rows, cols, alphaX, alphaY)
|
||||
|
||||
concentrations = [i * j / 1e6 for i in 1:rows, j in 1:cols]
|
||||
concentrations = [i * j / 1e2 for i in 1:rows, j in 1:cols]
|
||||
concentrations[11, 11] = 15000
|
||||
concentrations[2021, 1995] = 7500
|
||||
concentrations[11, 1995] = 7500
|
||||
|
||||
@ -2,32 +2,29 @@ include("../../tug/Simulation.jl")
|
||||
|
||||
function main()
|
||||
# **** GRID ****
|
||||
rows::Int = 2027
|
||||
cols::Int = 1999
|
||||
rows::Int = 2000
|
||||
cols::Int = 2000
|
||||
|
||||
alphaX = [sin(i / 100) * cos(j / 100) for i in 1:rows, j in 1:cols]
|
||||
alphaY = [cos(i / 100) * sin(j / 100) for i in 1:rows, j in 1:cols]
|
||||
alphaX = [sin(i / 100) * cos(j / 100) + 1 for i in 1:rows, j in 1:cols]
|
||||
alphaY = [cos(i / 100) * sin(j / 100) + 1 for i in 1:rows, j in 1:cols]
|
||||
|
||||
grid::Grid = Grid{Float64}(rows, cols, alphaX, alphaY)
|
||||
|
||||
concentrations = [i * j / 1e6 for i in 1:rows, j in 1:cols]
|
||||
concentrations[11, 11] = 15000
|
||||
concentrations[2021, 1995] = 7500
|
||||
concentrations[11, 1995] = 7500
|
||||
concentrations[2021, 11] = 7500
|
||||
concentrations = [(i * j) / 1e6 for i in 1:rows, j in 1:cols]
|
||||
concentrations[1001, 1001] = 2000
|
||||
setConcentrations!(grid, concentrations)
|
||||
|
||||
# **** BOUNDARY ****
|
||||
bc::Boundary = Boundary(grid)
|
||||
setBoundarySideClosed!(bc, LEFT)
|
||||
setBoundarySideConstant!(bc, RIGHT, 1.5)
|
||||
setBoundarySideClosed!(bc, RIGHT)
|
||||
setBoundarySideClosed!(bc, TOP)
|
||||
setBoundarySideConstant!(bc, BOTTOM, 0.75)
|
||||
|
||||
# **** SIMULATION ****
|
||||
simulation::Simulation = Simulation(grid, bc, FTCS)
|
||||
simulation = setTimestep(simulation, 0.005)
|
||||
simulation = setIterations(simulation, 200)
|
||||
simulation = setIterations(simulation, 500)
|
||||
simulation = setOutputConsole(simulation, CONSOLE_OUTPUT_OFF)
|
||||
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user