Update app to new API

This commit is contained in:
Max Luebke 2022-04-19 10:49:18 +02:00
parent ad6e1ad616
commit 7b36225bd6
3 changed files with 19 additions and 19 deletions

View File

@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
// create input + diffusion coefficients for each grid cell
std::vector<double> alpha(n, 1 * pow(10, -1));
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
BTCSDiffusion diffu(dim);
@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
diffu.setXDimensions(1, n);
// 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,
// 5. * std::pow(10, -6));
@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
cout << "Iteration: " << i << "\n\n";
for (auto & cell : field) {
for (auto &cell : field) {
cout << cell << "\n";
}

View File

@ -1,7 +1,7 @@
#include <diffusion/BTCSDiffusion.hpp>
#include <diffusion/BoundaryCondition.hpp>
#include <algorithm> // for copy, max
#include <cmath>
#include <diffusion/BTCSDiffusion.hpp>
#include <diffusion/BoundaryCondition.hpp>
#include <iomanip>
#include <iostream> // for std
#include <vector> // for vector
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
// create input + diffusion coefficients for each grid cell
std::vector<double> alpha(n * m, 1 * pow(10, -1));
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
BTCSDiffusion diffu(dim);
@ -28,8 +28,8 @@ int main(int argc, char *argv[]) {
diffu.setXDimensions(1, n);
diffu.setYDimensions(1, m);
//set inlet to higher concentration without setting bc
field[12] = 5*std::pow(10,-3);
// set inlet to higher concentration without setting bc
field[12] = 5 * std::pow(10, -3);
// set timestep for simulation to 1 second
diffu.setTimestep(1.);

View File

@ -1,7 +1,7 @@
#include <diffusion/BTCSDiffusion.hpp>
#include <diffusion/BoundaryCondition.hpp>
#include <algorithm> // for copy, max
#include <cmath>
#include <diffusion/BTCSDiffusion.hpp>
#include <diffusion/BoundaryCondition.hpp>
#include <iomanip>
#include <iostream> // for std
#include <vector> // for vector
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
// create input + diffusion coefficients for each grid cell
std::vector<double> alpha(n * m, 1 * pow(10, -1));
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;
@ -31,7 +31,7 @@ int main(int argc, char *argv[]) {
diffu.setYDimensions(1., m);
// 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++){
// diffu.setBoundaryCondition(d, 0, BC_CONSTANT, .1);
// }
@ -46,7 +46,7 @@ int main(int argc, char *argv[]) {
// First we output the initial state
cout << 0;
for (int i=0; i < m*n; i++) {
for (int i = 0; i < m * n; i++) {
cout << "," << field[i];
}
cout << endl;
@ -59,7 +59,7 @@ int main(int argc, char *argv[]) {
cout << t;
for (int i=0; i < m*n; i++) {
for (int i = 0; i < m * n; i++) {
cout << "," << field[i];
}
cout << endl;