Project Chrono: chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU Class Reference

Public Member Functions | List of all members
chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU Class Reference
VEHICLE module » Co-simulation » Terrain nodes using Chrono physics

## Description

Definition of the GPU granular terrain node (using Chrono::Gpu).

`#include <ChVehicleCosimTerrainNodeGranularGPU.h>`

Inheritance diagram for chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU:
[legend]
Collaboration diagram for chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU:
[legend]

## Public Member Functions
| ChVehicleCosimTerrainNodeGranularGPU (double length, double width)
| Create a Chrono::Granular terrain node.
| ChVehicleCosimTerrainNodeGranularGPU (const std::string &specfile)
| Create a Chrono::Granular terrain node and set parameters from the provided JSON specfile.
virtual ChSystem * | GetSystem () override
| Return a pointer to the underlying Chrono system.
void | SetFromSpecfile (const std::string &specfile)
| Set full terrain specification from JSON specfile.
void | SetGranularMaterial (double radius, double density)
| Set properties of granular material.
void | SetMaterialSurface (const std::shared_ptr< ChContactMaterialSMC > &mat)
| Set the material properties for terrain.
void | SetTangentialDisplacementModel (gpu::CHGPU_FRICTION_MODE model)
| Set the normal contact force model (default: Hertz). /void SetContactForceModel(ChSystemSMC::ContactForceModel model);.
void | SetSamplingMethod (utils::SamplingType type, double init_height, double sep_factor=1.001, bool in_layers=false)
| Set sampling method for generation of granular material.
void | SetIntegratorType (gpu::CHGPU_TIME_INTEGRATOR type)
| Set the integrator type (default: CENTERED_DIFFERENCE).
void | SetInputFromCheckpoint (const std::string &filename)
| Initialize granular terrain from the specified checkpoint file (which must exist in the output directory).
void | SetSettlingTime (double time)
| Set simulation length for settling of granular material (default: 0.4).
void | SetSettlingKineticEneryThreshold (double threshold)
| Set total kinetic energy threshold as stopping criteria for settling (default: 1e-3).
void | EnableSettlingOutput (bool output, double output_fps=100)
| Enable/disable output during settling (default: false).
void | Settle ()
| Obtain settled terrain configuration.
virtual void | OnInitialize (unsigned int num_objects) override
| Initialize this Chrono terrain node.
virtual void | WriteCheckpoint (const std::string &filename) const override
| Write checkpoint to the specified file (which will be created in the output directory).
double | CalculatePackingDensity (double &depth)
| Estimate packing density (eta) of granular material in current configuration.
virtual void | OutputVisualizationData (int frame) override final
| Output post-processing visualization data.
Public Member Functions inherited from chrono::vehicle::ChVehicleCosimTerrainNodeChrono
Type | GetType () const
| Return the type of this terrain node.
void | SetProxyFixed (bool fixed)
| Set the proxy bodies as fixed to ground.
virtual double | GetInitHeight () const override final
| Return the terrain initial height.
void | AddRigidObstacle (const RigidObstacle &obstacle)
| Add a rigid obstacle.
Public Member Functions inherited from chrono::vehicle::ChVehicleCosimTerrainNode
virtual NodeType | GetNodeType () const override
| Return the node type as NodeType::TERRAIN.
void | SetDimensions (double length, double width)
| Set the terrain patch dimensions.
void | GetDimensions (double &length, double &width)
| Get the terrain patch dimensions.
virtual void | Initialize () override final
| Initialize this node.
virtual void | Synchronize (int step_number, double time) override final
| Synchronize this node.
virtual void | Advance (double step_size) override final
| Advance simulation.
virtual void | OutputData (int frame) override final
| Output logging and debugging data.
Public Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
std::string | GetNodeTypeString () const
| Return the node type as a string.
bool | IsCosimNode () const
| Return true if this node is part of the co-simulation infrastructure.
void | SetStepSize (double step)
| Set the integration step size (default: 1e-4).
double | GetStepSize () const
| Get the integration step size.
void | SetOutDir (const std::string &dir_name, const std::string &suffix="")
| Set the name of the output directory and an identifying suffix.
void | SetVerbose (bool verbose)
| Enable/disable verbose messages during simulation (default: true).
void | EnableRuntimeVisualization (double render_fps=100, bool save_img=false)
| Enable run-time visualization (default: false).
void | SetCameraPosition (const ChVector3d &cam_pos, const ChVector3d &cam_target=VNULL)
| Set camera location and target point.
void | SetCameraTracking (bool track)
| Enable/disable tracking of objects (default: true).
void | EnablePostprocessVisualization (double render_fps=100)
| Enable Blender postprocessing (default: false).
const std::string & | GetOutDirName () const
| Get the output directory name for this node.
double | GetStepExecutionTime () const
| Get the simulation execution time for the current step on this node.
double | GetTotalExecutionTime () const
| Get the cumulative simulation execution time on this node.
void | Render (double step_size)
| Render simulation frame.

