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);
}
Float c, umax;
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);
if (base::cartesian) {
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;
}
};
Float
see the Float page for the full documentation
field
see the field page for the full documentation
geo
see the geo page for the full documentation
point
see the point page for the full documentation
space
see the space page for the full documentation
contraction::base::umax
Float umax
Definition contraction.h:33
contraction::base::c
Float c
Definition contraction.h:33
contraction::base::cartesian
bool cartesian
Definition contraction.h:34
contraction::psi_upstream::operator()
Float operator()(const point &x) const
Definition contraction.h:66
contraction::u_upstream::operator()
Float operator()(const point &x) const
Definition contraction.h:38
contraction
Definition contraction.h:25
contraction::streamf_field
static field streamf_field(space Ph)
Definition contraction.h:75
contraction::velocity_space
static space velocity_space(geo omega, string approx)
Definition contraction.h:41
contraction::streamf_space
static space streamf_space(geo omega, string approx)
Definition contraction.h:57
contraction::velocity_field
static field velocity_field(space Xh)
Definition contraction.h:49