Rheolef  7.1
an efficient C++ finite element environment
oldroyd_cavity.cc
Go to the documentation of this file.
1 #include "rheolef.h"
26 using namespace rheolef;
27 using namespace std;
28 #include "oldroyd_theta_scheme.h"
29 #include "oldroyd_cavity.h"
30 int main(int argc, char**argv) {
31  environment rheolef (argc, argv);
32  cin >> noverbose;
34  geo omega (argv[1]);
35  Float We_incr = (argc > 2) ? atof(argv[2]) : 0.1;
36  Float We_max = (argc > 3) ? atof(argv[3]) : 0.1;
37  Float delta_t0 = (argc > 4) ? atof(argv[4]) : 0.005;
38  string restart = (argc > 5) ? argv[5] : "";
39  pb.tol = 1e-3;
40  pb.max_iter = 50000;
41  pb.alpha = 8./9;
42  pb.a = 1;
43  pb.delta_t = delta_t0;
44  Float delta_t_min = 1e-5;
45  Float We_incr_min = 1e-5;
46  dout << catchmark("alpha") << pb.alpha << endl
47  << catchmark("a") << pb.a << endl;
48  branch even ("We", "tau", "u", "p");
49  field tau_h, uh, ph;
50  pb.initial (omega, tau_h, uh, ph, restart);
51  dout << even (pb.We, tau_h, uh, ph);
52  bool ok = true;
53  do {
54  if (ok) pb.We += We_incr;
55  derr << "# We = " << pb.We << " delta_t = " << pb.delta_t << endl;
56  field tau_h0 = tau_h, uh0 = uh, ph0 = ph;
57  ok = pb.solve (tau_h, uh, ph);
58  if (ok) {
59  dout << even (pb.We, tau_h, uh, ph);
60  } else {
61  pb.delta_t /= 2;
62  tau_h = tau_h0; uh = uh0; ph = ph0;
63  if (pb.delta_t < delta_t_min) {
64  derr << "# solve failed: decreases We_incr and retry..." << endl;
65  pb.delta_t = delta_t0;
66  We_incr /= 2;
67  pb.We -= We_incr;
68  if (We_incr < We_incr_min) break;
69  } else {
70  derr << "# solve failed: decreases delta_t and retry..." << endl;
71  }
72  }
73  derr << endl << endl;
74  } while (true);
75 }
oldroyd_theta_scheme.h
The Oldroyd problem by the theta-scheme – class header.
oldroyd_theta_scheme::max_iter
size_t max_iter
Definition: oldroyd_theta_scheme.h:43
rheolef::catchmark
see the catchmark page for the full documentation
Definition: catchmark.h:67
oldroyd_theta_scheme::alpha
Float alpha
Definition: oldroyd_theta_scheme.h:42
field
see the field page for the full documentation
oldroyd_theta_scheme::solve
bool solve(field &tau_h, field &uh, field &ph)
Definition: oldroyd_theta_scheme2.h:26
oldroyd_theta_scheme::delta_t
Float delta_t
Definition: oldroyd_theta_scheme.h:42
oldroyd_theta_scheme::tol
Float tol
Definition: oldroyd_theta_scheme.h:42
rheolef.h
rheolef - reference manual
oldroyd_theta_scheme
Definition: oldroyd_theta_scheme.h:26
oldroyd_theta_scheme::initial
void initial(const geo &omega, field &tau_h, field &uh, field &ph, string restart)
Definition: oldroyd_theta_scheme2.h:47
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
oldroyd_cavity.h
The Oldroyd problem on the driven cavity benchmark – boundary conditions.
rheolef::derr
odiststream derr(cerr)
see the diststream page for the full documentation
Definition: diststream.h:436
Float
see the Float page for the full documentation
branch
see the branch page for the full documentation
main
int main(int argc, char **argv)
Definition: oldroyd_cavity.cc:30
oldroyd_theta_scheme::We
Float We
Definition: oldroyd_theta_scheme.h:42
rheolef::dout
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
oldroyd_theta_scheme::a
Float a
Definition: oldroyd_theta_scheme.h:42
rheolef::std
Definition: vec_expr_v2.h:402
geo
see the geo page for the full documentation