MDStressLab++
Loading...
Searching...
No Matches
Stress< TMethod, stressType, TGrid > Class Template Reference

Three-dimensional stress field on a grid. More...

#include <Stress.h>

Collaboration diagram for Stress< TMethod, stressType, TGrid >:

Public Member Functions

 Stress (std::string name, const Method< TMethod > &method, TGrid *pgrid)
 Constructs a Stress object.
 
 Stress (const Method< TMethod > &method, TGrid *pgrid)
 Constructs a Stress object.
 
void write ()
 Write stress and, for Cauchy stress, density fields.
 
void write (const std::string &filename)
 
void write_voxel_grid (const int nx, const int ny, const int nz, const Vector3d &lowerLimit, const Vector3d &upperLimit)
 Write structured grid fields in LAMMPS dump-grid format.
 
void write_voxel_grid (const std::string &filename, const int nx, const int ny, const int nz, const Vector3d &lowerLimit, const Vector3d &upperLimit)
 
 ~Stress ()
 

Public Attributes

std::vector< Matrix3dfield
 A three-dimensional stress field.
 
std::vector< Vector3dmomentumDensityField
 Cauchy-grid momentum density \(\mathbf p(\mathbf x)\).
 
std::vector< double > massDensityField
 Cauchy-grid mass density \(\rho(\mathbf x)\).
 
std::vector< Vector3dvelocityField
 Internal Cauchy-grid continuum velocity.
 
TGrid * pgrid
 Pointer to the Grid on which the stress field is defined.
 
const Method< TMethod > & method
 The method used to compute the stress field. The Method object provides details about the weighting function and its support (averaging domain) and includes the bond function to compute the stress field.
 
std::string name
 The prefix of the filename that will be outputted when the stress field is written.
 

Detailed Description

template<typename TMethod, StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
class Stress< TMethod, stressType, TGrid >

Three-dimensional stress field on a grid.

The stress field is computed using a prescribed averaging method. For Cauchy stresses, the object also stores continuum momentum density, mass density, and the internal continuum velocity used to form the kinetic stress from relative velocities. These continuum fields are not defined for Piola stresses; the kinetic contribution to Piola stress is taken to be zero.

Template Parameters
TMethod- Method template parameter. For example, TMethod=MethodSphere for a spherical averaging domain and TMethod=MethodLDAD for LDAD. For a user-defined averaging domain, TMethod=MethodUser
stressType- Piola or Cauchy
TGrid- pointer to Grid<Reference> or Grid<Current> depending on whether stressType is Piola or Cauchy, respectively
Examples
crack/main.cpp, testIdealGas.cpp, testLDADLJ.cpp, testLDADSWTriclinic.cpp, testLJ.cpp, and testMls.cpp.

Definition at line 42 of file Stress.h.

Constructor & Destructor Documentation