## Additional Inherited Members
Public Types inherited from chrono::vehicle::ChVehicleCosimTerrainNodeChrono
enum class | Type { RIGID , SCM , GRANULAR_OMP , GRANULAR_GPU , GRANULAR_SPH , UNKNOWN }
| Type of Chrono terrain. More...
Public Types inherited from chrono::vehicle::ChVehicleCosimBaseNode
enum class | NodeType { MBS_WHEELED , MBS_TRACKED , TERRAIN , TIRE }
| Type of node participating in co-simulation. More...
enum class | InterfaceType { BODY , MESH }
| Type of the vehicle-terrain communication interface. More...
Static Public Member Functions inherited from chrono::vehicle::ChVehicleCosimTerrainNodeChrono
static std::string | GetTypeAsString (Type type)
| Return a string describing the type of this terrain node.
static Type | GetTypeFromString (const std::string &type)
| Infer the terrain node type from the given string.
static bool | ReadSpecfile (const std::string &specfile, rapidjson::Document &d)
| Read a JSON specification file for a Chrono terrain node.
static Type | GetTypeFromSpecfile (const std::string &specfile)
| Get the terrain type from the given JSON specification file.
static ChVector2d | GetSizeFromSpecfile (const std::string &specfile)
| Get the terrain dimensions (length and width) from the given JSON specification file.
Static Public Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
static std::string | OutputFilename (const std::string &dir, const std::string &root, const std::string &ext, int frame, int frame_digits)
| Utility function for creating an output file name.
Protected Member Functions inherited from chrono::vehicle::ChVehicleCosimTerrainNodeChrono
| ChVehicleCosimTerrainNodeChrono (Type type, double length, double width, ChContactMethod method)
| Construct a base class terrain node.
virtual void | CreateMeshProxy (unsigned int i)
| Create the i-th proxy mesh.
Protected Member Functions inherited from chrono::vehicle::ChVehicleCosimTerrainNode
| ChVehicleCosimTerrainNode (double length, double width)
| Construct a terrain node to wrap a terrain patch of given length and width.
virtual void | OnSynchronize (int step_number, double time)
| Perform any additional operations after the data exchange and synchronization with the MBS node.
virtual void | UpdateMeshProxy (unsigned int i, MeshState &mesh_state)
| Update the state of the i-th proxy mesh.
virtual void | GetForceMeshProxy (unsigned int i, MeshContact &mesh_contact)
| Collect cumulative contact forces on the i-th proxy mesh.
Protected Member Functions inherited from chrono::vehicle::ChVehicleCosimBaseNode
| ChVehicleCosimBaseNode (const std::string &name)
void | SendGeometry (const ChVehicleGeometry &geom, int dest) const
| Utility function to pack and send a struct with geometry information.
void | RecvGeometry (ChVehicleGeometry &geom, int source) const
| Utility function to receive and unpack a struct with geometry information.
void | ProgressBar (unsigned int x, unsigned int n, unsigned int w=50)
| Utility function to display a progress bar to the terminal.
Protected Attributes inherited from chrono::vehicle::ChVehicleCosimTerrainNodeChrono
Type | m_type
| terrain type
ChContactMethod | m_method
| contact method (SMC or NSC)
std::shared_ptr< ChContactMaterial > | m_material_terrain
| material properties for terrain bodies
double | m_init_height
| terrain initial height
std::vector< std::shared_ptr< Proxy > > | m_proxies
| proxies for solid objects
bool | m_fixed_proxies
| are proxies fixed to ground?
std::vector< RigidObstacle > | m_obstacles
| list of rigid obstacles
Protected Attributes inherited from chrono::vehicle::ChVehicleCosimTerrainNode
double | m_dimX
| patch length (X direction)
double | m_dimY
| patch width (Y direction)
bool | m_wheeled
| comm node (true: TIRE nodes, false: tracked MBS node)
InterfaceType | m_interface_type
| communication interface (body or mesh)
int | m_num_objects
| number of interacting objects
std::vector< ChAABB > | m_aabb
| AABB of collision models for interacting objects.
std::vector< ChVehicleGeometry > | m_geometry
| contact geometry and materials for interacting objects
std::vector< double > | m_load_mass
| vertical load on interacting objects
std::vector< int > | m_obj_map
| mapping from interacting object to shape
std::vector< MeshState > | m_mesh_state
| mesh state (used for MESH communication)
std::vector< BodyState > | m_rigid_state
| rigid state (used for BODY communication interface)
std::vector< MeshContact > | m_mesh_contact
| mesh contact forces (used for MESH communication interface)
std::vector< TerrainForce > | m_rigid_contact
| rigid contact force (used for BODY communication interface)
Protected Attributes inherited from chrono::vehicle::ChVehicleCosimBaseNode
int | m_rank
| MPI rank of this node (in MPI_COMM_WORLD).
double | m_step_size
| integration step size
std::string | m_name
| name of the node
std::string | m_out_dir
| top-level output directory
std::string | m_node_out_dir
| node-specific output directory
std::ofstream | m_outf
| output file stream
bool | m_renderRT
| if true, perform run-time rendering
bool | m_renderRT_all
| if true, render all frames
double | m_renderRT_step
| time step between rendered frames
bool | m_writeRT
| if true, write images to file
bool | m_renderPP
| if true, save data for post-processing
bool | m_renderPP_all
| if true, save data at all frames
double | m_renderPP_step
| time step between post-processing save frames
bool | m_track
| track objects
ChVector3d | m_cam_pos
| camera location
ChVector3d | m_cam_target
| camera target (lookat) point
unsigned int | m_num_wheeled_mbs_nodes
unsigned int | m_num_tracked_mbs_nodes
unsigned int | m_num_terrain_nodes
unsigned int | m_num_tire_nodes
ChTimer | m_timer
| timer for integration cost
double | m_cum_sim_time
| cumulative integration cost
bool | m_verbose
| verbose messages during simulation?
Static Protected Attributes inherited from chrono::vehicle::ChVehicleCosimBaseNode
static const double | m_gacc = -9.81

## Member Function Documentation

## ◆ CalculatePackingDensity()

double chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::CalculatePackingDensity | ( | double & | depth | ) |

Estimate packing density (eta) of granular material in current configuration.

Note that porosity is phi=1-eta and void ratio is e=(1-eta)/eta=phi/(1-phi). The function also returns the current depth of granular material.

## ◆ EnableSettlingOutput()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::EnableSettlingOutput | ( | bool | output,
|  | double | output_fps = 100 )

Enable/disable output during settling (default: false).

If enabled, output files are generated with the specified frequency.

## ◆ GetSystem()

virtual ChSystem * chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::GetSystem | ( |  | ) |
| inlineoverridevirtual

Return a pointer to the underlying Chrono system.

Implements chrono::vehicle::ChVehicleCosimTerrainNodeChrono.

## ◆ OnInitialize()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::OnInitialize | ( | unsigned int | num_objects | ) |
| overridevirtual

Initialize this Chrono terrain node.

Construct the terrain system and the proxy bodies, then finalize the underlying system.

Reimplemented from chrono::vehicle::ChVehicleCosimTerrainNodeChrono.

## ◆ OutputVisualizationData()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::OutputVisualizationData | ( | int | frame | ) |
| finaloverridevirtual

Output post-processing visualization data.

Reimplemented from chrono::vehicle::ChVehicleCosimTerrainNode.

## ◆ SetGranularMaterial()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::SetGranularMaterial | ( | double | radius,
|  | double | density )

Set properties of granular material.

Parameters

  radius | particle radius (default: 0.01)
  density | particle material density (default: 2000)

## ◆ SetInputFromCheckpoint()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::SetInputFromCheckpoint | ( | const std::string & | filename | ) |

Initialize granular terrain from the specified checkpoint file (which must exist in the output directory).

By default, particles are created uniformly distributed in the specified domain such that they are initially not in contact.

## ◆ SetMaterialSurface()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::SetMaterialSurface | ( | const std::shared_ptr< ChContactMaterialSMC > & | mat | ) |

Set the material properties for terrain.

These parameters characterize the material for the container and the granular material. Object contact material is received from the rig node.

## ◆ SetSamplingMethod()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::SetSamplingMethod | ( | utils::SamplingType | type,
|  | double | init_height,
|  | double | sep_factor = 1.001,
|  | bool | in_layers = false )

Set sampling method for generation of granular material.

The granular material is created in the volume defined by the x-y dimensions of the terrain patch and the specified initial height, using the specified sampling type, layer by layer or all at once. Note: for correct HCP, do not initialize in layers!

Parameters

  type | volume sampling type (default POISSON_DISK)
  init_height | height of granular material at initialization (default 0.2)
  sep_factor | radius inflation factor for initial separation
  in_layers | initialize material in layers

## ◆ SetTangentialDisplacementModel()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::SetTangentialDisplacementModel | ( | gpu::CHGPU_FRICTION_MODE | model | ) |

Set the normal contact force model (default: Hertz). /void SetContactForceModel(ChSystemSMC::ContactForceModel model);.

Set the tangential contact displacement model (default: SINGLE_STEP).

## ◆ Settle()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::Settle | ( |  | ) |

Obtain settled terrain configuration.

This is an optional operation that can be performed for granular terrain before initiating communictation with the rig node. For granular terrain, a settled configuration can be obtained either through simulation or by initializing particles from a previously generated checkpointing file.

## ◆ WriteCheckpoint()

void chrono::vehicle::ChVehicleCosimTerrainNodeGranularGPU::WriteCheckpoint | ( | const std::string & | filename | ) | const
| overridevirtual

Write checkpoint to the specified file (which will be created in the output directory).

Reimplemented from chrono::vehicle::ChVehicleCosimBaseNode.

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

- D:/W/B/src/chrono-9.0.1/src/chrono_vehicle/cosim/terrain/ChVehicleCosimTerrainNodeGranularGPU.h
- D:/W/B/src/chrono-9.0.1/src/chrono_vehicle/cosim/terrain/ChVehicleCosimTerrainNodeGranularGPU.cpp