Rheolef  7.1
an efficient C++ finite element environment
contraction.h

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" + itos(Xh.degree());
space Wh (omega["upstream"], approx);
field uh (Xh, 0.);
uh[0]["upstream"] = 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"] = interpolate (Wh, psi_up);
psi_h["wall"] = 0;
psi_h["axis"] = -1;
return psi_h;
}
};
contraction::streamf_field
static field streamf_field(space Ph)
Definition: contraction.h:75
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::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::umax
Float umax
Definition: contraction.h:33
contraction::u_upstream::operator()
Float operator()(const point &x) const
Definition: contraction.h:38