mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 17:38:23 +01:00
Update app to new API
This commit is contained in:
parent
ad6e1ad616
commit
7b36225bd6
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// create input + diffusion coefficients for each grid cell
|
// create input + diffusion coefficients for each grid cell
|
||||||
std::vector<double> alpha(n, 1 * pow(10, -1));
|
std::vector<double> alpha(n, 1 * pow(10, -1));
|
||||||
std::vector<double> field(n, 1 * std::pow(10, -6));
|
std::vector<double> field(n, 1 * std::pow(10, -6));
|
||||||
std::vector<boundary_condition> bc(n, {0,0});
|
std::vector<boundary_condition> bc(n + 2, {0, 0});
|
||||||
|
|
||||||
// create instance of diffusion module
|
// create instance of diffusion module
|
||||||
BTCSDiffusion diffu(dim);
|
BTCSDiffusion diffu(dim);
|
||||||
@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
|
|||||||
diffu.setXDimensions(1, n);
|
diffu.setXDimensions(1, n);
|
||||||
|
|
||||||
// set the boundary condition for the left ghost cell to dirichlet
|
// set the boundary condition for the left ghost cell to dirichlet
|
||||||
bc[0] = {Diffusion::BC_CONSTANT, 5*std::pow(10,-6)};
|
bc[1] = {Diffusion::BC_CONSTANT, 5 * std::pow(10, -6)};
|
||||||
// diffu.setBoundaryCondition(1, 0, BTCSDiffusion::BC_CONSTANT,
|
// diffu.setBoundaryCondition(1, 0, BTCSDiffusion::BC_CONSTANT,
|
||||||
// 5. * std::pow(10, -6));
|
// 5. * std::pow(10, -6));
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
cout << "Iteration: " << i << "\n\n";
|
cout << "Iteration: " << i << "\n\n";
|
||||||
|
|
||||||
for (auto & cell : field) {
|
for (auto &cell : field) {
|
||||||
cout << cell << "\n";
|
cout << cell << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
#include <algorithm> // for copy, max
|
||||||
|
#include <cmath>
|
||||||
#include <diffusion/BTCSDiffusion.hpp>
|
#include <diffusion/BTCSDiffusion.hpp>
|
||||||
#include <diffusion/BoundaryCondition.hpp>
|
#include <diffusion/BoundaryCondition.hpp>
|
||||||
#include <algorithm> // for copy, max
|
|
||||||
#include <cmath>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream> // for std
|
#include <iostream> // for std
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// create input + diffusion coefficients for each grid cell
|
// create input + diffusion coefficients for each grid cell
|
||||||
std::vector<double> alpha(n * m, 1 * pow(10, -1));
|
std::vector<double> alpha(n * m, 1 * pow(10, -1));
|
||||||
std::vector<double> field(n * m, 1 * std::pow(10, -6));
|
std::vector<double> field(n * m, 1 * std::pow(10, -6));
|
||||||
std::vector<boundary_condition> bc(n*m, {0,0});
|
std::vector<boundary_condition> bc((n + 2) * (m + 2), {0, 0});
|
||||||
|
|
||||||
// create instance of diffusion module
|
// create instance of diffusion module
|
||||||
BTCSDiffusion diffu(dim);
|
BTCSDiffusion diffu(dim);
|
||||||
@ -28,8 +28,8 @@ int main(int argc, char *argv[]) {
|
|||||||
diffu.setXDimensions(1, n);
|
diffu.setXDimensions(1, n);
|
||||||
diffu.setYDimensions(1, m);
|
diffu.setYDimensions(1, m);
|
||||||
|
|
||||||
//set inlet to higher concentration without setting bc
|
// set inlet to higher concentration without setting bc
|
||||||
field[12] = 5*std::pow(10,-3);
|
field[12] = 5 * std::pow(10, -3);
|
||||||
|
|
||||||
// set timestep for simulation to 1 second
|
// set timestep for simulation to 1 second
|
||||||
diffu.setTimestep(1.);
|
diffu.setTimestep(1.);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
#include <algorithm> // for copy, max
|
||||||
|
#include <cmath>
|
||||||
#include <diffusion/BTCSDiffusion.hpp>
|
#include <diffusion/BTCSDiffusion.hpp>
|
||||||
#include <diffusion/BoundaryCondition.hpp>
|
#include <diffusion/BoundaryCondition.hpp>
|
||||||
#include <algorithm> // for copy, max
|
|
||||||
#include <cmath>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream> // for std
|
#include <iostream> // for std
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// create input + diffusion coefficients for each grid cell
|
// create input + diffusion coefficients for each grid cell
|
||||||
std::vector<double> alpha(n * m, 1 * pow(10, -1));
|
std::vector<double> alpha(n * m, 1 * pow(10, -1));
|
||||||
std::vector<double> field(n * m, 0.);
|
std::vector<double> field(n * m, 0.);
|
||||||
std::vector<boundary_condition> bc(n*m, {0,0});
|
std::vector<boundary_condition> bc((n + 2) * (m + 2), {0, 0});
|
||||||
|
|
||||||
field[125500] = 1;
|
field[125500] = 1;
|
||||||
|
|
||||||
@ -31,13 +31,13 @@ int main(int argc, char *argv[]) {
|
|||||||
diffu.setYDimensions(1., m);
|
diffu.setYDimensions(1., m);
|
||||||
|
|
||||||
// set the boundary condition for the left ghost cell to dirichlet
|
// set the boundary condition for the left ghost cell to dirichlet
|
||||||
//diffu.setBoundaryCondition(250, 250, BTCSDiffusion::BC_CONSTANT, 1);
|
// diffu.setBoundaryCondition(250, 250, BTCSDiffusion::BC_CONSTANT, 1);
|
||||||
// for (int d=0; d<5;d++){
|
// for (int d=0; d<5;d++){
|
||||||
// diffu.setBoundaryCondition(d, 0, BC_CONSTANT, .1);
|
// diffu.setBoundaryCondition(d, 0, BC_CONSTANT, .1);
|
||||||
// }
|
// }
|
||||||
// diffu.setBoundaryCondition(1, 1, BTCSDiffusion::BC_CONSTANT, .1);
|
// diffu.setBoundaryCondition(1, 1, BTCSDiffusion::BC_CONSTANT, .1);
|
||||||
// diffu.setBoundaryCondition(1, 1, BTCSDiffusion::BC_CONSTANT, .1);
|
// diffu.setBoundaryCondition(1, 1, BTCSDiffusion::BC_CONSTANT, .1);
|
||||||
|
|
||||||
// set timestep for simulation to 1 second
|
// set timestep for simulation to 1 second
|
||||||
diffu.setTimestep(1.);
|
diffu.setTimestep(1.);
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// First we output the initial state
|
// First we output the initial state
|
||||||
cout << 0;
|
cout << 0;
|
||||||
|
|
||||||
for (int i=0; i < m*n; i++) {
|
for (int i = 0; i < m * n; i++) {
|
||||||
cout << "," << field[i];
|
cout << "," << field[i];
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
@ -58,9 +58,9 @@ int main(int argc, char *argv[]) {
|
|||||||
cerr << "time elapsed: " << time << " seconds" << endl;
|
cerr << "time elapsed: " << time << " seconds" << endl;
|
||||||
|
|
||||||
cout << t;
|
cout << t;
|
||||||
|
|
||||||
for (int i=0; i < m*n; i++) {
|
for (int i = 0; i < m * n; i++) {
|
||||||
cout << "," << field[i];
|
cout << "," << field[i];
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user