Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
contraction.h

The contraction geometry: boundary conditions.

The contraction geometry: boundary conditions

struct contraction {
struct base {
base (geo omega) : c(0), umax(0), cartesian(true) {
c = omega.xmax()[1];
string sys_coord = omega.coordinate_system_name();
cartesian = (sys_coord == "cartesian");
umax = cartesian ? 3/(2*c) : 4/sqr(c);
}
bool cartesian;
};
struct u_upstream: base {
u_upstream (geo omega) : base(omega) {}
Float operator() (const point& x) const {
return base::umax*(1-sqr(x[1]/base::c)); }
};
static space velocity_space (geo omega, string approx) {
space Xh (omega, approx, "vector");
Xh.block ("wall");
Xh.block ("upstream");
Xh[1].block ("axis");
Xh[1].block ("downstream");
return Xh;
}
static field velocity_field (space Xh) {
geo omega = Xh.get_geo();
string approx = "P" + to_string(Xh.degree());
space Wh (omega["upstream"], approx);
field uh (Xh, 0.);
uh[0]["upstream"] = lazy_interpolate (Wh, u_upstream(omega));
return uh;
}
static space streamf_space (geo omega, string approx) {
space Ph (omega, approx);
Ph.block("upstream");
Ph.block("wall");
Ph.block("axis");
return Ph;
}
struct psi_upstream: base {
psi_upstream (geo omega) : base(omega) {}
Float operator() (const point& x) const {
Float y = (x[1]/base::c);
return (base::umax*base::c)*(y*(1-sqr(y)/3) - 2./3);
} else {
return 0.5*(base::umax*sqr(base::c))*(sqr(y)*(1-sqr(y)/2) - 0.5);
}
}
};
static field streamf_field (space Ph) {
geo omega = Ph.get_geo();
space Wh (omega["upstream"], Ph.get_approx());
field psi_h (Ph, 0);
psi_upstream psi_up (omega);
psi_h["upstream"] = lazy_interpolate (Wh, psi_up);
psi_h["wall"] = 0;
psi_h["axis"] = -1;
return psi_h;
}
};
see the Float page for the full documentation
see the field page for the full documentation
see the geo page for the full documentation
see the point page for the full documentation
see the space page for the full documentation
Float operator()(const point &x) const
Definition contraction.h:66
Float operator()(const point &x) const
Definition contraction.h:38
static field streamf_field(space Ph)
Definition contraction.h:75
static space velocity_space(geo omega, string approx)
Definition contraction.h:41
static space streamf_space(geo omega, string approx)
Definition contraction.h:57
static field velocity_field(space Xh)
Definition contraction.h:49