Model construction, and I/O utilities

Description

Handles utilities including creating BCE particles, setting parameters via a JSON file, and output data into files with specified format.

Collaboration diagram for Model construction, and I/O utilities:

Classes

class  chrono::fsi::ChUtilsTypeConvert
 Class for converting Chrono data structure to/from FSI data structure. More...
 

Functions

void chrono::fsi::utils::CreateBCE_On_Sphere (thrust::host_vector< Real4 > &posRadBCE, Real rad, std::shared_ptr< SimParams > paramsH)
 Create BCE particles from a sphere.
 
void chrono::fsi::utils::CreateBCE_On_surface_of_Sphere (thrust::host_vector< Real4 > &posRadBCE, Real rad, Real kernel_h)
 Create BCE particles from the surface of a sphere.
 
void chrono::fsi::utils::CreateBCE_On_Cylinder (thrust::host_vector< Real4 > &posRadBCE, Real cyl_rad, Real cyl_h, std::shared_ptr< SimParams > paramsH, Real kernel_h, bool cartesian=true)
 Create BCE particles from a cylinder.
 
void chrono::fsi::utils::CreateBCE_On_Cone (thrust::host_vector< Real4 > &posRadBCE, Real cone_rad, Real cone_h, std::shared_ptr< SimParams > paramsH, Real kernel_h, bool cartesian=true)
 Create BCE particles from a cone.
 
void chrono::fsi::utils::CreateBCE_On_surface_of_Cylinder (thrust::host_vector< Real4 > &posRadBCE, thrust::host_vector< Real3 > &normals, Real cyl_rad, Real cyl_h, Real spacing)
 Create BCE particles from the surface of a cylinder.
 
void chrono::fsi::utils::CreateBCE_On_Box (thrust::host_vector< Real4 > &posRadBCE, const Real3 &hsize, int face, std::shared_ptr< SimParams > paramsH)
 Create BCE particles from box.
 
void chrono::fsi::utils::LoadBCE_fromFile (thrust::host_vector< Real4 > &posRadBCE, std::string fileName, double scale=1, double hsml=1)
 Load BCE particles from a file.
 
void chrono::fsi::utils::CreateBCE_On_shell (thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< SimParams > paramsH, std::shared_ptr< chrono::fea::ChElementShellANCF_3423 > shell, bool multiLayer=true, bool removeMiddleLayer=false, int SIDE=-2)
 Create BCE particles from a shell element.
 
void chrono::fsi::utils::CreateBCE_On_ChElementCableANCF (thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< SimParams > paramsH, std::shared_ptr< chrono::fea::ChElementCableANCF > cable, std::vector< int > remove, bool multiLayer=true, bool removeMiddleLayer=false, int SIDE=1)
 Create BCE particles from a cable element.
 
void chrono::fsi::utils::CreateBCE_On_ChElementShellANCF (thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< SimParams > paramsH, std::shared_ptr< chrono::fea::ChElementShellANCF_3423 > shell, std::vector< int > remove, bool multiLayer=true, bool removeMiddleLayer=false, int SIDE=-2, double kernel_h=0)
 Create BCE particles from a shell element.
 
int2 chrono::fsi::utils::CreateFluidMarkers (std::shared_ptr< SphMarkerDataH > sphMarkersH, std::shared_ptr< FsiGeneralData > fsiGeneralData, std::shared_ptr< SimParams > paramsH)
 Create fluid/granular SPH particles for the simulation.
 
ChVector chrono::fsi::utils::TransformBCEToCOG (std::shared_ptr< ChBody > body, const ChVector<> &pos)
 This utility function converts a given position and orientation, specified with respect to a body's reference frame, into a frame defined with respect to the body's centroidal frame. More...
 
ChVector chrono::fsi::utils::TransformBCEToCOG (std::shared_ptr< ChBody > body, const Real3 &pos3)
 This utility function converts a given position and orientation, specified with respect to a body's reference frame, into a frame defined with respect to the body's centroidal frame. More...
 
CH_FSI_API void chrono::fsi::utils::FinalizeDomain (std::shared_ptr< SimParams > paramsH)
 Set subdomains to find neighbor particles faster.
 
CH_FSI_API void chrono::fsi::utils::CreateBceGlobalMarkersFromBceLocalPos (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, const thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< ChBody > body, const ChVector<> &collisionShapeRelativePos=ChVector<>(0), const ChQuaternion<> &collisionShapeRelativeRot=QUNIT, bool isSolid=true, bool add_to_fluid_helpers=false, bool add_to_previous_object=false)
 Create BCE particles from the local position on a body.
 
CH_FSI_API void chrono::fsi::utils::CreateBceGlobalMarkersFromBceLocalPosBoundary (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, const thrust::host_vector< Real4 > &posRadBCE, std::shared_ptr< ChBody > body, const ChVector<> &collisionShapeRelativePos, const ChQuaternion<> &collisionShapeRelativeRot, bool isSolid=false, bool add_to_previous=true)
 Create BCE particles from the local position on a boundary.
 
