pub enum Flow {
PrescribedUniform {
velocity_m_s: [f64; 3],
},
Laminar {
initial_velocity_m_s: [f64; 3],
viscosity_m2_s: f64,
acceleration_m_s2: [f64; 3],
},
NeutralRans {
speed_m_s: f64,
reference_height_m: f64,
roughness_m: f64,
direction_deg_from: f64,
viscosity_m2_s: f64,
turbulent_schmidt: f64,
},
}Expand description
Flow model, selected by kind: prescribed_uniform (a fixed uniform
velocity; only the constituents are solved), laminar (incompressible
flow with constant viscosity) or neutral_rans (a neutral atmospheric
boundary layer with the k-epsilon model). The numeric fields are checked
as CFD-E012.
Variants§
PrescribedUniform
A fixed uniform velocity with no flow solve. Its normal component must be zero at impermeable boundaries (CFD-E024), and solid boxes are not allowed (CFD-E013).
Laminar
Incompressible laminar flow with constant kinematic viscosity, started from a uniform velocity.
Fields
NeutralRans
Neutral atmospheric boundary layer with the k-epsilon model (C_mu 0.09,
C_epsilon1 1.44, C_epsilon2 1.92, kappa 0.4). Inflow and initial fields
are the logarithmic equilibrium profiles U = u*/kappa ln((z + z0)/z0),
k = u*^2/sqrt(C_mu) and epsilon = u*^3/(kappa (z + z0)), with u* set by
speed_m_s at reference_height_m. Requires boundaries.z = ground_open_top (CFD-E011).
Fields
speed_m_s: f64Mean wind speed at reference_height_m in m/s, finite and
positive. It is also the velocity scale of the normalized checks.
reference_height_m: f64Height of speed_m_s above the ground in meters, positive and not
above the domain top. It is also the length scale of the
normalized checks.
roughness_m: f64Aerodynamic roughness length z0 of the ground in meters, positive. Building and other wall faces use min(z0, 0.001 cell width), which ties that wall roughness to the grid (see the flow model card).
direction_deg_from: f64Meteorological wind direction in degrees: where the wind blows from, clockwise from north. 270 blows toward +x (east), 180 toward +y (north). Finite; any value is accepted.
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn prescribed(&self) -> bool
pub fn prescribed(&self) -> bool
True for prescribed_uniform, whose velocity stays fixed: no
momentum or pressure equations are solved.
Sourcepub fn viscosity(&self) -> f64
pub fn viscosity(&self) -> f64
Molecular kinematic viscosity in m2/s; zero for prescribed flow.
Sourcepub fn vector(&self, z: f64) -> [f64; 3]
pub fn vector(&self, z: f64) -> [f64; 3]
The case’s reference velocity at height z (meters), in m/s: the
prescribed velocity, the laminar initial velocity, or the logarithmic
neutral_rans profile in the wind direction (negative heights are
evaluated at the ground).
It initializes the face velocities, sets the velocity of open inlet
faces and decides whether an open face is an inlet, an outlet or a
slip face.
use cfd_craft::case::Flow;
let flow: Flow = serde_json::from_str(
r#"{"kind": "neutral_rans", "speed_m_s": 3.0, "reference_height_m": 10.0,
"roughness_m": 0.1, "direction_deg_from": 270.0,
"viscosity_m2_s": 1.5e-5, "turbulent_schmidt": 0.7}"#,
)
.unwrap();
let [u, v, w] = flow.vector(10.0);
// A wind from the west blows toward +x, at the declared reference speed.
assert!((u - 3.0).abs() < 1e-12 && v.abs() < 1e-12 && w == 0.0);
assert!(flow.vector(1.0)[0] < u);Sourcepub fn reference_speed(&self) -> f64
pub fn reference_speed(&self) -> f64
Velocity scale of the normalized checks and divergence limits, in m/s:
speed_m_s for neutral_rans, otherwise the magnitude of
vector at z = 1 m, but at least 1 m/s.
Sourcepub fn ustar(&self) -> f64
pub fn ustar(&self) -> f64
Friction velocity of the neutral_rans inflow profile in m/s,
u* = kappa speed / ln((z_ref + z0)/z0) with kappa = 0.4; zero for the
other flow models.
Sourcepub fn turbulence(&self, z: f64) -> (f64, f64)
pub fn turbulence(&self, z: f64) -> (f64, f64)
Equilibrium (k, epsilon) of the neutral_rans inflow at height z
(meters): k = u*^2/sqrt(C_mu) in m2/s2 and epsilon = u*^3/(kappa (z +
z0)) in m2/s3. (0, 0) for the other flow models. These values
initialize the fields and set the inlet and top values.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Flow
impl<'de> Deserialize<'de> for Flow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Flow
impl JsonSchema for Flow
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Forget for Flow
impl Freeze for Flow
impl Move for Flow
impl RefUnwindSafe for Flow
impl Send for Flow
impl Sync for Flow
impl Unpin for Flow
impl UnsafeUnpin for Flow
impl UnwindSafe for Flow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more