Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Phyth::Mechanics::VolumeForce Class Reference

Uniform body force distributed over a rectangular box. More...

#include <VolumeForce.hpp>

Inheritance diagram for Phyth::Mechanics::VolumeForce:
Inheritance graph
[legend]
Collaboration diagram for Phyth::Mechanics::VolumeForce:
Collaboration graph
[legend]

Public Member Functions

 VolumeForce (const Vector3< Quantity< Meter > > &center, const Quantity< Meter > width, const Quantity< Meter > height, const Quantity< Meter > depth, const Vector3< Quantity< NewtonPerMeterCubed > > &force_density, const IsotropicMaterial &material) noexcept
 Construct a rectangular volume force.
 
Matrix3x3< Quantity< Pascal > > GetStressAt (const Vector3< Quantity< Meter > > &point) const override
 Compute stress tensor at a point using numerical integration.
 
Vector3< Quantity< Newton > > GetForceAt (const Vector3< Quantity< Meter > > &point) const override
 Get the force vector at a point.
 
Vector3< Quantity< Newton > > GetTotalForce () const override
 Get the total force of this source.
 
Vector3< Quantity< NewtonPerMeterCubed > > GetBodyForceDensityAt (const Vector3< Quantity< Meter > > &point) const override
 Get the body force density at a point.
 
Quantity< Meter > GetMinimumDistanceTo (const Vector3< Quantity< Meter > > &point) const override
 Get the minimum distance from a point to the rectangular volume.
 
Vector3< Quantity< NewtonPerMeterCubed > > GetForceDensity () const
 Get the force density vector.
 
void SetForceDensity (const Vector3< Quantity< NewtonPerMeterCubed > > &force_density)
 Set the force density vector.
 
- Public Member Functions inherited from Phyth::Mechanics::ForceSource
virtual ~ForceSource ()=default
 

Private Member Functions

Matrix3x3< Quantity< Pascal > > NumericalIntegrateStress (const Vector3< Quantity< Meter > > &point, const int nx, const int ny, const int nz) const
 Numerical integration of stress over the volume.
 

Private Attributes

Vector3< Quantity< Meter > > center_
 
Quantity< Meter > width_
 
Quantity< Meter > height_
 
Quantity< Meter > depth_
 
Vector3< Quantity< NewtonPerMeterCubed > > force_density_
 
IsotropicMaterial material_
 

Detailed Description

Uniform body force distributed over a rectangular box.

VolumeForce represents a body force density acting throughout a rectangular volume. The stress field is computed by numerical integration using the midpoint rule with configurable resolution.

Example:

auto stress = volume.GetStressAt(point);
Uniform body force distributed over a rectangular box.
constexpr bool is_unit_v
Definition Unit.hpp:79
3D vector with Quantity components
Definition Vector3.hpp:28

Definition at line 24 of file VolumeForce.hpp.

Constructor & Destructor Documentation

◆ VolumeForce()

Phyth::Mechanics::VolumeForce::VolumeForce ( const Vector3< Quantity< Meter > > &  center,
const Quantity< Meter >  width,
const Quantity< Meter >  height,
const Quantity< Meter >  depth,
const Vector3< Quantity< NewtonPerMeterCubed > > &  force_density,
const IsotropicMaterial &  material 
)
inlineexplicitnoexcept

Construct a rectangular volume force.

Parameters
centerCenter of the box
widthExtent along x
heightExtent along y
depthExtent along z
force_densityUniform body force density
materialMaterial properties

Definition at line 36 of file VolumeForce.hpp.

Member Function Documentation

◆ GetBodyForceDensityAt()

Vector3< Quantity< NewtonPerMeterCubed > > Phyth::Mechanics::VolumeForce::GetBodyForceDensityAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the body force density at a point.

Parameters
pointPosition to evaluate
Returns
Body force density at that point

Reimplemented from Phyth::Mechanics::ForceSource.

Definition at line 90 of file VolumeForce.hpp.

◆ GetForceAt()

Vector3< Quantity< Newton > > Phyth::Mechanics::VolumeForce::GetForceAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the force vector at a point.

Volume force is distributed, so returns zero at any single point.

Implements Phyth::Mechanics::ForceSource.

Definition at line 69 of file VolumeForce.hpp.

◆ GetForceDensity()

Vector3< Quantity< NewtonPerMeterCubed > > Phyth::Mechanics::VolumeForce::GetForceDensity ( ) const
inline

Get the force density vector.

Definition at line 130 of file VolumeForce.hpp.

◆ GetMinimumDistanceTo()

Quantity< Meter > Phyth::Mechanics::VolumeForce::GetMinimumDistanceTo ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the minimum distance from a point to the rectangular volume.

Parameters
pointPosition to compute distance from
Returns
Distance to the closest point in the volume

Implements Phyth::Mechanics::ForceSource.

Definition at line 111 of file VolumeForce.hpp.

◆ GetStressAt()

Matrix3x3< Quantity< Pascal > > Phyth::Mechanics::VolumeForce::GetStressAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Compute stress tensor at a point using numerical integration.

Parameters
pointPosition to evaluate
Returns
Stress tensor in pascals

Implements Phyth::Mechanics::ForceSource.

Definition at line 58 of file VolumeForce.hpp.

◆ GetTotalForce()

Vector3< Quantity< Newton > > Phyth::Mechanics::VolumeForce::GetTotalForce ( ) const
inlineoverridevirtual

Get the total force of this source.

Returns
force_density * volume (Newtons)

Implements Phyth::Mechanics::ForceSource.

Definition at line 80 of file VolumeForce.hpp.

◆ NumericalIntegrateStress()

Matrix3x3< Quantity< Pascal > > Phyth::Mechanics::VolumeForce::NumericalIntegrateStress ( const Vector3< Quantity< Meter > > &  point,
const int  nx,
const int  ny,
const int  nz 
) const
inlineprivate

Numerical integration of stress over the volume.

Uses the midpoint rule with nx * ny * nz segments. Each voxel contributes dsigma = Kelvin(dF) where dF = force_density * dV.

Definition at line 153 of file VolumeForce.hpp.

◆ SetForceDensity()

void Phyth::Mechanics::VolumeForce::SetForceDensity ( const Vector3< Quantity< NewtonPerMeterCubed > > &  force_density)
inline

Set the force density vector.

Definition at line 137 of file VolumeForce.hpp.

Member Data Documentation

◆ center_

Vector3<Quantity<Meter> > Phyth::Mechanics::VolumeForce::center_
private

Definition at line 142 of file VolumeForce.hpp.

◆ depth_

Quantity<Meter> Phyth::Mechanics::VolumeForce::depth_
private

Definition at line 143 of file VolumeForce.hpp.

◆ force_density_

Vector3<Quantity<NewtonPerMeterCubed> > Phyth::Mechanics::VolumeForce::force_density_
private

Definition at line 144 of file VolumeForce.hpp.

◆ height_

Quantity<Meter> Phyth::Mechanics::VolumeForce::height_
private

Definition at line 143 of file VolumeForce.hpp.

◆ material_

IsotropicMaterial Phyth::Mechanics::VolumeForce::material_
private

Definition at line 145 of file VolumeForce.hpp.

◆ width_

Quantity<Meter> Phyth::Mechanics::VolumeForce::width_
private

Definition at line 143 of file VolumeForce.hpp.


The documentation for this class was generated from the following file: