Project Chrono: Loads

Loads

Chrono offers different options to apply loads to objects.

As the name suggests, objects that can carry a load are those inheriting from the ChLoadable class; for example ChBody, finite elements and nodes or ChShafts.

Loads can be applied to these objects through different approaches:

- ChForce:
  - available only for ChBody
  - applies either a force or a torque with respect to some pre-defined frame (body or world);
- ChLoad + ChLoader:
  - available for any ChLoadable inherited object;
  - the specific implementation must be provided through a ChLoader object;
  - it is more tightly coupled with the Chrono system;
  - requires the computation of the generalized loads;
- loads inheriting from ChLoadCustom|ChLoadCustomMultiple:
  - they are applied to either one or multiple ChLoadable objects;
  - it is the preferred choice for loads applied to pair of objects;
  - multiple pre-defined classes are available, simplifying the writing of the generalized loads.

While not being considered explicitely in the previous list, also the ChLinkTSDA|ChLinkRSDA can do similar jobs, also including the Jacobian for the generalized forces or also some advanced internal dynamic, by providing custom functors (ChLinkTSDA::ForceFunctor|ChLinkRSDA::TorqueFunctor) or even proper ODEs (only ChLinkTSDA::ODE).

Other simplified approaches, limited to ChBody, allow to accumulate forces, by using AccumulateForce() and AccumulateTorque().

The overall contributions of forces to a given ChBody can be retrieved through GetAppliedForce() and similarly for torques.

For FEA nodes, similary to the ChForce for ChBody, it is possible to add a force directly to the node through ChNodeFEAxyz::SetForce(). However, in this case the options are even more limited, since the force is expressed as a simple ChVector3, thus always assumed constant and expressed in absolute frame. The ChNodeFEAxyzrot class implements also ChNodeFEAxyzrot::SetTorque().

Some more peculiar class has been excluded from this list: please look at ChLoadBase to have a full perspective on the load classes in Chrono.

## ChForce

The ChForce can be applied directly to a ChBody by calling:

auto force = chrono_types::make_shared<ChForce>();
body->AddForce(force)
// AFTER calling AddForce
force->SetMforce(10);
chrono_types::make_shared
std::shared_ptr< T > make_shared(Args &&... args)
Replacement for make_shared guaranteed to use operator new rather than placement new in order to avoi...
Definition ChTypes.h:66

Please mind that:

- use body->AddForce(force) and not force->SetBody(body): the latter it is not sufficient since the ChForce wouldn't be considered by the ChSystem;
- always call ChForce methods after having called body->AddForce(force)

The application point, direction, position and modulus can be set either through constant values or through ChFunctions. The reference system can be either relative to the body or absolute, but cannot be set to a generic frame.

## ChLoad and inherited

These sets of loads allows for the maximum freedom and coupling with the Chrono system.

Contrary to ChForce, these other _ChLoad_s requires the introduction of a ChLoadContainer in order to be added to the system. For example:

auto load_container = chrono_types::make_shared<ChLoadContainer>();
sys.Add(load_container);
auto load_bb = chrono_types::make_shared<ChLoadBodyBodyTorque>(bodyA, bodyB, ChVector3d(0,10.0,0), false);
load_container->Add(load_bb);

For the case of the ChLoad, the user is asked to either provide one of the pre-defined ChLoader objects or to write its own. Please refer to the documentation of each single ChLoader to understand their use. This method considers the load applied to a single object.

A similar set of loads includes those inheriting from ChLoadCustom|ChLoadCustomMultiple: while the features are similar compared to ChLoad type and also their usage might have big overlaps, they usually offere a wider set of pre-defined classes that might match the user needs.

These more advanced approaches allow for a tighter coupling with the Chrono system, allowing to introduce also entire stiffness matrix blocks (see ChLoadBodyBodyBushingGeneric and others), providing Jacobians and much more. This come with the added price of having to implement some additional code.