CH_FSI_API void chrono::fsi::utils::AddSphereBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, Real radius)
 Add BCE particles genetrated from a sphere.
 
CH_FSI_API void chrono::fsi::utils::AddCylinderBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, Real radius, Real height, Real kernel_h, bool cartesian=true)
 Add BCE particles genetrated from a cylinder.
 
CH_FSI_API void chrono::fsi::utils::AddConeBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, Real radius, Real height, Real kernel_h, bool cartesian=true)
 Add BCE particles genetrated from a cone.
 
CH_FSI_API void chrono::fsi::utils::AddCylinderSurfaceBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, Real radius, Real height, Real kernel_h)
 Add BCE particles genetrated from the surface of a cylinder.
 
CH_FSI_API void chrono::fsi::utils::AddSphereSurfaceBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, Real radius, Real kernel_h)
 Add BCE particles genetrated from the surface of a sphere.
 
CH_FSI_API void chrono::fsi::utils::AddBoxBce (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const ChVector<> &relPos, const ChQuaternion<> &relRot, const ChVector<> &size, int plane=12, bool isSolid=false, bool add_to_previous=false)
 Add BCE particles genetrated from a box.
 
void chrono::fsi::utils::AddBCE_FromPoints (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, const std::vector< ChVector<>> &points, const ChVector<> &collisionShapeRelativePos=ChVector<>(0), const ChQuaternion<> &collisionShapeRelativeRot=QUNIT)
 Add BCE particles genetrated from point information.
 
CH_FSI_API void chrono::fsi::utils::AddBCE_FromFile (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChBody > body, std::string dataPath, const ChVector<> &collisionShapeRelativePos=ChVector<>(0), const ChQuaternion<> &collisionShapeRelativeRot=QUNIT, double scale=1.0, bool isSolid=true)
 Add BCE particles loaded from a file.
 
CH_FSI_API void chrono::fsi::utils::CreateSphereFSI (std::shared_ptr< ChSystemFsi_impl > fsiSystem, ChSystem &mphysicalSystem, std::vector< std::shared_ptr< ChBody >> &fsiBodies, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChMaterialSurface > mat_prop, Real density, const ChVector<> &pos, Real radius)
 Create an FSI body for a sphere.
 
CH_FSI_API void chrono::fsi::utils::CreateCylinderFSI (std::shared_ptr< ChSystemFsi_impl > fsiSystem, ChSystem &mphysicalSystem, std::vector< std::shared_ptr< ChBody >> &fsiBodies, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChMaterialSurface > mat_prop, Real density, const ChVector<> &pos, const ChQuaternion<> &rot, Real radius, Real length)
 Create an FSI body for a cylinder.
 
CH_FSI_API void chrono::fsi::utils::CreateBoxFSI (std::shared_ptr< ChSystemFsi_impl > fsiSystem, ChSystem &mphysicalSystem, std::vector< std::shared_ptr< ChBody >> &fsiBodies, std::shared_ptr< SimParams > paramsH, std::shared_ptr< ChMaterialSurface > mat_prop, Real density, const ChVector<> &pos, const ChQuaternion<> &rot, const ChVector<> &hsize)
 Create an FSI body for a box.
 
CH_FSI_API void chrono::fsi::utils::AddBCE_ShellANCF (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::vector< std::shared_ptr< fea::ChElementShellANCF_3423 >> &fsiShells, std::shared_ptr< fea::ChMesh > my_mesh, bool multiLayer=true, bool removeMiddleLayer=false, int SIDE=-2)
 Add BCE particles genetrated from ANCF shell elements.
 
CH_FSI_API void chrono::fsi::utils::AddBCE_ShellFromMesh (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::vector< std::shared_ptr< fea::ChElementShellANCF_3423 >> &fsiShells, std::vector< std::shared_ptr< fea::ChNodeFEAxyzD >> &fsiNodes, std::shared_ptr< fea::ChMesh > my_mesh, const std::vector< std::vector< int >> &elementsNodes, const std::vector< std::vector< int >> &NodeNeighborElement, bool multiLayer=true, bool removeMiddleLayer=false, int SIDE=-2)
 Add BCE particles genetrated from shell elements.
 
CH_FSI_API void chrono::fsi::utils::AddBCE_FromMesh (std::shared_ptr< ChSystemFsi_impl > fsiSystem, std::shared_ptr< SimParams > paramsH, std::shared_ptr< fea::ChMesh > my_mesh, std::vector< std::shared_ptr< fea::ChNodeFEAxyzD >> &fsiNodes, std::vector< std::shared_ptr< fea::ChElementCableANCF >> &fsiCables, std::vector< std::shared_ptr< fea::ChElementShellANCF_3423 >> &fsiShells, 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 SIDE2D=2, double kernel_h=0)
 Add BCE particles genetrated from mesh.
 
CH_FSI_API bool chrono::fsi::utils::ParseJSON (const std::string &json_file, std::shared_ptr< fsi::SimParams > paramsH, Real3 Domain)
 Parse FSI parameters from the specified JSON file.
 
void chrono::fsi::utils::PrepareOutputDir (std::shared_ptr< fsi::SimParams > paramsH, std::string &demo_dir, std::string out_dir, std::string jsonFile)
 Create outut directories.
 
Real3 chrono::fsi::utils::LoadVectorJSON (const Value &a)
 Load a Real3 vector from the given JSON value.
 
void chrono::fsi::utils::InvalidArg (std::string arg)
 Issue warning about an invalid argument (write to stdout).
 
CH_FSI_API void chrono::fsi::utils::PrintToFile (const thrust::device_vector< Real4 > &posRadD, const thrust::device_vector< Real3 > &velMasD, const thrust::device_vector< Real4 > &rhoPresMuD, const thrust::device_vector< Real4 > &sr_tau_I_mu_i, const thrust::host_vector< int4 > &referenceArray, const thrust::host_vector< int4 > &referenceArrayFEA, const std::string &out_dir, bool printToParaview=false)
 Helper function to save the SPH data into files. More...
 
CH_FSI_API void chrono::fsi::utils::WriteCsvParticlesToFile (thrust::device_vector< Real4 > &posRadD, thrust::device_vector< Real3 > &velMasD, thrust::device_vector< Real4 > &rhoPresMuD, thrust::host_vector< int4 > &referenceArray, const std::string &outfilename)
 Helper function to save particle info from FSI system to a CSV files. More...
 
CH_FSI_API void chrono::fsi::utils::WriteChPFParticlesToFile (thrust::device_vector< Real4 > &posRadD, thrust::host_vector< int4 > &referenceArray, const std::string &outfilename)
 Helper function to save particle info from FSI system to a ChPF binary files. More...
 
void chrono::fsi::utils::printStruct (struct Real2 &s)
 Print a Real2 struct.
 
void chrono::fsi::utils::printStruct (struct int2 &s)
 Print a Int2 struct.
 
void chrono::fsi::utils::printStruct (struct Real3 &s)
 Print a Real3 struct.
 
void chrono::fsi::utils::printStruct (struct int3 &s)
 Print a Int3 struct.
 
void chrono::fsi::utils::printStruct (struct Real4 &s)
 Print a Real4 struct.
 
void chrono::fsi::utils::printStruct (struct int4 &s)
 Print a Int4 struct.
 

Function Documentation

◆ PrintToFile()

CH_FSI_API void chrono::fsi::utils::PrintToFile ( const thrust::device_vector< Real4 > &  posRadD,
const thrust::device_vector< Real3 > &  velMasD,
const thrust::device_vector< Real4 > &  rhoPresMuD,
const thrust::device_vector< Real4 > &  sr_tau_I_mu_i,
const thrust::host_vector< int4 > &  referenceArray,
const thrust::host_vector< int4 > &  referenceArrayFEA,
const std::string &  out_dir,
bool  printToParaview = false 
)

Helper function to save the SPH data into files.

When called, this function creates three files to write fluid, boundary and BCE particles data into files.

◆ TransformBCEToCOG() [1/2]

ChVector chrono::fsi::utils::TransformBCEToCOG ( std::shared_ptr< ChBody body,
const ChVector<> &  pos 
)

This utility function converts a given position and orientation, specified with respect to a body's reference frame, into a frame defined with respect to the body's centroidal frame.

Note that by default, a body's reference frame is the centroidal frame. This is not true for a ChBodyAuxRef.

◆ TransformBCEToCOG() [2/2]

ChVector chrono::fsi::utils::TransformBCEToCOG ( std::shared_ptr< ChBody body,
const Real3 &  pos3 
)

This utility function converts a given position and orientation, specified with respect to a body's reference frame, into a frame defined with respect to the body's centroidal frame.

Note that by default, a body's reference frame is the centroidal frame. This is not true for a ChBodyAuxRef.

◆ WriteChPFParticlesToFile()

CH_FSI_API void chrono::fsi::utils::WriteChPFParticlesToFile ( thrust::device_vector< Real4 > &  posRadD,
thrust::host_vector< int4 > &  referenceArray,
const std::string &  outfilename 
)

Helper function to save particle info from FSI system to a ChPF binary files.

This function saves only particle positions.

◆ WriteCsvParticlesToFile()

CH_FSI_API void chrono::fsi::utils::WriteCsvParticlesToFile ( thrust::device_vector< Real4 > &  posRadD,
thrust::device_vector< Real3 > &  velMasD,
thrust::device_vector< Real4 > &  rhoPresMuD,
thrust::host_vector< int4 > &  referenceArray,
const std::string &  outfilename 
)

Helper function to save particle info from FSI system to a CSV files.

This function saves particle positions, velocities, rho, pressure, and mu.