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