Description

Physical system for fluid-solid interaction problems.

This class is used to represent fluid-solid interaction problems consisting of fluid dynamics and multibody system. Each of the two underlying physics is an independent object owned and instantiated by this class. The FSI system owns other objects to handle the interface between the two systems, boundary condition enforcing markers, and data.

#include <ChSystemFsi.h>

Classes

struct  ElasticMaterialProperties
 Structure with elastic material properties. More...
 

Public Types

enum  OutpuMode { OutpuMode::CSV, OutpuMode::CHPF, OutpuMode::NONE }
 Output mode. More...
 

Public Member Functions

 ChSystemFsi (ChSystem *sysMBS=nullptr)
 Constructor for FSI system.
 
 ~ChSystemFsi ()
 Destructor for the FSI system.
 
void DoStepDynamics_FSI ()
 Function to integrate the FSI system in time. More...
 
void SetVerbose (bool m_verbose)
 Enable/disable m_verbose terminal output.
 
void ReadParametersFromFile (const std::string &json_file)
 Read Chrono::FSI parameters from the specified JSON file.
 
void SetInitialSpacing (double spacing)
 Set initial spacing.
 
void SetKernelLength (double length)
 Set SPH kernel length.
 
void SetContainerDim (const ChVector<> &boxDim)
 Set the fluid container dimension.
 
void SetBoundaries (const ChVector<> &cMin, const ChVector<> &cMax)
 Set periodic boundary condition for fluid.
 
void SetActiveDomain (const ChVector<> &boxDim)
 Set size of active domain.
 
void SetNumBoundaryLayers (int num_layers)
 Set number of boundary layers (default: 3).
 
void SetDensity (double rho0)
 Set (initial) density.
 
void SetInitPressure (const double fzDim)
 Set prescribed initial pressure for gravity field.
 
void Set_G_acc (const ChVector<> &gravity)
 Set gravity for the FSI syatem.
 
void SetBodyForce (const ChVector<> &force)
 Set a constant force applied to the fluid. More...
 
void SetStepSize (double dT, double dT_Flex=0)
 Set FSI integration step size.
 
void SetMaxStepSize (double dT_max)
 Set the maximum allowable integration step size.
 
void SetAdaptiveTimeStepping (bool adaptive)
 Enable/disable adaptive time stepping.
 
void SetSPHintegration (bool runSPH)
 Enable/disable SPH integration.
 
void SetDiscreType (bool useGmatrix, bool useLmatrix)
 Set SPH discretization type, consistent or inconsistent.
 
void SetWallBC (BceVersion wallBC)
 Set wall boundary condition.
 
void SetRigidBodyBC (BceVersion rigidBodyBC)
 Set rigid body boundary condition.
 
void SetCohesionForce (double Fc)
 Set cohesion force of the granular material.
 
void SetSPHLinearSolver (SolverType lin_solver)
 Set the linear system solver for implicit methods.
 
void SetSPHMethod (FluidDynamics SPH_method, SolverType lin_solver=SolverType::BICGSTAB)
 Set the SPH method and, optionally, the linear solver type.
 
void SetElasticSPH (const ElasticMaterialProperties mat_props)
 Enable solution of elastic SPH (for continuum representation of granular dynamics). More...
 
void SetOutputLength (int OutputLength)
 Set simulation data output length.
 
void SetParticleOutputMode (OutpuMode mode)
 Set the FSI system output mode (default: NONE).
 
double GetKernelLength () const
 Return the SPH kernel length of kernel function.
 
double GetInitialSpacing () const
 Return the initial spacing of the SPH particles.
 
ChVector GetContainerDim () const
 Set the fluid container dimension.
 
double GetDensity () const
 Return density.
 
double GetViscosity () const
 Return viscosity.
 
double GetParticleMass () const
 Return SPH particle mass.
 
double GetBasePressure () const
 Return base pressure.
 
ChVector Get_G_acc () const
 Return gravitational acceleration.
 
double GetSoundSpeed () const
 Return the speed of sound in the fluid phase.
 
ChVector GetBodyForce () const
 Return the constant force applied to the fluid (if any).
 
double GetStepSize () const
 Return the FSI integration step size.
 
double GetMaxStepSize () const
 Return the current value of the maximum allowable integration step size.
 
bool GetAdaptiveTimeStepping () const
 Return a flag inicating whether adaptive time stepping is enabled.
 
const SimParamsGetParams () const
 Return the current system parameters (debugging only).
 
size_t GetNumFluidMarkers () const
 Get the current number of fluid SPH particles.
 
size_t GetNumBoundaryMarkers () const
 Get the current number of boundary BCE markers.
 
size_t GetNumRigidBodyMarkers () const
 Get the current number of rigid body BCE markers.
 
size_t GetNumFlexBodyMarkers () const
 Get the current number of flexible body BCE markers.
 
double GetSimTime () const
 Get current simulation time.
 
std::vector< ChVector<> > GetParticlePositions () const
 Return the SPH particle positions.
 
std::vector< ChVector<> > GetParticleVelocities () const
 Return the SPH particle velocities.
 
std::vector< ChVector<> > GetParticleForces () const
 Return the forces acting on SPH particles.
 
std::vector< ChVector<> > GetParticleAccelerations () const
 Return the accelerations of SPH particles.
 
std::vector< ChVector<> > GetParticleFluidProperties () const
 Return the SPH particle fluid properties. More...
 
std::vector< std::shared_ptr< ChBody > > & GetFsiBodies () const
 Get a reference to the FSI bodies. More...
 
std::shared_ptr< fea::ChMeshGetFsiMesh () const
 Return the FSI mesh for flexible elements.
 
std::vector< std::shared_ptr< fea::ChNodeFEAxyzD > > & GetFsiNodes () const
 Get a reference to the FSI ChNodeFEAxyzD. More...
 
void AddFsiBody (std::shared_ptr< ChBody > body)
 Add a rigid body to the FsiSystem.
 
void AddFsiMesh (std::shared_ptr< fea::ChMesh > mesh, const std::vector< std::vector< int >> &beam_elements, const std::vector< std::vector< int >> &shell_elements)
 Add an FEA mesh to the FSI system.
 
void Initialize ()
 Complete construction of the FSI system (fluid and BDE objects). More...
 
void WriteParticleFile (const std::string &outfilename) const
 Write FSI system particle output.
 
void PrintParticleToFile (const std::string &dir) const
 Save the SPH particle information into files. More...
 
void PrintFsiInfoToFile (const std::string &dir, double time) const
 Save the FSI information into files. More...
 
void AddSPHParticle (const ChVector<> &point, double rho0, double pres0, double mu0, const ChVector<> &velocity=ChVector<>(0), const ChVector<> &tauXxYyZz=ChVector<>(0), const ChVector<> &tauXyXzYz=ChVector<>(0))
 Add an SPH particle with given properties to the FSI system.
 
void AddSPHParticle (const ChVector<> &point, const ChVector<> &velocity=ChVector<>(0), const ChVector<> &tauXxYyZz=ChVector<>(0), const ChVector<> &tauXyXzYz=ChVector<>(0))
 Add an SPH particle with current properties to the SPH system.
 
void AddBoxSPH (const ChVector<> &boxCenter, const ChVector<> &boxHalfDim)
 Create SPH particles in the specified box volume. More...
 
void AddWallBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, const ChVector2<> size)
 Add BCE markers for a rectangular plate of specified X-Y dimensions and associate them with the given body. More...
 
void AddContainerBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, const ChVector<> &size, const ChVector< int > faces)
 Add BCE markers for a box container of specified dimensions and associate them with the given body. More...
 
void AddBoxBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, const ChVector<> &size, bool solid)
 Add BCE markers for a box of specified dimensions and associate them with the given body. More...
 
void AddSphereBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, double radius, bool solid, bool polar=true)
 Add BCE markers for a sphere of specified radius and associate them with the given body. More...
 
void AddCylinderBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, double radius, double height, bool solid, bool capped=true, bool polar=true)
 Add BCE markers for a cylinder of specified radius and height and associate them with the given body. More...
 
void AddCylinderAnnulusBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, double radius_inner, double radius_outer, double height, bool polar=true)
 Add BCE markers for a cylindrical annulus of specified radii and height and associate them with the given body. More...
 
void AddConeBCE (std::shared_ptr< ChBody > body, const ChFrame<> &frame, double radius, double height, bool solid, bool capped=true, bool polar=true)
 Add BCE markers for a cone of specified radius and height and associate them with the given body. More...
 
void AddPointsBCE (std::shared_ptr< ChBody > body, const std::vector< ChVector<>> &points, const ChFrame<> &frame, bool solid)
 Add BCE markers from a set of points and associate them with the given body. More...
 
void AddFEAmeshBCE (std::shared_ptr< fea::ChMesh > my_mesh, const std::vector< std::vector< int >> &NodeNeighborElement, const std::vector< std::vector< int >> &_1D_elementsNodes, const std::vector< std::vector< int >> &_2D_elementsNodes, bool add1DElem, bool add2DElem, bool multiLayer, bool removeMiddleLayer, int SIDE, int SIZE2D)
 Add BCE markers from mesh. / RADU TODO.
 
thrust::device_vector< int > FindParticlesInBox (const ChFrame<> &frame, const ChVector<> &size)
 Utility function for finding indices of SPH particles inside a given OBB. More...
 
thrust::device_vector< Real4 > GetParticlePositions (const thrust::device_vector< int > &indices)
 Extract positions of all SPH particles with indices in the provided array. More...
 
thrust::device_vector< Real3 > GetParticleVelocities (const thrust::device_vector< int > &indices)
 Extract velocities of all SPH particles with indices in the provided array. More...
 
thrust::device_vector< Real4 > GetParticleForces (const thrust::device_vector< int > &indices)
 Extract forces applied to all SPH particles with indices in the provided array. More...
 
thrust::device_vector< Real4 > GetParticleAccelerations (const thrust::device_vector< int > &indices)
 Extract accelerations of all SPH particles with indices in the provided array. More...
 
void CreateBCE_wall (const Real2 &size, thrust::host_vector< Real4 > &bce)
 Create BCE markers on a rectangular plate of specified X-Y dimensions, assumed centered at the origin. More...
 
void CreateBCE_box (const Real3 &size, bool solid, thrust::host_vector< Real4 > &bce)
 Create BCE markers for a box of specified dimensions, assumed centered at the origin. More...
 
void CreateBCE_sphere (Real rad, bool solid, bool polar, thrust::host_vector< Real4 > &bce)
 Create BCE markers for a sphere of specified radius, assumed centered at the origin. More...
 
void CreateBCE_cylinder (Real rad, Real height, bool solid, bool capped, bool polar, thrust::host_vector< Real4 > &bce)
 Create BCE markers for a cylinder of specified radius and height. More...
 
void CreateBCE_cylinder_annulus (Real rad_in, Real rad_out, Real height, bool polar, thrust::host_vector< Real4 > &bce)
 Create BCE particles for a cylindrical annulus of specified radii and height. More...
 
void CreateBCE_cone (Real rad, Real height, bool solid, bool capped, bool polar, thrust::host_vector< Real4 > &bce)
 Create BCE particles for a cone of specified radius and height. More...
 
void CreateBCE_cable (thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< chrono::fea::ChElementCableANCF > cable, std::vector< int > remove, bool multiLayer, bool removeMiddleLayer, int SIDE)
 Create BCE particles from a cable element. / RADU TODO.
 
void CreateBCE_shell (thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< chrono::fea::ChElementShellANCF_3423 > shell, std::vector< int > remove, std::vector< int > remove_s, bool multiLayer, bool removeMiddleLayer, int SIDE)
 Create BCE particles from a shell element. / RADU TODO.
 

Static Public Member Functions

static void CreateMeshPoints (geometry::ChTriangleMeshConnected &mesh, double delta, std::vector< ChVector<>> &point_cloud)
 Utility function for creating points filling a closed mesh. / RADU TODO eliminate delta (use initspacing) More...
 

Friends

class ChVisualizationFsi
 

Member Enumeration Documentation

◆ OutpuMode

Output mode.

Enumerator
CSV 

comma-separated value

CHPF 

binary

NONE 

none

Member Function Documentation

◆ AddBoxBCE()

void chrono::fsi::ChSystemFsi::AddBoxBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
const ChVector<> &  size,
bool  solid 
)

Add BCE markers for a box of specified dimensions and associate them with the given body.

The box is assumed to be centered at the origin of the provided frame and aligned with its axes. BCE markers are created inside the box if solid=true, and outside the box otherwise. BCE markers are created in a number of layers corresponding to system parameters.

◆ AddBoxSPH()

void chrono::fsi::ChSystemFsi::AddBoxSPH ( const ChVector<> &  boxCenter,
const ChVector<> &  boxHalfDim 
)

Create SPH particles in the specified box volume.

The SPH particles are created on a uniform grid with resolution equal to the FSI initial separation.

◆ AddConeBCE()

void chrono::fsi::ChSystemFsi::AddConeBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
double  radius,
double  height,
bool  solid,
bool  capped = true,
bool  polar = true 
)

Add BCE markers for a cone of specified radius and height and associate them with the given body.

The cone is assumed centered at the origin of the provided frame and aligned with its Z axis. BCE markers are created inside the cone if solid=true, and outside the cone otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (default), or else on a uniform Cartesian grid.

◆ AddContainerBCE()

void chrono::fsi::ChSystemFsi::AddContainerBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
const ChVector<> &  size,
const ChVector< int >  faces 
)

Add BCE markers for a box container of specified dimensions and associate them with the given body.

The center of the container bottom face is at the origin of the given frame and the the container is aligned with the frame axes. The 'faces' input vector specifies which faces of the container are to be created: for each direction, a value of -1 indicates the face in the negative direction, a value of +1 indicates the face in the positive direction, and a value of 2 indicates both faces. Setting a value of 0 does not create container faces in that direction. BCE markers are created in a number of layers corresponding to system parameters. Such a container is assumed to be used as a boundary.

◆ AddCylinderAnnulusBCE()

void chrono::fsi::ChSystemFsi::AddCylinderAnnulusBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
double  radius_inner,
double  radius_outer,
double  height,
bool  polar = true 
)

Add BCE markers for a cylindrical annulus of specified radii and height and associate them with the given body.

The cylindrical annulus is assumed centered at the origin of the provided frame and aligned with its Z axis. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (default), or else on a uniform Cartesian grid. Such a cylindrical annulus is assumed to be used on a solid body.

◆ AddCylinderBCE()

void chrono::fsi::ChSystemFsi::AddCylinderBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
double  radius,
double  height,
bool  solid,
bool  capped = true,
bool  polar = true 
)

Add BCE markers for a cylinder of specified radius and height and associate them with the given body.

The cylinder is assumed centered at the origin of the provided frame and aligned with its Z axis. BCE markers are created inside the cylinder if solid=true, and outside the cylinder otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (default), or else on a uniform Cartesian grid.

◆ AddPointsBCE()

void chrono::fsi::ChSystemFsi::AddPointsBCE ( std::shared_ptr< ChBody body,
const std::vector< ChVector<>> &  points,
const ChFrame<> &  frame,
bool  solid 
)

Add BCE markers from a set of points and associate them with the given body.

The points are assumed to be provided relative to the specified frame.

◆ AddSphereBCE()

void chrono::fsi::ChSystemFsi::AddSphereBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
double  radius,
bool  solid,
bool  polar = true 
)

Add BCE markers for a sphere of specified radius and associate them with the given body.

The sphere is assumed to be centered at the origin of the provided frame. BCE markers are created inside the sphere if solid=true, and outside the sphere otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using spherical coordinates (default), or else on a uniform Cartesian grid.

◆ AddWallBCE()

void chrono::fsi::ChSystemFsi::AddWallBCE ( std::shared_ptr< ChBody body,
const ChFrame<> &  frame,
const ChVector2<>  size 
)

Add BCE markers for a rectangular plate of specified X-Y dimensions and associate them with the given body.

BCE markers are created in a number of layers corresponding to system parameters. X-Y BCE layers are created in the negative Z direction of the plate orientation frame. Such a plate is assumed to be used as boundary.

◆ CreateBCE_box()

void chrono::fsi::ChSystemFsi::CreateBCE_box ( const Real3 &  size,
bool  solid,
thrust::host_vector< Real4 > &  bce 
)

Create BCE markers for a box of specified dimensions, assumed centered at the origin.

BCE markers are created inside the box if solid=true, and outside the box otherwise. BCE markers are created in a number of layers corresponding to system parameters.

◆ CreateBCE_cone()

void chrono::fsi::ChSystemFsi::CreateBCE_cone ( Real  rad,
Real  height,
bool  solid,
bool  capped,
bool  polar,
thrust::host_vector< Real4 > &  bce 
)

Create BCE particles for a cone of specified radius and height.

The cone is assumed centered at the origin and aligned with the Z axis. The end-cap is created if capped = true, otherwise the cone is open. BCE markers are created inside the cone if solid=true, and outside the cone otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (polar=true), or else on a uniform Cartesian grid.

◆ CreateBCE_cylinder()

void chrono::fsi::ChSystemFsi::CreateBCE_cylinder ( Real  rad,
Real  height,
bool  solid,
bool  capped,
bool  polar,
thrust::host_vector< Real4 > &  bce 
)

Create BCE markers for a cylinder of specified radius and height.

The cylinder is assumed centered at the origin and aligned with the Z axis. The end-caps are created if capped = true, otherwise the cylinder is open. BCE markers are created inside the cylinder if solid=true, and outside the cylinder otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (polar=true), or else on a uniform Cartesian grid.

◆ CreateBCE_cylinder_annulus()

void chrono::fsi::ChSystemFsi::CreateBCE_cylinder_annulus ( Real  rad_in,
Real  rad_out,
Real  height,
bool  polar,
thrust::host_vector< Real4 > &  bce 
)

Create BCE particles for a cylindrical annulus of specified radii and height.

The cylinder annulus is assumed centered at the origin and aligned with the Z axis. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using cylinderical coordinates (polar=true), or else on a uniform Cartesian grid.

◆ CreateBCE_sphere()

void chrono::fsi::ChSystemFsi::CreateBCE_sphere ( Real  rad,
bool  solid,
bool  polar,
thrust::host_vector< Real4 > &  bce 
)

Create BCE markers for a sphere of specified radius, assumed centered at the origin.

BCE markers are created inside the sphere if solid=true, and outside the sphere otherwise. BCE markers are created in a number of layers corresponding to system parameters. BCE markers are created using spherical coordinates (polar=true), or else on a uniform Cartesian grid.

◆ CreateBCE_wall()

void chrono::fsi::ChSystemFsi::CreateBCE_wall ( const Real2 &  size,
thrust::host_vector< Real4 > &  bce 
)

Create BCE markers on a rectangular plate of specified X-Y dimensions, assumed centered at the origin.

BCE markers are created in a number of layers corresponding to system parameters. BCE layers are created in the negative Z direction.

◆ CreateMeshPoints()

void chrono::fsi::ChSystemFsi::CreateMeshPoints ( geometry::ChTriangleMeshConnected mesh,
double  delta,
std::vector< ChVector<>> &  point_cloud 
)
static

Utility function for creating points filling a closed mesh. / RADU TODO eliminate delta (use initspacing)

Calculate uu parameter and test bound

ray intersection

◆ DoStepDynamics_FSI()

void chrono::fsi::ChSystemFsi::DoStepDynamics_FSI ( )

Function to integrate the FSI system in time.

It uses a Runge-Kutta 2nd order algorithm to update both the fluid and multibody system dynamics. The midpoint data of MBS is needed for fluid dynamics update.

◆ FindParticlesInBox()

thrust::device_vector< int > chrono::fsi::ChSystemFsi::FindParticlesInBox ( const ChFrame<> &  frame,
const ChVector<> &  size 
)

Utility function for finding indices of SPH particles inside a given OBB.

The object-oriented box, of specified size, is assumed centered at the origin of the provided frame and aligned with the axes of that frame. The return value is a device thrust vector.

◆ GetFsiBodies()

std::vector< std::shared_ptr< ChBody > > & chrono::fsi::ChSystemFsi::GetFsiBodies ( ) const

Get a reference to the FSI bodies.

FSI bodies are the ones seen by the fluid dynamics system.

◆ GetFsiNodes()

std::vector< std::shared_ptr< fea::ChNodeFEAxyzD > > & chrono::fsi::ChSystemFsi::GetFsiNodes ( ) const

Get a reference to the FSI ChNodeFEAxyzD.

FSI ChNodeFEAxyzD are the ones seen by the fluid dynamics system.

◆ GetParticleAccelerations()

thrust::device_vector< Real4 > chrono::fsi::ChSystemFsi::GetParticleAccelerations ( const thrust::device_vector< int > &  indices)

Extract accelerations of all SPH particles with indices in the provided array.

The return value is a device thrust vector.

◆ GetParticleFluidProperties()

std::vector< ChVector<> > chrono::fsi::ChSystemFsi::GetParticleFluidProperties ( ) const

Return the SPH particle fluid properties.

For each SPH particle, the 3-dimensional array contains density, pressure, and viscosity.

◆ GetParticleForces()

thrust::device_vector< Real4 > chrono::fsi::ChSystemFsi::GetParticleForces ( const thrust::device_vector< int > &  indices)

Extract forces applied to all SPH particles with indices in the provided array.

The return value is a device thrust vector.

◆ GetParticlePositions()

thrust::device_vector< Real4 > chrono::fsi::ChSystemFsi::GetParticlePositions ( const thrust::device_vector< int > &  indices)

Extract positions of all SPH particles with indices in the provided array.

The return value is a device thrust vector.

◆ GetParticleVelocities()

thrust::device_vector< Real3 > chrono::fsi::ChSystemFsi::GetParticleVelocities ( const thrust::device_vector< int > &  indices)

Extract velocities of all SPH particles with indices in the provided array.

The return value is a device thrust vector.

◆ Initialize()

void chrono::fsi::ChSystemFsi::Initialize ( )

Complete construction of the FSI system (fluid and BDE objects).

Use parameters read from JSON file and/or specified through various Set functions.

◆ PrintFsiInfoToFile()

void chrono::fsi::ChSystemFsi::PrintFsiInfoToFile ( const std::string &  dir,
double  time 
) const

Save the FSI information into files.

This function creates CSV files for force and torque on rigid bodies and flexible nodes.

◆ PrintParticleToFile()

void chrono::fsi::ChSystemFsi::PrintParticleToFile ( const std::string &  dir) const

Save the SPH particle information into files.

This function creates three CSV files for SPH particles, boundary BCE markers, and solid BCE markers data.

◆ SetBodyForce()

void chrono::fsi::ChSystemFsi::SetBodyForce ( const ChVector<> &  force)

Set a constant force applied to the fluid.

Solid bodies are not explicitly affected by this force, but they are affected indirectly through the fluid.

◆ SetElasticSPH()

void chrono::fsi::ChSystemFsi::SetElasticSPH ( const ElasticMaterialProperties  mat_props)

Enable solution of elastic SPH (for continuum representation of granular dynamics).

By default, a ChSystemFSI solves an SPH fluid dynamics problem.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_fsi/ChSystemFsi.h
  • /builds/uwsbel/chrono/src/chrono_fsi/ChSystemFsi.cpp