mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-14 01:48:23 +01:00
cleanup of main file
This commit is contained in:
parent
ca0fe9678b
commit
a1bdcf84a7
17
src/main.cpp
17
src/main.cpp
@ -6,26 +6,25 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
// count of grid cells
|
||||||
int x = 20;
|
int x = 20;
|
||||||
|
|
||||||
|
// create input + diffusion coefficients for each grid cell
|
||||||
std::vector<double> alpha(x, 1 * pow(10, -1));
|
std::vector<double> alpha(x, 1 * pow(10, -1));
|
||||||
std::vector<double> input(x, 1 * std::pow(10, -6));
|
std::vector<double> input(x, 1 * std::pow(10, -6));
|
||||||
std::vector<double> bc_left, bc_right;
|
|
||||||
|
|
||||||
bc_left.push_back(5. * std::pow(10, -6));
|
|
||||||
bc_right.push_back(-1);
|
|
||||||
|
|
||||||
|
// create instance of diffusion module
|
||||||
BTCSDiffusion diffu(x);
|
BTCSDiffusion diffu(x);
|
||||||
|
|
||||||
|
// set the boundary condition for the left ghost cell to dirichlet
|
||||||
diffu.setBoundaryCondition(0, 5. * std::pow(10, -6),
|
diffu.setBoundaryCondition(0, 5. * std::pow(10, -6),
|
||||||
BTCSDiffusion::BC_DIRICHLET);
|
BTCSDiffusion::BC_DIRICHLET);
|
||||||
|
|
||||||
|
// set timestep for simulation to 1 second
|
||||||
diffu.setTimestep(1.);
|
diffu.setTimestep(1.);
|
||||||
|
|
||||||
// diffu.setBoundaryCondition(bc_left, BTCSDiffusion::LEFT);
|
// loop 100 times
|
||||||
// we don't need this since Neumann condition with gradient of 0 is set per
|
// output is currently generated by the method itself
|
||||||
// default
|
|
||||||
// diffu.setBoundaryCondition(bc_right, BTCSDiffusion::RIGHT);
|
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
diffu.simulate(input, alpha);
|
diffu.simulate(input, alpha);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user