fix bugs
This commit is contained in:
parent
6a2db786c5
commit
decfe1d710
3 changed files with 278 additions and 275 deletions
|
|
@ -31,7 +31,7 @@ int main(int argc, char **argv )
|
|||
// ##########################################
|
||||
|
||||
double dt = 1.0; // time step
|
||||
int steps = 1; // number of time iterations
|
||||
int steps = 20; // number of time iterations
|
||||
|
||||
double u0_mug = 18.0;
|
||||
double u0_fluid = 80.0;
|
||||
|
|
@ -52,7 +52,7 @@ int main(int argc, char **argv )
|
|||
|
||||
SK.CalculateLaplace_mult(fv); // stiffness matrix (+K)
|
||||
SK.AddMass_mult(fv, 1.0/dt); // add mass matrix (+M/dt)
|
||||
SK.ApplyRobinBC_mult(fv, u_out); // apply Robin-bnd (+C = +F)
|
||||
// SK.ApplyRobinBC_mult(fv, u_out); // apply Robin-bnd (+C = +F)
|
||||
// SK = M/dt + K + C = F
|
||||
|
||||
// SK.Debug();
|
||||
|
|
@ -75,26 +75,29 @@ int main(int argc, char **argv )
|
|||
mesh_c.Init_Solution_mult(uv, 0, [u0_mug](double x, double y) -> double { return u0_mug; }); // mug
|
||||
mesh_c.Init_Solution_mult(uv, 1, [u0_fluid](double x, double y) -> double { return u0_fluid; }); // fluid
|
||||
mesh_c.Init_Solution_mult(uv, 2, [u0_air](double x, double y) -> double { return u0_air; }); // air
|
||||
|
||||
|
||||
// TODO DINO
|
||||
auto t3 = system_clock::now(); // start timer
|
||||
for (int step = 0; step < steps; ++step)
|
||||
{
|
||||
vector<double> G(Mdt.Nrows(), 0.0);
|
||||
Mdt.Mult(G, uv); // G = M/dt * u_{n}
|
||||
|
||||
vector<double> H = fv;
|
||||
for (size_t i = 0; i < Mdt.Nrows(); ++i)
|
||||
{
|
||||
fv[i] += G[i]; // F + G
|
||||
H[i] += G[i]; // H = F + G
|
||||
}
|
||||
|
||||
JacobiSolve(SK, fv, uv); // solve: (M/dt + K + C) * u_{n+1} = F + M/dt * u_{n}
|
||||
JacobiSolve(SK, H, uv); // solve: (M/dt + K + C) * u_{n+1} = F + M/dt * u_{n}
|
||||
// ----- SK ----- ------ H -------
|
||||
}
|
||||
auto t4 = system_clock::now(); // stop timer
|
||||
|
||||
|
||||
auto duration = duration_cast<microseconds>(t4 - t3); // duration in microseconds
|
||||
double t_diff = static_cast<double>(duration.count()) / 1e6; // overall duration in seconds
|
||||
cout << "JacobiSolve: timing in sec. : " << t_diff << endl;
|
||||
cout << "\n\nJacobiSolve: timing in sec. : " << t_diff << endl;
|
||||
|
||||
|
||||
mesh_c.Visualize(uv);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue