Skip to main content

SurfaceField

Struct SurfaceField 

Source
pub struct SurfaceField<T: Clone> {
    pub name: String,
    pub mesh: Arc<FvMesh>,
    pub internal: Field<T>,
    pub boundary: Vec<PatchField<T>>,
}
Expand description

A surface field: one value per internal face in the internal field, plus one PatchField per boundary patch.

Mirrors Foam::surfaceScalarField / Foam::SurfaceField<Type>.

§Why internal has length n_internal_faces, not n_faces

In OpenFOAM, surfaceScalarField.internalField() only covers the internal faces; boundary-face values live in boundaryField()[patch]. This matches the LDU matrix structure: lower and upper arrays have length n_internal_faces.

Fields§

§name: String

Field name (diagnostic label, e.g. "phi").

§mesh: Arc<FvMesh>

Mesh this field is defined on.

§internal: Field<T>

Face values for all internal faces; length == mesh.n_internal_faces.

§boundary: Vec<PatchField<T>>

One entry per boundary patch; boundary[i].values has length mesh.patches[i].size.

Implementations§

Source§

impl<T: Clone> SurfaceField<T>

Source

pub fn new( name: impl Into<String>, mesh: Arc<FvMesh>, internal: Field<T>, boundary: Vec<PatchField<T>>, ) -> Self

Assemble a surface field from its internal-face values and per-patch boundary fields. In debug builds, asserts that internal has length mesh.n_internal_faces and that boundary has one entry per patch.

Source§

impl SurfaceField<f64>

Source

pub fn zeros(name: impl Into<String>, mesh: Arc<FvMesh>) -> Self

Scalar surface field with all internal-face values zero and zero-gradient boundary patches.

Source

pub fn uniform(name: impl Into<String>, mesh: Arc<FvMesh>, value: f64) -> Self

Scalar surface field with all internal-face values set to value and zero-gradient boundary patches.

Source§

impl SurfaceField<Vector3>

Source

pub fn zero(name: impl Into<String>, mesh: Arc<FvMesh>) -> Self

Vector surface field with all internal-face values zero and zero-gradient boundary patches.

Source§

impl<T: Clone + Default> SurfaceField<T>

Source

pub fn face_value(&self, f: usize) -> T

Value at any face: internal face → from internal; boundary face → from the appropriate patch’s values.

Trait Implementations§

Source§

impl<T> Add for SurfaceField<T>
where T: Add<Output = T> + Clone + Default,

Source§

type Output = SurfaceField<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: Clone + Clone> Clone for SurfaceField<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Clone> Debug for SurfaceField<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div<f64> for SurfaceField<T>
where T: Mul<f64, Output = T> + Clone,

Source§

type Output = SurfaceField<T>

The resulting type after applying the / operator.
Source§

fn div(self, s: f64) -> Self

Performs the / operation. Read more
Source§

impl<T: Mul<f64, Output = T> + Clone> Mul<SurfaceField<T>> for f64

Source§

type Output = SurfaceField<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SurfaceField<T>) -> SurfaceField<T>

Performs the * operation. Read more
Source§

impl<T> Mul<f64> for SurfaceField<T>
where T: Mul<f64, Output = T> + Clone,

Source§

type Output = SurfaceField<T>

The resulting type after applying the * operator.
Source§

fn mul(self, s: f64) -> Self

Performs the * operation. Read more
Source§

impl<T> Neg for SurfaceField<T>
where T: Neg<Output = T> + Clone,

Source§

type Output = SurfaceField<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T> Sub for SurfaceField<T>
where T: Sub<Output = T> + Clone + Default,

Source§

type Output = SurfaceField<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for SurfaceField<T>
where Field<T>: Freeze, Vec<PatchField<T>>: Freeze,

§

impl<T> RefUnwindSafe for SurfaceField<T>

§

impl<T> Send for SurfaceField<T>
where Field<T>: Send, Vec<PatchField<T>>: Send,

§

impl<T> Sync for SurfaceField<T>
where Field<T>: Sync, Vec<PatchField<T>>: Sync,

§

impl<T> Unpin for SurfaceField<T>
where Field<T>: Unpin, Vec<PatchField<T>>: Unpin,

§

impl<T> UnsafeUnpin for SurfaceField<T>

§

impl<T> UnwindSafe for SurfaceField<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.