pub enum Source {
Point {
id: String,
constituent: String,
point_m: [f64; 3],
rate_kg_s: f64,
},
Line {
id: String,
constituent: String,
from_m: [f64; 3],
to_m: [f64; 3],
rate_kg_s_m: f64,
},
Volume {
id: String,
constituent: String,
min_m: [f64; 3],
max_m: [f64; 3],
rate_kg_s_m3: f64,
},
}Expand description
A continuous emission into one constituent, selected by kind. Rates are
finite and nonnegative (CFD-E016); the support is nondegenerate and inside
the domain (CFD-E017). The integrated rate is distributed over the cells
the support covers. Support touching a solid cell is rejected (CFD-E040),
as is a steady source in a fluid region without an outlet (CFD-E043, and
CFD-E020 when no boundary is open).
Variants§
Point
A point emission, deposited in the cell that contains the point.
Fields
Line
A straight line emission. The integrated rate is rate_kg_s_m times
the line length, distributed over the cells the segment crosses in
proportion to its length in each.
Fields
Volume
A uniform emission over a box. The integrated rate is rate_kg_s_m3
times the box volume, distributed over the cells by their exact overlap
with the box.
Fields
Implementations§
Source§impl Source
impl Source
Sourcepub fn constituent(&self) -> &str
pub fn constituent(&self) -> &str
ID of the constituent the source emits.
Sourcepub fn declared_rate(&self) -> (&'static str, f64)
pub fn declared_rate(&self) -> (&'static str, f64)
The rate field as declared, with its name (per second, per meter or per cubic meter).
Sourcepub fn rate(&self) -> f64
pub fn rate(&self) -> f64
Integrated emission rate in kg/s: rate_kg_s, rate_kg_s_m times the
line length, or rate_kg_s_m3 times the box volume. The represented
source fields emit exactly this rate.
use cfd_craft::case::Source;
let line: Source = serde_json::from_str(
r#"{"kind": "line", "id": "road", "constituent": "tracer",
"from_m": [1.0, 1.0, 2.0], "to_m": [1.0, 6.0, 2.0], "rate_kg_s_m": 2e-8}"#,
)
.unwrap();
// 2e-8 kg/s per meter over 5 m.
assert!((line.rate() - 1e-7).abs() < 1e-20);
assert_eq!(line.declared_rate(), ("rate_kg_s_m", 2e-8));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
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 Source
impl JsonSchema for Source
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 Source
impl Freeze for Source
impl Move for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnsafeUnpin for Source
impl UnwindSafe for Source
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