1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Authors: Antonio Recuero, Bryan Peterson
13 // =============================================================================
14 //
15 // FEA deformable terrain. Box of terrain composed of 9-node brick elements which
16 // can capture moderate deformation (no remeshing). Constitutive behavior given
17 // by Drucker-Prager.
18 //
19 // =============================================================================
20 
21 #ifndef FEADEFORMABLE_TERRAIN_H
22 #define FEADEFORMABLE_TERRAIN_H
23 
24 #include "chrono/physics/ChSystem.h"
25 #include "chrono/fea/ChMesh.h"
26 #include "chrono_vehicle/ChApiVehicle.h"
27 #include "chrono_vehicle/ChTerrain.h"
28 
29 namespace chrono {
30 namespace vehicle {
31 
32 /// @addtogroup vehicle_terrain
33 /// @{
34 
35 /// FEA Deformable terrain model.
36 /// This class implements a terrain made up of isoparametric finite elements. It features
37 /// Drucker-Prager plasticity and capped Drucker-Prager plasticity.
38 class CH_VEHICLE_API FEADeformableTerrain : public ChTerrain {
39   public:
40     /// Construct a default FEADeformableSoil.
41     /// The user is responsible for calling various Set methods before Initialize.
42     FEADeformableTerrain(ChSystem* system  ///< [in/out] pointer to the containing system);
43                          );
44 
~FEADeformableTerrain()45     ~FEADeformableTerrain() {}
46 
47     /// Get the terrain height below the specified location.
48     virtual double GetHeight(const ChVector<>& loc) const override;
49 
50     /// Get the terrain normal at the point below the specified location.
51     virtual chrono::ChVector<> GetNormal(const ChVector<>& loc) const override;
52 
53     /// Get the terrain coefficient of friction at the point below the specified location.
54     /// This coefficient of friction value may be used by certain tire models to modify
55     /// the tire characteristics, but it will have no effect on the interaction of the terrain
56     /// with other objects (including tire models that do not explicitly use it).
57     /// For FEADeformableTerrain, this function defers to the user-provided functor object
58     /// of type ChTerrain::FrictionFunctor, if one was specified.
59     /// Otherwise, it returns the constant value of 0.8.
60     virtual float GetCoefficientFriction(const ChVector<>& loc) const override;
61 
62     /// Set the properties of the Drucker-Prager FEA soil.
63     void SetSoilParametersFEA(double rho,              ///< [in] Soil density
64                               double Emod,             ///< [in] Soil modulus of elasticity
65                               double nu,               ///< [in] Soil Poisson ratio
66                               double yield_stress,     ///< [in] Soil yield stress, for plasticity
67                               double hardening_slope,  ///< [in] Soil hardening slope, for plasticity
68                               double friction_angle,   ///< [in] Soil internal friction angle
69                               double dilatancy_angle   ///< [in] Soil dilatancy angle
70                               );
71 
72     /// Initialize the terrain system (flat).
73     /// This version creates a flat array of points.
74     void Initialize(const ChVector<>& start_point,               ///< [in] Base point to build terrain box
75                     const ChVector<>& terrain_dimension,         ///< [in] terrain dimensions in the 3 directions
76                     const ChVector<int>& terrain_discretization  ///< [in] Number of finite elements in the 3 directions
77                     );
78 
79     /// Get the underlying FEA mesh.
GetMesh()80     std::shared_ptr<fea::ChMesh> GetMesh() const { return m_mesh; }
81 
82   private:
83     std::shared_ptr<fea::ChMesh> m_mesh;  ///< soil mesh
84 
85     double m_rho;  ///< Soil density
86     double m_E;    ///< Soil modulus of elasticity
87     double m_nu;   ///< Soil Poisson ratio
88 
89     double m_yield_stress;     ///< Yield stress for soil plasticity
90     double m_hardening_slope;  ///< Hardening slope for soil plasticity
91     double m_friction_angle;   ///< Set friction angle for soil plasticity
92     double m_dilatancy_angle;  ///< Set dilatancy angle for soil plasticity
93 };
94 
95 /// @} vehicle_terrain
96 
97 }  // end namespace vehicle
98 }  // end namespace chrono
99 
100 #endif
101