◆ Stress() [1/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
Stress< TMethod, stressType, TGrid >::Stress ( std::string  name,
const Method< TMethod > &  method,
TGrid *  pgrid 
)
inline

Constructs a Stress object.

Definition at line 93 of file Stress.h.

◆ Stress() [2/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
Stress< TMethod, stressType, TGrid >::Stress ( const Method< TMethod > &  method,
TGrid *  pgrid 
)
inline

Constructs a Stress object.

Definition at line 111 of file Stress.h.

◆ ~Stress()

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
Stress< TMethod, stressType, TGrid >::~Stress ( )
inline

Definition at line 283 of file Stress.h.

Member Function Documentation

◆ write() [1/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
void Stress< TMethod, stressType, TGrid >::write ( )
inline

Write stress and, for Cauchy stress, density fields.

This function writes the stress field to [name].stress. The stress file is OVITO-readable and contains nine columns: grid coordinates followed by \(\sigma_{xx}\), \(\sigma_{yy}\), \(\sigma_{zz}\), \(\sigma_{xy}\), \(\sigma_{xz}\), and \(\sigma_{yz}\).

For Cauchy stress objects, two additional OVITO-readable files are written:

  • [name].momentum_density, with grid coordinates and \(\mathbf p(\mathbf x)\).
  • [name].mass_density, with grid coordinates and \(\rho(\mathbf x)\).

The continuum velocity field is an internal intermediate and is not written.

Use write_voxel_grid() for optional structured-grid output in LAMMPS dump-grid format.

Examples
crack/main.cpp, testLDADLJ.cpp, and testLJ.cpp.

Definition at line 146 of file Stress.h.

◆ write() [2/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
void Stress< TMethod, stressType, TGrid >::write ( const std::string &  filename)
inline

Definition at line 198 of file Stress.h.

◆ write_voxel_grid() [1/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
void Stress< TMethod, stressType, TGrid >::write_voxel_grid ( const int  nx,
const int  ny,
const int  nz,
const Vector3d lowerLimit,
const Vector3d upperLimit 
)
inline

Write structured grid fields in LAMMPS dump-grid format.

This output is intended for direct visualization of structured stress grids in OVITO. The caller must provide the grid dimensions and orthogonal bounding box used to create the grid. The grid dimensions are checked against field.size() before writing.

The dump-grid DIMENSION is inferred from the number of grid counts greater than one. Bounds are shifted by half a grid spacing along active directions so that voxel cell centers coincide with the MDStressLab grid coordinates; inactive directions are written as a collapsed plane.

The stress tensor is written to [name].voxel_grid_stress with component order SXX SYY SZZ SYZ SXZ SXY, matching LAMMPS/OVITO dump-grid conventions. For Cauchy stress objects, this function also writes [name].voxel_grid_momentum_density and [name].voxel_grid_mass_density.

The values are written in the same order as pgrid->coordinates.

Definition at line 227 of file Stress.h.

◆ write_voxel_grid() [2/2]

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
void Stress< TMethod, stressType, TGrid >::write_voxel_grid ( const std::string &  filename,
const int  nx,
const int  ny,
const int  nz,
const Vector3d lowerLimit,
const Vector3d upperLimit 
)
inline

Definition at line 269 of file Stress.h.

Member Data Documentation

◆ field

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
std::vector<Matrix3d> Stress< TMethod, stressType, TGrid >::field

A three-dimensional stress field.

Examples
testIdealGas.cpp, testLDADSWTriclinic.cpp, and testMls.cpp.

Definition at line 47 of file Stress.h.

◆ massDensityField

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
std::vector<double> Stress< TMethod, stressType, TGrid >::massDensityField

Cauchy-grid mass density \(\rho(\mathbf x)\).

Computed as \(\sum_i m_i w(\mathbf x-\mathbf x_i)\) by calculateKineticStress(). Empty for Piola stress objects.

Examples
testIdealGas.cpp.

Definition at line 61 of file Stress.h.

◆ method

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
const Method<TMethod>& Stress< TMethod, stressType, TGrid >::method

The method used to compute the stress field. The Method object provides details about the weighting function and its support (averaging domain) and includes the bond function to compute the stress field.

Definition at line 82 of file Stress.h.

◆ momentumDensityField

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
std::vector<Vector3d> Stress< TMethod, stressType, TGrid >::momentumDensityField

Cauchy-grid momentum density \(\mathbf p(\mathbf x)\).

Computed as \(\sum_i m_i \mathbf v_i w(\mathbf x-\mathbf x_i)\) by calculateKineticStress(). Empty for Piola stress objects.

Examples
testIdealGas.cpp.

Definition at line 54 of file Stress.h.

◆ name

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
std::string Stress< TMethod, stressType, TGrid >::name

The prefix of the filename that will be outputted when the stress field is written.

Examples
testIdealGas.cpp.

Definition at line 88 of file Stress.h.

◆ pgrid

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
TGrid* Stress< TMethod, stressType, TGrid >::pgrid

Pointer to the Grid on which the stress field is defined.

Definition at line 75 of file Stress.h.

◆ velocityField

template<typename TMethod , StressType stressType, typename TGrid = typename std::conditional<stressType==Piola,Grid<Reference>,Grid<Current>>::type>
std::vector<Vector3d> Stress< TMethod, stressType, TGrid >::velocityField

Internal Cauchy-grid continuum velocity.

This is \(\mathbf v(\mathbf x)=\mathbf p(\mathbf x)/\rho(\mathbf x)\) where \(\rho>0\), and zero otherwise. It is used internally to form the kinetic Cauchy stress from relative velocities and is not written by write().

Examples
testIdealGas.cpp.

Definition at line 70 of file Stress.h.


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