Rheolef  7.1
an efficient C++ finite element environment
contraction.h
Go to the documentation of this file.
1 struct contraction {
26  struct base {
27  base (geo omega) : c(0), umax(0), cartesian(true) {
28  c = omega.xmax()[1];
29  string sys_coord = omega.coordinate_system_name();
30  cartesian = (sys_coord == "cartesian");
31  umax = cartesian ? 3/(2*c) : 4/sqr(c);
32  }
34  bool cartesian;
35  };
36  struct u_upstream: base {
37  u_upstream (geo omega) : base(omega) {}
38  Float operator() (const point& x) const {
39  return base::umax*(1-sqr(x[1]/base::c)); }
40  };
41  static space velocity_space (geo omega, string approx) {
42  space Xh (omega, approx, "vector");
43  Xh.block ("wall");
44  Xh.block ("upstream");
45  Xh[1].block ("axis");
46  Xh[1].block ("downstream");
47  return Xh;
48  }
49  static field velocity_field (space Xh) {
50  geo omega = Xh.get_geo();
51  string approx = "P" + itos(Xh.degree());
52  space Wh (omega["upstream"], approx);
53  field uh (Xh, 0.);
54  uh[0]["upstream"] = interpolate (Wh, u_upstream(omega));
55  return uh;
56  }
57  static space streamf_space (geo omega, string approx) {
58  space Ph (omega, approx);
59  Ph.block("upstream");
60  Ph.block("wall");
61  Ph.block("axis");
62  return Ph;
63  }
64  struct psi_upstream: base {
65  psi_upstream (geo omega) : base(omega) {}
66  Float operator() (const point& x) const {
67  Float y = (x[1]/base::c);
68  if (base::cartesian) {
69  return (base::umax*base::c)*(y*(1-sqr(y)/3) - 2./3);
70  } else {
71  return 0.5*(base::umax*sqr(base::c))*(sqr(y)*(1-sqr(y)/2) - 0.5);
72  }
73  }
74  };
75  static field streamf_field (space Ph) {
76  geo omega = Ph.get_geo();
77  space Wh (omega["upstream"], Ph.get_approx());
78  field psi_h (Ph, 0);
79  psi_upstream psi_up (omega);
80  psi_h["upstream"] = interpolate (Wh, psi_up);
81  psi_h["wall"] = 0;
82  psi_h["axis"] = -1;
83  return psi_h;
84  }
85 };
contraction::streamf_field
static field streamf_field(space Ph)
Definition: contraction.h:75
contraction::psi_upstream
Definition: contraction.h:64
field
see the field page for the full documentation
contraction::base::base
base(geo omega)
Definition: contraction.h:27
space
see the space page for the full documentation
contraction::psi_upstream::operator()
Float operator()(const point &x) const
Definition: contraction.h:66
contraction::velocity_field
static field velocity_field(space Xh)
Definition: contraction.h:49
contraction::streamf_space
static space streamf_space(geo omega, string approx)
Definition: contraction.h:57
contraction
Definition: contraction.h:25
contraction::velocity_space
static space velocity_space(geo omega, string approx)
Definition: contraction.h:41
contraction::u_upstream::u_upstream
u_upstream(geo omega)
Definition: contraction.h:37
contraction::base::c
Float c
Definition: contraction.h:33
contraction::psi_upstream::psi_upstream
psi_upstream(geo omega)
Definition: contraction.h:65
rheolef::interpolate
field_basic< T, M > interpolate(const space_basic< T, M > &V2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition: interpolate.cc:233
Float
see the Float page for the full documentation
point
see the point page for the full documentation
mkgeo_grid.sys_coord
sys_coord
Definition: mkgeo_grid.sh:171
contraction::u_upstream
Definition: contraction.h:36
contraction::base::cartesian
bool cartesian
Definition: contraction.h:34
rheolef::itos
std::string itos(std::string::size_type i)
itos: see the rheostream page for the full documentation
geo
see the geo page for the full documentation
contraction::base
Definition: contraction.h:26
contraction::base::umax
Float umax
Definition: contraction.h:33
contraction::u_upstream::operator()
Float operator()(const point &x) const
Definition: contraction.h:38