proteus  1.8.1
C/C++/Fortran libraries
ProtChMoorings.h
Go to the documentation of this file.
1 //#pragma once
2 
3 #define _USE_MATH_DEFINES
4 
5 #include <iostream>
6 #include <math.h>
7 #include <string>
8 #include "chrono/physics/ChSystem.h"
9 #include "chrono/physics/ChSystemSMC.h"
10 #include "chrono/physics/ChLoadContainer.h"
11 #include "chrono/physics/ChLinkMate.h"
12 #include "chrono/physics/ChBodyEasy.h"
13 #include "chrono/fea/ChElementBeamANCF_3333.h"
14 #include "chrono/fea/ChElementCableANCF.h"
15 #include "chrono/fea/ChElementBeamEuler.h"
16 #include "chrono/fea/ChBeamSection.h"
17 #include "chrono/fea/ChMesh.h"
18 #include "chrono/fea/ChLinkPointPoint.h"
19 #include "chrono/fea/ChLinkPointFrame.h"
20 #include "chrono/fea/ChLinkDirFrame.h"
21 #include "chrono/fea/ChLoadsBeam.h"
22 #include "chrono/fea/ChContactSurfaceNodeCloud.h"
23 #include "chrono/timestepper/ChTimestepper.h"
24 #include "chrono/solver/ChSolverPMINRES.h"
25 #include "chrono/core/ChTransform.h"
26 
27 
28 //using namespace std;
29 using namespace chrono;
30 using namespace chrono::fea;
31 using namespace chrono::collision;
32 using namespace chrono::geometry;
33 
34 
35 // override some functions of ChElement
36 
37 class ChElementCableANCFmod : public ChElementCableANCF {
38 private:
39  ChVectorN<double, 12> m_GenForceVec0;
40  virtual void SetupInitial(ChSystem* system) override {
41  assert(GetSection());
42 
43  // Compute rest length, mass:
44  //double length2 = (nodes[1]->GetX0() - nodes[0]->GetX0()).Length();
45  //this->mass = this->length * GetSection()->Area * GetSection()->density;
46  this->mass = this->length * GetDensity();
47 
48  // Here we calculate the internal forces in the initial configuration
49  // Contribution of initial configuration in elastic forces is automatically subtracted
50  ChVectorDynamic<> FVector0(12);
51  FVector0.setZero();
52  m_GenForceVec0.setZero();
53  ComputeInternalForces(FVector0);
54  m_GenForceVec0 = FVector0;
55 
56  // Compute mass matrix
57  ComputeMassMatrix();
58  };
59 };
60 
61 class ChElementBeamEulermod : public ChElementBeamEuler {
62 private:
63  ChQuaternion<> q_element_ref_rot;
64  virtual void SetupInitial(ChSystem* system) override {
65  assert(GetSection());
66 
67  // Compute rest length, mass:
68  //this->length = (nodes[1]->GetX0().GetPos() - nodes[0]->GetX0().GetPos()).Length();
69  //this->mass = this->length * GetSection()->Area * GetSection()->density;
70  this->mass = this->length * GetDensity();
71 
72  // Compute initial rotation
73  ChMatrix33<> A0;
74  auto node0 = GetNodeA();
75  auto node1 = GetNodeB();
76  ChVector<> mXele = node1->GetX0().GetPos() - node0->GetX0().GetPos();
77  ChVector<> myele = node0->GetX0().GetA().Get_A_Yaxis();
78  A0.Set_A_Xdir(mXele, myele);
79  q_element_ref_rot = A0.Get_A_quaternion();
80 
81  // Compute local stiffness matrix:
82  ComputeStiffnessMatrix();
83  };
84 };
85 
86 
87 class MyLoaderTriangular : public ChLoaderUdistributed {
88  public:
89  // Useful: a constructor that also sets ChLoadable
90  ChVector<> Fa;
91  ChVector<> Fb;
92  MyLoaderTriangular(std::shared_ptr<ChLoadableU> mloadable):
93  ChLoaderUdistributed(mloadable) {
94  Fa = ChVector<>(0.,0.,0.);
95  Fb = ChVector<>(0.,0.,0.);
96  };
97  // Compute F=F(u)
98  // This is the function that you have to implement. It should return the
99  // load at U. For Eulero beams, loads are expected as 6-rows vectors, containing
100  // a wrench: forceX, forceY, forceZ, torqueX, torqueY, torqueZ.
101  virtual void ComputeF(const double U,
102  ChVectorDynamic<>& F,
103  ChVectorDynamic<>* state_x,
104  ChVectorDynamic<>* state_w
105  ) {
106  double Fy_max = 0.005;
107  ChVector<> force = Fa*abs(-1+U)/2.+Fb*(1+U)/2.;
108  F(0) = force.x();
109  F(1) = force.y();
110  F(2) = force.z();
111  }
112  void SetF(ChVector<> Fa_in, ChVector<> Fb_in) {
113  Fa = Fa_in;
114  Fb = Fb_in;
115  }
116  // Needed because inheriting ChLoaderUdistributed. Use 1 because linear load fx.
117  virtual int GetIntegrationPointsU() { return 1; }
118 };
119 // Create the load (and handle it with a shared pointer).
120 // The ChLoad is a 'container' for your ChLoader.
121 // It is created using templates, that is instancing a ChLoad<a_loader_class>()
122 //std::shared_ptr<ChLoad<MyLoaderTriangular>> mloadtri(new ChLoad<MyLoaderTriangular>(melementA));
123 //mloadcontainer->Add(mloadtri); // do not forget to add the load to the load container.
124 
125 
126 class cppCable {
127  public:
128  std::shared_ptr<ChSystem> system; // global system
129  std::shared_ptr<ChMesh> mesh; // mesh
130  int nb_elems; // number of nodes along cable
131  std::vector<double> length_per_elem; // length of each element on the cable
132  double Cd_axial; // drag coeff in axial direction
133  double Cd_normal; // drag coeff in normal direction
134  double Cm_axial; // added mass coeff in axial direction
135  double Cm_normal; // added mass coeff in normal direction
136  std::vector<ChVector<>> mvecs; // vectors (nodes coordinates)
137  std::vector<ChVector<>> mvecs_tangents; // vectors (tangents at nodes coordinates)
138  std::vector<ChVector<>> mvecs_middle;
139  std::vector<ChVector<>> mdirs; // vectors (nodes coordinates)
140  double d, rho, E, length; // diameter, density, Young's modulus, length of cable
141  double A0; // unstretched diameter
142  double L0 = 0; // initial length along cable
143  double Iyy;
144  int nb_nodes;
145  bool applyDrag;
148  std::string beam_type;
149  std::vector<std::shared_ptr<ChNodeFEAxyzD>> nodes; // array nodes coordinates and direction
150  std::vector<std::shared_ptr<ChNodeFEAxyzDD>> nodesDD; // array nodes coordinates and direction
151  std::vector<std::shared_ptr<ChElementCableANCF>> elemsCableANCF; // array of elements */
152  std::vector<std::shared_ptr<ChElementBeamEuler>> elemsBeamEuler; // array of elements */
153  std::vector<std::shared_ptr<ChNodeFEAxyzrot>> nodesRot; // array nodes coordinates and direction
154  std::vector<std::shared_ptr<ChElementCableANCF>> elems_cable; // array of elements */
155  std::shared_ptr<ChBeamSectionCable> msection_cable; // cable material
156  std::shared_ptr<ChBeamSectionAdvanced> msection_advanced; // cable material
157  std::vector<double> elems_length; // array of elements
158  std::vector<ChVector<>> fluid_velocity;
159  std::vector<ChVector<>> fluid_acceleration;
160  std::vector<double> fluid_density;
161  std::vector<double> nodes_density; // density of (cable-fluid) at nodes
162  cppCable(std::shared_ptr<ChSystem> system, std::shared_ptr<ChMesh> mesh, double length,
163  int nb_elems, double d, double rho, double E, double L0, std::string beam_type); // constructor
164  void setFluidVelocityAtNodes(std::vector<ChVector<>> vel);
165  void setFluidAccelerationAtNodes(std::vector<ChVector<>> acc);
166  void setFluidDensityAtNodes(std::vector<double> vof);
167  std::vector<std::shared_ptr<ChVector<double>>> getNodalPositions();
168  std::vector<std::shared_ptr<ChVector<double>>> forces_drag;
169  std::vector<std::shared_ptr<ChVector<double>>> forces_addedmass;
170  /* std::vector<std::shared_ptr<ChLoadBeamWrenchDistributed>> elems_loads_distributed; */
171  std::vector<std::shared_ptr<ChLoad<MyLoaderTriangular>>> elems_loads_triangular;
172  std::vector<std::shared_ptr<ChLoad<ChLoaderGravity>>> elems_loads_volumetric;
173  /* std::vector<std::shared_ptr<ChLoadBeamWrench>> elems_loads; */
174  void buildVectors(); // builds location vectors for the nodes
175  void buildNodes(bool last_node); // builds the nodes for the mesh
176  void buildNodesBeamEuler(bool last_node); // builds the nodes for the mesh
177  void buildNodesCableANCF(bool last_node); // builds the nodes for the mesh
178  void buildElements(bool set_lastnodes); // builds the elements for the mesh
179  void buildElementsBeamEuler(bool set_lastnodes); // builds the elements for the mesh
180  void buildElementsCableANCF(bool set_lastnodes); // builds the elements for the mesh
181  void buildMesh(bool add_lastnode); // builds the mesh
182  void buildMeshBeamEuler(bool add_lastnode); // builds the mesh
183  void buildMeshCableANCF(bool add_lastnode); // builds the mesh
184  void setDragForce(); // calculates the drag force per nodes
185  void setAddedMassForce(); // calculates the added mass force per nodes
186  void applyForces();
187  void addNodestoContactCloud(std::shared_ptr<ChContactSurfaceNodeCloud> cloud);
188  void setDragCoefficients(double axial, double normal);
189  void setAddedMassCoefficients(double axial, double normal);
190  void setRestLengthPerElement(std::vector<double> length_array);
191  void setIyy(double Iyy_in);
192 };
193 
195  public:
196  std::shared_ptr<ChSystem> system; // global system
197  std::string beam_type;
198  std::shared_ptr<ChMaterialSurfaceSMC> mysurfmaterial;
199  std::shared_ptr<ChMesh> mesh; // mesh
200  std::shared_ptr<ChBody> fairleadd;
201  std::shared_ptr<ChLinkPointFrame> fairlead2;
202  std::vector<int> nb_nodes; // number of nodes along cable
203  std::vector<int> nb_elems; // number of nodes along cable
204  std::vector<ChVector<>> mvecs; // vectors (nodes coordinates)
205  std::vector<std::shared_ptr<cppCable>> cables;
206  std::shared_ptr<ChMaterialSurfaceSMC> contact_material; // mesh
207  std::vector<double> d;
208  std::vector<double> rho;
209  std::vector<double> E;
210  std::vector<double> length; // diameter, density, Young's modulus, length of cable
211  std::vector<std::shared_ptr<ChNodeFEAxyzD>> nodes; // array nodes coordinates and direction
212  std::vector<std::shared_ptr<ChNodeFEAxyzDD>> nodesDD; // array nodes coordinates and direction
213  std::vector<std::shared_ptr<ChNodeFEAxyzrot>> nodesRot; // array nodes coordinates and direction
214  std::vector<ChVector<>> fluid_velocity;
215  std::vector<ChVector<>> fluid_acceleration;
216  std::vector<double> fluid_density;
217  std::vector<std::shared_ptr<ChElementCableANCF>> elemsCableANCF; // array of elements */
218  std::vector<std::shared_ptr<ChElementBeamEuler>> elemsBeamEuler; // array of elements */
219  std::shared_ptr<ChLinkBase> constraint_front;
220  std::shared_ptr<ChLinkBase> constraint_back;
221  std::vector<std::shared_ptr<ChVector<double>>> forces_drag;
222  std::vector<std::shared_ptr<ChVector<double>>> forces_addedmass;
223  std::shared_ptr<ChBody> body_back;
224  std::shared_ptr<ChBody> body_front;
230  cppMultiSegmentedCable(std::shared_ptr<ChSystem> system,
231  std::shared_ptr<ChMesh> mesh,
232  std::vector<double> length,
233  std::vector<int> nb_nodes,
234  std::vector<double> d,
235  std::vector<double> rho,
236  std::vector<double> E,
237  std::string beam_type);
238  void setFluidVelocityAtNodes(std::vector<ChVector<>> vel);
239  void setFluidAccelerationAtNodes(std::vector<ChVector<>> vel);
240  void setFluidDensityAtNodes(std::vector<double> dens);
241  void updateDragForces();
242  void updateAddedMassForces();
243  void applyForces();
244  std::vector<std::shared_ptr<ChVector<double>>> getNodalPositions();
245  void buildNodes();
246  void buildElements();
247  void buildCable(); // builds the multi-segmented cable
249 
250  void attachBackNodeToBody(std::shared_ptr<ChBody> body);
251  void attachFrontNodeToBody(std::shared_ptr<ChBody> body);
252  void setContactMaterial(std::shared_ptr<ChMaterialSurfaceSMC> material);
253  void buildNodesCloud();
254  ChVector<> getTensionElement(int i, double eta);
255 };
256 
257 
258 cppMultiSegmentedCable::cppMultiSegmentedCable(std::shared_ptr<ChSystem> system,
259  std::shared_ptr<ChMesh> mesh,
260  std::vector<double> length,
261  std::vector<int> nb_elems,
262  std::vector<double> d,
263  std::vector<double> rho,
264  std::vector<double> E,
265  std::string beam_type="CableANCF"):
266 system(system),
267  mesh(mesh),
268  length(length),
269  nb_elems(nb_elems),
270  d(d),
271  rho(rho),
272  E(E),
273  beam_type(beam_type)
274 {
275  nodes_built = false;
276  elems_built = false;
277  nodes_chlink = true; // build links (true) or link elements directly (false)
278 
279  std::shared_ptr<cppCable> segment;
280  double L0 = 0;
281  for (int i = 0; i < length.size(); ++i) {
282  segment = std::make_shared<cppCable>(system,
283  mesh,
284  length[i],
285  nb_elems[i],
286  d[i],
287  rho[i],
288  E[i],
289  L0,
290  beam_type);
291  cables.push_back(segment);
292  L0 = L0 + length[i];
293  }
294 }
295 
297  nodes.clear();
298  nodesRot.clear();
299  for (int i = 0; i < cables.size(); ++i) {
300  if (beam_type == "BeamEuler") {
301  cables[i]->buildNodes(true);
302  nodesRot.insert(nodesRot.end(),
303  cables[i]->nodesRot.begin(),
304  cables[i]->nodesRot.end());
305  nb_nodes_tot = nodesRot.size();
306  }
307  else if (beam_type == "CableANCF") {
308  if (nodes_chlink == false && i < cables.size()-1) {
309  cables[i]->buildNodes(false);
310  }
311  else {
312  cables[i]->buildNodes(true);
313  }
314  nodes.insert(nodes.end(),
315  cables[i]->nodes.begin(),
316  cables[i]->nodes.end());
317  nb_nodes_tot = nodes.size();
318  }
319  }
320  nodes_built = true;
321 }
322 
324  elemsCableANCF.clear();
325  elemsBeamEuler.clear();
326  for (int i = 0; i < cables.size(); ++i) {
327  if (i < cables.size()-1 && nodes_chlink == false) {
328  cables[i]->buildElements(false);
329  if (beam_type == "CableANCF") {
330  cables[i]->elemsCableANCF[cables[i]->elemsCableANCF.size()-1]->SetNodes(cables[i]->nodes[cables[i]->nodes.size()-1], cables[i+1]->nodes[0]);
331  }
332  else if (beam_type == "BeamEuler") {
333  cables[i]->elemsBeamEuler[cables[i]->elemsBeamEuler.size()-1]->SetNodes(cables[i]->nodesRot[cables[i]->nodesRot.size()-1], cables[i+1]->nodesRot[0]);
334  }
335  }
336  else {
337  cables[i]->buildElements(true);
338  }
339  if (beam_type == "CableANCF") {
340  elemsCableANCF.insert(elemsCableANCF.end(), cables[i]->elemsCableANCF.begin(), cables[i]->elemsCableANCF.end());
341  nb_elems_tot = elemsCableANCF.size();
342  }
343  else if (beam_type == "BeamEuler") {
344  elemsBeamEuler.insert(elemsBeamEuler.end(), cables[i]->elemsBeamEuler.begin(), cables[i]->elemsBeamEuler.end());
345  nb_elems_tot = elemsBeamEuler.size();
346  }
347  }
348  elems_built = true;
349 }
350 
352  /* builds all cable segments and updates their link
353  (no duplicate node added to mesh) */
354  if (nodes_built == false) {
355  buildNodes();
356  }
357  if (elems_built == false) {
358  buildElements();
359  }
360  for (int i = 0; i < cables.size(); ++i) {
361  if (i < cables.size()-1 && nodes_chlink == false) {
362  cables[i]->buildMesh(false);
363  }
364  else {
365  cables[i]->buildMesh(true);
366  }
367  if (nodes_chlink == true) {
368  if (i>0) {
369  if (beam_type == "BeamEuler") {
370  auto con1 = chrono_types::make_shared<ChLinkMateSpherical>();
371  auto nodeA = cables[i]->nodesRot.front();
372  auto nodeB = cables[i-1]->nodesRot.back();
373  con1->Initialize(nodeA, nodeB, false, nodeA->GetPos(), nodeA->GetPos());
374  system->Add(con1);
375  }
376  else if (beam_type == "CableANCF") {
377  auto con1 = chrono_types::make_shared<ChLinkPointPoint>();
378  auto nodeA = cables[i]->nodes.front();
379  auto nodeB = cables[i-1]->nodes.back();
380  con1->Initialize(nodeA, nodeB);
381  system->Add(con1);
382  }
383  }
384  }
385  forces_drag.insert(forces_drag.end(), cables[i]->forces_drag.begin(), cables[i]->forces_drag.end());
386  forces_addedmass.insert(forces_addedmass.end(), cables[i]->forces_addedmass.begin(), cables[i]->forces_addedmass.end());
387  }
388  buildNodesCloud();
389  fluid_velocity.clear();
390  fluid_acceleration.clear();
391  fluid_density.clear();
392  if (beam_type == "BeamEuler") {
393  nb_nodes_tot = nodesRot.size();
394  }
395  else if (beam_type == "CableANCF") {
396  nb_nodes_tot = nodes.size();
397  }
398  for (int i = 0; i < nb_nodes_tot; ++i) {
399  fluid_velocity.push_back(ChVector<>(0.,0.,0.));
400  fluid_acceleration.push_back(ChVector<>(0.,0.,0.));
401  fluid_density.push_back(0.);
402  }
406 }
407 
409  fluid_acceleration = acc;
410  int node_nb = 0;
411  int node_nb_prev = node_nb;
412  for (int i = 0; i < cables.size(); ++i) {
413  if (beam_type == "BeamEuler") {
414  node_nb += cables[i]->nodesRot.size();
415  }
416  else if (beam_type == "CableANCF") {
417  node_nb += cables[i]->nodes.size();
418  }
419  std::vector<ChVector<>> fluid_acc(fluid_acceleration.begin()+node_nb_prev,
420  fluid_acceleration.begin()+node_nb);
421  cables[i]->setFluidAccelerationAtNodes(fluid_acc);
422  node_nb_prev = node_nb;
423  }
424 }
425 
428  int node_nb = 0;
429  int node_nb_prev = node_nb;
430  for (int i = 0; i < cables.size(); ++i) {
431  if (beam_type == "BeamEuler") {
432  node_nb += cables[i]->nodesRot.size();
433  }
434  else if (beam_type == "CableANCF") {
435  node_nb += cables[i]->nodes.size();
436  }
437  std::vector<ChVector<>> fluid_vel(fluid_velocity.begin()+node_nb_prev,
438  fluid_velocity.begin()+node_nb);
439  cables[i]->setFluidVelocityAtNodes(fluid_vel);
440  node_nb_prev = node_nb;
441  }
442 }
443 
444 void cppMultiSegmentedCable::setFluidDensityAtNodes(std::vector<double> dens) {
445  fluid_density = dens;
446  int node_nb = 0;
447  int node_nb_prev = 0;
448  for (int i = 0; i < cables.size(); ++i) {
449  if (beam_type == "BeamEuler") {
450  node_nb += cables[i]->nodesRot.size();
451  }
452  else if (beam_type == "CableANCF") {
453  node_nb += cables[i]->nodes.size();
454  }
455  std::vector<double> fluid_dens(fluid_density.begin()+node_nb_prev,
456  fluid_density.begin() + node_nb);
457  cables[i]->setFluidDensityAtNodes(fluid_dens);
458  node_nb_prev = node_nb;
459  }
460 }
461 
462 
464  for (int i = 0; i < cables.size(); ++i) {
465  cables[i]->setDragForce();
466  };
467 }
468 
470  for (int i = 0; i < cables.size(); ++i) {
471  cables[i]->setAddedMassForce();
472  };
473 }
474 
476  for (int i = 0; i < cables.size(); ++i) {
477  cables[i]->applyForces();
478  };
479 }
480 
481 ChVector<> cppMultiSegmentedCable::getTensionElement(int i, const double eta=0.) {
482 
483  auto force = ChVector<>();
484  auto torque = ChVector<>();
485  if (beam_type == "CableANCF") {
486  elemsCableANCF[i]->EvaluateSectionForceTorque(eta,
487  force,
488  torque);
489  elemsCableANCF[i]->EvaluateSectionStrain(eta,
490  force);
491  }
492  else if (beam_type == "BeamEuler") {
493  auto mat2 = ChMatrixDynamic<>();
494  elemsBeamEuler[i]->EvaluateSectionForceTorque(eta,
495  force,
496  torque);
497  }
498  return force;
499 }
500 
501 std::vector<std::shared_ptr<ChVector<double>>> cppMultiSegmentedCable::getNodalPositions() {
502  std::vector<std::shared_ptr<ChVector<double>>> nodal_positions;
503  for (int i = 0; i < nodes.size(); ++i) {
504  auto pos = nodes[i]->GetPos();
505  double x = pos.x();
506  double y = pos.y();
507  double z = pos.z();
508  auto nodal_position = chrono_types::make_shared<ChVector<double>>(x, y, z);
509  nodal_positions.push_back(nodal_position);
510  }
511  return nodal_positions;
512 }
513 
514 void cppMultiSegmentedCable::attachBackNodeToBody(std::shared_ptr<ChBody> body) {
515  if (beam_type == "BeamEuler") {
516  auto constraint = chrono_types::make_shared<ChLinkMateSpherical>();
517  constraint->Initialize(nodesRot.back(), body, false, nodesRot.back()->GetPos(), nodesRot.back()->GetPos());
518  system->Add(constraint);
519  body_back = body;
520  constraint_back = constraint;
521  }
522  else {
523  auto constraint = chrono_types::make_shared<ChLinkPointFrame>();
524  constraint->Initialize(nodes.back(), body);
525  system->Add(constraint);
526  body_back = body;
527  constraint_back = constraint;
528  }
529 };
530 
531 void cppMultiSegmentedCable::attachFrontNodeToBody(std::shared_ptr<ChBody> body) {
532  if (beam_type == "BeamEuler") {
533  auto constraint = chrono_types::make_shared<ChLinkMateSpherical>();
534  constraint->Initialize(nodesRot.front(), body, false, nodesRot.front()->GetPos(), nodesRot.front()->GetPos());
535  system->Add(constraint);
536  body_front = body;
537  constraint_front = constraint;
538  }
539  else if (beam_type == "CableANCF") {
540  auto constraint = chrono_types::make_shared<ChLinkPointFrame>();
541  constraint->Initialize(nodes.front(), body);
542  system->Add(constraint);
543  body_front = body;
544  constraint_front = constraint;
545  }
546 };
547 
548 void cppMultiSegmentedCable::setContactMaterial(std::shared_ptr<ChMaterialSurfaceSMC> material) {
549  contact_material = material;
550 };
551 
553  if (contact_material) {
554  // Use DEM surface material properties
555  auto contact_cloud = chrono_types::make_shared<ChContactSurfaceNodeCloud>(contact_material);
556  //auto contact_cloud = chrono_types::make_shared<ChContactSurfaceNodeCloud>();
557  mesh->AddContactSurface(contact_cloud);
558  //contact_cloud->SetMaterialSurface(contact_material);
559  // add cable nodes to cloud
560  for (int i = 0; i < cables.size(); ++i) {
561  cables[i]->addNodestoContactCloud(contact_cloud);
562  }
563  }
564 };
565 
566 
567 cppCable::cppCable(std::shared_ptr<ChSystem> system, // system in which the cable belong
568  std::shared_ptr<ChMesh> mesh, // mesh of the cable
569  double length, // length of cable
570  int nb_elems, // number of nodes along cable
571  double d, // diameter of cable
572  double rho, // density of cable (kg/m3)
573  double E, // Young's modulus
574  double L0 = 0,
575  std::string beam_type = "CableANCF"
576  ) :
577  system(system),
578  mesh(mesh),
579  length(length),
580  nb_elems(nb_elems),
581  d(d),
582  rho(rho),
583  E(E),
584  L0(L0),
585  beam_type(beam_type)
586 {
587  Cd_axial = 1.15; // studless chain
588  Cd_normal = 1.4; // studless chain
589  Cm_axial = 0.5; //studless chain
590  Cm_normal = 1.; // studless chain
591  A0 = d*d/4*M_PI;
592  /* Iyy = 1e-12; */
593  applyDrag = true;
594  applyAddedMass = true;
595  applyBuoyancy = true;
596  for (int i = 0; i < nb_elems; i++) {
597  length_per_elem.push_back(length/nb_elems);
598  }
599  if (beam_type == "CableANCF") {
600  msection_cable = chrono_types::make_shared<ChBeamSectionCable>();
601  msection_cable->SetDiameter(d);
602  msection_cable->SetYoungModulus(E);
603  msection_cable->SetDensity(rho);
604  /* msection_cable->SetI(Iyy); */
605  Iyy = msection_cable->GetI();
606  }
607  else if (beam_type == "BeamEuler") {
608  msection_advanced = chrono_types::make_shared<ChBeamSectionAdvanced>();
609  msection_advanced->SetYoungModulus(E);
610  msection_advanced->SetGshearModulus(1e-6);
611  msection_advanced->SetDensity(rho);
612  msection_advanced->SetAsCircularSection(d);
613  /* msection_advanced->SetIyy(Iyy); */
614  /* msection_advanced->SetIzz(Iyy); */
615  Iyy = msection_advanced->GetIyy();
616  }
617 }
618 
619 void cppCable::setIyy(double Iyy_in) {
620  Iyy = Iyy_in;
621  if (beam_type == "CableANCF") {
622  msection_cable->SetI(Iyy);
623  }
624  else if (beam_type == "BeamEuler") {
625  msection_advanced->SetIyy(Iyy);
626  msection_advanced->SetIzz(Iyy);
627  }
628 }
629 
630 void cppCable::buildNodes(bool last_node=true) {
631  if (beam_type == "CableANCF") {buildNodesCableANCF(last_node);}
632  else if (beam_type == "BeamEuler") {buildNodesBeamEuler(last_node);}
633 }
634 
635 void cppCable::buildNodesBeamEuler(bool last_node) {
636  nodesRot.clear();
637  forces_drag.clear();
638  forces_addedmass.clear();
639  std::shared_ptr<ChNodeFEAxyzrot> node;
640  ChVector<> dir; // direction of node
641  ChVector<> ref = ChVector<>(1.,0.,0.);
642  ChQuaternion<> frame_quat;
643  for (int i = 0; i < mvecs.size() - 1; ++i) {
644  dir = mvecs_tangents[i];
645  dir.Normalize();
646  double ang = acos(dir^ref); // inner product
647  auto axis = ref%dir; // cross product
648  frame_quat.Q_from_AngAxis(ang, axis);
649  node = chrono_types::make_shared<ChNodeFEAxyzrot>(ChFrame<>(mvecs[i],
650  frame_quat));
651  nodesRot.push_back(node);
652  std::shared_ptr<ChVector<>> drag0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
653  std::shared_ptr<ChVector<>> am0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
654  forces_drag.push_back(drag0);
655  forces_addedmass.push_back(am0);
656  } // last node
657  if (last_node == true) {
658  dir = mvecs_tangents[mvecs.size()-1];
659  dir.Normalize();
660  double ang = -acos(dir^ref); // inner product
661  auto axis = ref%dir; // cross product
662  frame_quat.Q_from_AngAxis(ang, axis);
663  node = chrono_types::make_shared<ChNodeFEAxyzrot>(ChFrame<>(mvecs[mvecs.size()-1],
664  frame_quat));
665  nodesRot.push_back(node);
666  nb_nodes = nodesRot.size();
667  nb_elems = nb_nodes-1;
668  std::shared_ptr<ChVector<>> drag0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
669  std::shared_ptr<ChVector<>> am0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
670  forces_drag.push_back(drag0);
671  forces_addedmass.push_back(am0);
672  }
673  else {
674  nb_nodes = nodesRot.size();
675  nb_elems = nb_nodes;
676  }
677 }
678 
679 void cppCable::buildNodesCableANCF(bool last_node) {
680  nodes.clear();
681  forces_drag.clear();
682  forces_addedmass.clear();
683  std::shared_ptr<ChNodeFEAxyzD> node;
684  ChVector<> dir; // direction of node
685  ChCoordsys<> coordsys; // coordinate system of node
686  for (int i = 0; i < mvecs.size() - 1; ++i) {
687  dir = mvecs_tangents[i];
688  dir.Normalize();
689  node = chrono_types::make_shared<ChNodeFEAxyzD>(mvecs[i], dir);
690  nodes.push_back(node);
691  std::shared_ptr<ChVector<>> drag0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
692  std::shared_ptr<ChVector<>> am0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
693  forces_drag.push_back(drag0);
694  forces_addedmass.push_back(am0);
695  } // last node
696  if (last_node == true) {
697  dir = mvecs_tangents[mvecs_tangents.size()-1];
698  dir.Normalize();
699  node = chrono_types::make_shared<ChNodeFEAxyzD>(mvecs[mvecs.size()-1], dir);
700  nodes.push_back(node);
701  nb_nodes = nodes.size();
702  nb_elems = nb_nodes-1;
703  std::shared_ptr<ChVector<>> drag0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
704  std::shared_ptr<ChVector<>> am0 = chrono_types::make_shared<ChVector<>>(0.,0.,0.);
705  forces_drag.push_back(drag0);
706  forces_addedmass.push_back(am0);
707  }
708  else {
709  nb_nodes = nodes.size();
710  nb_elems = nb_nodes;
711  }
712 }
713 
714 void cppCable::buildElements(bool set_lastnodes=true) {
715  if (beam_type == "CableANCF") {
716  buildElementsCableANCF(set_lastnodes);
717  }
718  else if (beam_type == "BeamEuler") {
719  buildElementsBeamEuler(set_lastnodes);
720  }
721 }
722 
723 void cppCable::buildElementsCableANCF(bool set_lastnodes) {
724  auto loadcontainer = chrono_types::make_shared<ChLoadContainer>();
725  system->Add(loadcontainer);
726  // build elements
727  elemsCableANCF.clear();
728  /* elems_loads_distributed.clear(); */
729  elems_loads_volumetric.clear();
730  elems_loads_triangular.clear();
731  /* elems_loads.clear(); */
732  for (int i = 0; i < nb_elems; ++i) {
733  auto element = chrono_types::make_shared<ChElementCableANCFmod>();
734  auto load_distributed = chrono_types::make_shared<ChLoadBeamWrenchDistributed>(element);
735  auto load = chrono_types::make_shared<ChLoadBeamWrench>(element);
736  std::shared_ptr<ChLoad<MyLoaderTriangular>> loadtri(new ChLoad<MyLoaderTriangular>(element));
737  auto load_volumetric = chrono_types::make_shared<ChLoad<ChLoaderGravity>>(element);
738  load_volumetric->loader.Set_G_acc(system->Get_G_acc());
739  /* loadcontainer->Add(load_distributed); */
740  /* loadcontainer->Add(load); */
741  loadcontainer->Add(loadtri); // do not forget to add the load to the load container.
742  loadcontainer->Add(load_volumetric);
743  elemsCableANCF.push_back(element);
744  /* elems_loads_distributed.push_back(load_distributed); */
745  /* elems_loads.push_back(load); */
746  elems_loads_triangular.push_back(loadtri);
747  elems_loads_volumetric.push_back(load_volumetric);
748  element->SetSection(msection_cable);
749  element->SetRestLength(length_per_elem[i]);
750  if (i < nb_elems-1) {
751  element->SetNodes(nodes[i], nodes[i + 1]);
752  }
753  else {
754  if (set_lastnodes == true) {
755  element->SetNodes(nodes[i], nodes[i + 1]);
756  }
757  }
758  }
759 }
760 
761 void cppCable::buildElementsBeamEuler(bool set_lastnodes) {
762  auto loadcontainer = chrono_types::make_shared<ChLoadContainer>();
763  system->Add(loadcontainer);
764  // build elements
765  elemsBeamEuler.clear();
766  /* elems_loads_distributed.clear(); */
767  elems_loads_triangular.clear();
768  /* elems_loads.clear(); */
769  for (int i = 0; i < nodesRot.size() - 1; ++i) {
770  auto element = chrono_types::make_shared<ChElementBeamEulermod>();
771  auto load_distributed = chrono_types::make_shared<ChLoadBeamWrenchDistributed>(element);
772  auto load = chrono_types::make_shared<ChLoadBeamWrench>(element);
773  std::shared_ptr<ChLoad<MyLoaderTriangular>> loadtri(new ChLoad<MyLoaderTriangular>(element));
774  auto load_volumetric = chrono_types::make_shared<ChLoad<ChLoaderGravity>>(element);
775  load_volumetric->loader.Set_G_acc(system->Get_G_acc());
776  /* loadcontainer->Add(load_distributed); */
777  /* loadcontainer->Add(load); */
778  loadcontainer->Add(loadtri); // do not forget to add the load to the load container.
779  loadcontainer->Add(load_volumetric);
780  elemsBeamEuler.push_back(element);
781  /* elems_loads_distributed.push_back(load_distributed); */
782  /* elems_loads.push_back(load); */
783  elems_loads_triangular.push_back(loadtri);
784  elems_loads_volumetric.push_back(load_volumetric);
785  element->SetSection(msection_advanced);
786  element->SetRestLength(length/nb_elems);
787  if (i < nb_elems-1) {
788  element->SetNodes(nodesRot[i], nodesRot[i + 1]);
789  }
790  else {
791  if (set_lastnodes == true) {
792  element->SetNodes(nodesRot[i], nodesRot[i + 1]);
793  }
794  }
795  }
796 }
797 
798 void cppCable::buildMesh(bool add_lastnode=true) {
799  if (beam_type == "CableANCF") {
800  buildMeshCableANCF(add_lastnode);
801  }
802  else if (beam_type == "BeamEuler") {
803  buildMeshBeamEuler(add_lastnode);
804  }
805 }
806 
807 void cppCable::buildMeshBeamEuler(bool add_lastnode) {
808  // build the mesh (nodes and elements)
809  auto node = elemsBeamEuler[0]->GetNodeA();
810  mesh->AddNode(node);
811  for (int i = 0; i < elemsBeamEuler.size()-1; ++i) {
812  auto node = elemsBeamEuler[i]->GetNodeB();
813  mesh->AddNode(node);
814  mesh->AddElement(elemsBeamEuler[i]);
815  }
816  if (add_lastnode == true) {
817  auto node = elemsBeamEuler[elemsBeamEuler.size()-1]->GetNodeB();
818  mesh->AddNode(node);
819  }
820  mesh->AddElement(elemsBeamEuler[elemsBeamEuler.size()-1]);
821 }
822 
823 void cppCable::buildMeshCableANCF(bool add_lastnode) {
824  // build the mesh (nodes and elements)
825  auto node = elemsCableANCF[0]->GetNodeA();
826  mesh->AddNode(node);
827  for (int i = 0; i < elemsCableANCF.size()-1; ++i) {
828  auto node = elemsCableANCF[i]->GetNodeB();
829  mesh->AddElement(elemsCableANCF[i]);
830  mesh->AddNode(node);
831  }
832  if (add_lastnode == true) {
833  auto node = elemsCableANCF[elemsCableANCF.size()-1]->GetNodeB();
834  mesh->AddNode(node);
835  }
836  mesh->AddElement(elemsCableANCF[elemsCableANCF.size()-1]);
837 }
839  fluid_acceleration = acc;
840 }
841 
844 }
845 
846 void cppCable::setFluidDensityAtNodes(std::vector<double> dens) {
847  fluid_density = dens;
848 }
849 
850 void cppCable::setDragCoefficients(double axial, double normal) {
851  Cd_axial = axial;
852  Cd_normal = normal;
853 }
854 
855 
856 void cppCable::setAddedMassCoefficients(double axial, double normal) {
857  Cm_axial = axial;
858  Cm_normal = normal;
859 }
860 
861 void cppCable::setRestLengthPerElement(std::vector<double> length_array) {
862  length_per_elem = length_array;
863 }
864 
866  /*
867  * setFluidVelocityAtNodes and setFluidDensityAtNodes
868  * must be called before this function
869  */
870  ChVector<> u_ch; // velocity from chrono
871  ChVector<> u_prot; // velocity from proteus
872  ChVector<> u_rel; // relative velocity of node with surrounding fluid
873  ChVector<> t_dir; // tangent at node
874  ChVector<> Fd_a; // axial (tangential) drag force
875  ChVector<> Fd_n; // normal(transversal) drag force
876  ChVector<> Fd; // total drag force
877  ChVector<> Va;
878  ChVector<> Vn;
879  double rho_f;
880  // clear current drag forces
881  double length_elem = length / (nb_nodes - 1);
882  for (int i = 0; i < nb_nodes; ++i) {
883  if (beam_type == "CableANCF") {
884  t_dir = nodes[i]->GetD();
885  u_ch = nodes[i]->GetPos_dt();
886  }
887  else if (beam_type == "BeamEuler") {
888  t_dir = nodesRot[i]->GetRot().GetVector();
889  u_ch = nodesRot[i]->GetPos_dt();
890  }
891  // get velocity u_prot from proteus // TO CHANGE !!
892  double ux_prot = fluid_velocity[i][0];
893  double uy_prot = fluid_velocity[i][1];
894  double uz_prot = fluid_velocity[i][2];
895  u_prot = ChVector<>(ux_prot, uy_prot, uz_prot);
896  u_rel = u_prot - u_ch;
897  // CAREFUL HERE: ChBeamElementANCF, GetD() does not give direction but normal
898  rho_f = fluid_density[i];
899  double dot = u_rel^t_dir;
900  Va = t_dir*dot;
901  Vn = u_rel-Va;
902  Fd_a = 0.5*rho_f*Cd_axial*M_PI*d*Va.Length()*Va;//(force per unit length)
903  Fd_n = 0.5*rho_f*Cd_normal*d*Vn.Length()*Vn;//(force per unit length)
904  Fd = Fd_a + Fd_n;
905  forces_drag[i]->Set(Fd);
906  }
907 }
908 
909 
911  /*
912  * setFluidVelocityAtNodes and setFluidDensityAtNodes
913  * must be called before this function
914  */
915  ChVector<> a_ch; // acceleration from chrono
916  ChVector<> a_prot; // acceleration from proteus
917  ChVector<> a_rel; // relative acceleration of node with surrounding fluid
918  ChVector<> t_dir; // tangent at node
919  ChVector<> Fm_a; // axial (tangential) added mass force
920  ChVector<> Fm_n; // normal(transversal) added mass force
921  ChVector<> Fm_f; // fluid part added mass force
922  ChVector<> Fm; // total added mass force
923  ChVector<> Va;
924  ChVector<> Vn;
925  double rho_f;
926  // clear current drag forces
927  double length_elem = length / (nb_nodes - 1);
928  for (int i = 0; i < nb_nodes; ++i) {
929  if (beam_type == "CableANCF") {
930  t_dir = nodes[i]->GetD();
931  a_ch = nodes[i]->GetPos_dtdt();
932  }
933  else if (beam_type == "BeamEuler") {
934  t_dir = nodesRot[i]->GetRot().GetVector();
935  a_ch = nodesRot[i]->GetPos_dtdt();
936  }
937  // get velocity u_prot from proteus // TO CHANGE !!
938  double ax_prot = fluid_acceleration[i][0];
939  double ay_prot = fluid_acceleration[i][1];
940  double az_prot = fluid_acceleration[i][2];
941  a_prot = ChVector<>(ax_prot, ay_prot, az_prot);
942  a_rel = a_prot - a_ch;
943  rho_f = fluid_density[i];
944  double dot = a_rel^t_dir;
945  Va = t_dir*dot;
946  Vn = a_rel-Va;
947  Fm_a = rho_f*Cm_axial*M_PI*d*d/4.*Va;//(force per unit length)
948  Fm_n = rho_f*Cm_normal*M_PI*d*d/4.*Vn;//(force per unit length)
949  Fm_f = rho_f*M_PI*d*d/4.*a_prot;
950  Fm = Fm_a + Fm_n + Fm_f;
951  forces_addedmass[i]->Set(Fm);
952  }
953 }
954 
956  for (int i = 0; i < nb_nodes-1; ++i) {
957  ChVector<> Fa = ChVector<>(0.,0.,0.);
958  ChVector<> Fb = ChVector<>(0.,0.,0.);
959  if (applyDrag == true) {
960  Fa = Fa+*forces_drag[i].get();
961  Fb = Fb+*forces_drag[i+1].get();
962  }
963  if (applyAddedMass == true) {
964  Fa = Fa+*forces_addedmass[i].get();
965  Fb = Fb+*forces_addedmass[i+1].get();
966  }
967  /* elems_loads_triangular[i]->loader.SetF(Fa, Fb); */
968  // buoyancy
969  if (applyBuoyancy == true) {
970  if (mesh->GetAutomaticGravity() == true) {
971  /* elems_loads_volumetric[i]->loader.Set_G_acc(-fluid_density[i]/rho*system->Get_G_acc()); */
972  }
973  else {
974  /* elems_loads_volumetric[i]->loader.Set_G_acc((1-fluid_density[i]/rho)*system->Get_G_acc()); */
975  }
976  }
977  }
978 };
979 
980 void cppCable::addNodestoContactCloud(std::shared_ptr<ChContactSurfaceNodeCloud> cloud) {
981  for (int i = 0; i < nb_nodes-1; ++i) {
982  if (beam_type == "BeamEuler") {
983  cloud->AddNode(nodesRot[i], d);
984  }
985  else if (beam_type == "CableANCF") {
986  cloud->AddNode(nodes[i], d);
987  }
988  }
989 };
990 
991 cppMultiSegmentedCable * newMoorings(std::shared_ptr<ChSystem> system,
992  std::shared_ptr<ChMesh> mesh,
993  std::vector<double> length,
994  std::vector<int> nb_elems,
995  std::vector<double> d,
996  std::vector<double> rho,
997  std::vector<double> E,
998  std::string beam_type)
999 {
1000  return new cppMultiSegmentedCable(system,
1001  mesh,
1002  length,
1003  nb_elems,
1004  d,
1005  rho,
1006  E,
1007  beam_type);
1008 }
1009 
1010 
1012  int node1,
1013  cppMultiSegmentedCable* cable2,
1014  int node2) {
1015  auto con1 = chrono_types::make_shared<ChLinkPointPoint>();
1016  auto nodeA = cable1->nodes[node1];
1017  auto nodeB = cable2->nodes[node2];
1018  con1->Initialize(nodeA, nodeB);
1019  cable1->system->Add(con1);
1020 }
1021 
1023  int node1,
1024  cppMultiSegmentedCable* cable2,
1025  int node2) {
1026  auto con1 = chrono_types::make_shared<ChLinkMateSpherical>();
1027  auto nodeA = cable1->nodesRot[node1];
1028  auto nodeB = cable2->nodesRot[node2];
1029  con1->Initialize(nodeA, nodeB, false, nodeA->GetPos(), nodeA->GetPos());
1030  cable1->system->Add(con1);
1031 }
cppMultiSegmentedCable::attachFrontNodeToBody
void attachFrontNodeToBody(std::shared_ptr< ChBody > body)
Definition: ProtChMoorings.h:531
cppMultiSegmentedCable::updateAddedMassForces
void updateAddedMassForces()
Definition: ProtChMoorings.h:469
cppCable::buildVectors
void buildVectors()
cppCable::system
std::shared_ptr< ChSystem > system
Definition: ProtChMoorings.h:128
cppCable::E
double E
Definition: ProtChMoorings.h:140
cppCable::elems_cable
std::vector< std::shared_ptr< ChElementCableANCF > > elems_cable
Definition: ProtChMoorings.h:154
cppMultiSegmentedCable::rho
std::vector< double > rho
Definition: ProtChMoorings.h:208
cppCable::msection_advanced
std::shared_ptr< ChBeamSectionAdvanced > msection_advanced
Definition: ProtChMoorings.h:156
cppMultiSegmentedCable::fairlead2
std::shared_ptr< ChLinkPointFrame > fairlead2
Definition: ProtChMoorings.h:201
cppCable::Cd_normal
double Cd_normal
Definition: ProtChMoorings.h:133
cppCable::nb_nodes
int nb_nodes
Definition: ProtChMoorings.h:144
cppMultiSegmentedCable::constraint_front
std::shared_ptr< ChLinkBase > constraint_front
Definition: ProtChMoorings.h:219
cppMultiSegmentedCable::nb_elems
std::vector< int > nb_elems
Definition: ProtChMoorings.h:203
cppCable::nodesRot
std::vector< std::shared_ptr< ChNodeFEAxyzrot > > nodesRot
Definition: ProtChMoorings.h:153
cppCable::forces_addedmass
std::vector< std::shared_ptr< ChVector< double > > > forces_addedmass
Definition: ProtChMoorings.h:169
cppMultiSegmentedCable::elemsCableANCF
std::vector< std::shared_ptr< ChElementCableANCF > > elemsCableANCF
Definition: ProtChMoorings.h:217
cppMultiSegmentedCable::buildNodesCloud
void buildNodesCloud()
Definition: ProtChMoorings.h:552
cppCable::setFluidDensityAtNodes
void setFluidDensityAtNodes(std::vector< double > vof)
Definition: ProtChMoorings.h:846
MyLoaderTriangular::Fb
ChVector Fb
Definition: ProtChMoorings.h:91
cppCable::A0
double A0
Definition: ProtChMoorings.h:141
cppMultiSegmentedCable::fairleadd
std::shared_ptr< ChBody > fairleadd
Definition: ProtChMoorings.h:200
cppCable::length_per_elem
std::vector< double > length_per_elem
Definition: ProtChMoorings.h:131
cppCable::buildElementsBeamEuler
void buildElementsBeamEuler(bool set_lastnodes)
Definition: ProtChMoorings.h:761
cppMultiSegmentedCable::buildElements
void buildElements()
Definition: ProtChMoorings.h:323
cppCable::nodes_density
std::vector< double > nodes_density
Definition: ProtChMoorings.h:161
cppMultiSegmentedCable::getTensionElement
ChVector getTensionElement(int i, double eta)
Definition: ProtChMoorings.h:481
cppCable::setFluidVelocityAtNodes
void setFluidVelocityAtNodes(std::vector< ChVector<>> vel)
Definition: ProtChMoorings.h:842
cppCable::nb_elems
int nb_elems
Definition: ProtChMoorings.h:130
cppMultiSegmentedCable::mesh
std::shared_ptr< ChMesh > mesh
Definition: ProtChMoorings.h:199
cppMultiSegmentedCable::attachBackNodeToBody
void attachBackNodeToBody(std::shared_ptr< ChBody > body)
Definition: ProtChMoorings.h:514
cppMultiSegmentedCable::setFluidAccelerationAtNodes
void setFluidAccelerationAtNodes(std::vector< ChVector<>> vel)
Definition: ProtChMoorings.h:408
cppMultiSegmentedCable::nodes_built
bool nodes_built
Definition: ProtChMoorings.h:227
cppCable::fluid_velocity
std::vector< ChVector<> > fluid_velocity
Definition: ProtChMoorings.h:158
cppCable::addNodestoContactCloud
void addNodestoContactCloud(std::shared_ptr< ChContactSurfaceNodeCloud > cloud)
Definition: ProtChMoorings.h:980
cppCable::mvecs_middle
std::vector< ChVector<> > mvecs_middle
Definition: ProtChMoorings.h:138
ChElementBeamEulermod
Definition: ProtChMoorings.h:61
MyLoaderTriangular
Definition: ProtChMoorings.h:87
cppCable::mvecs
std::vector< ChVector<> > mvecs
Definition: ProtChMoorings.h:136
cppCable::applyAddedMass
bool applyAddedMass
Definition: ProtChMoorings.h:146
cppCable::fluid_acceleration
std::vector< ChVector<> > fluid_acceleration
Definition: ProtChMoorings.h:159
cppMultiSegmentedCable::nb_nodes
std::vector< int > nb_nodes
Definition: ProtChMoorings.h:202
cppCable::elems_length
std::vector< double > elems_length
Definition: ProtChMoorings.h:157
cppCable::msection_cable
std::shared_ptr< ChBeamSectionCable > msection_cable
Definition: ProtChMoorings.h:155
MyLoaderTriangular::SetF
void SetF(ChVector<> Fa_in, ChVector<> Fb_in)
Definition: ProtChMoorings.h:112
cppCable::nodesDD
std::vector< std::shared_ptr< ChNodeFEAxyzDD > > nodesDD
Definition: ProtChMoorings.h:150
cppMultiSegmentedCable::nodes_chlink
bool nodes_chlink
Definition: ProtChMoorings.h:229
vel
void vel(double rS, double norm_v, double r, double theta, double *vR, double *vTHETA)
Definition: analyticalSolutions.c:2163
cppCable::buildMeshBeamEuler
void buildMeshBeamEuler(bool add_lastnode)
Definition: ProtChMoorings.h:807
MyLoaderTriangular::GetIntegrationPointsU
virtual int GetIntegrationPointsU()
Definition: ProtChMoorings.h:117
cppMultiSegmentedCable::nodes
std::vector< std::shared_ptr< ChNodeFEAxyzD > > nodes
Definition: ProtChMoorings.h:211
cppCable::Iyy
double Iyy
Definition: ProtChMoorings.h:143
cppCable::rho
double rho
Definition: ProtChMoorings.h:140
cppMultiSegmentedCable::body_back
std::shared_ptr< ChBody > body_back
Definition: ProtChMoorings.h:223
cppCable::d
double d
Definition: ProtChMoorings.h:140
cppMultiSegmentedCable::beam_type
std::string beam_type
Definition: ProtChMoorings.h:197
cppCable::buildNodes
void buildNodes(bool last_node)
Definition: ProtChMoorings.h:630
MyLoaderTriangular::Fa
ChVector Fa
Definition: ProtChMoorings.h:90
U
Double U
Definition: Headers.h:88
cppMultiSegmentedCable::mysurfmaterial
std::shared_ptr< ChMaterialSurfaceSMC > mysurfmaterial
Definition: ProtChMoorings.h:198
cppAttachNodeToNodeFEAxyzrot
void cppAttachNodeToNodeFEAxyzrot(cppMultiSegmentedCable *cable1, int node1, cppMultiSegmentedCable *cable2, int node2)
Definition: ProtChMoorings.h:1022
cppCable::mvecs_tangents
std::vector< ChVector<> > mvecs_tangents
Definition: ProtChMoorings.h:137
cppMultiSegmentedCable
Definition: ProtChMoorings.h:194
cppCable::beam_type
std::string beam_type
Definition: ProtChMoorings.h:148
cppCable::buildNodesCableANCF
void buildNodesCableANCF(bool last_node)
Definition: ProtChMoorings.h:679
cppMultiSegmentedCable::elemsBeamEuler
std::vector< std::shared_ptr< ChElementBeamEuler > > elemsBeamEuler
Definition: ProtChMoorings.h:218
cppCable::buildMeshCableANCF
void buildMeshCableANCF(bool add_lastnode)
Definition: ProtChMoorings.h:823
cppCable::mesh
std::shared_ptr< ChMesh > mesh
Definition: ProtChMoorings.h:129
cppCable::nodes
std::vector< std::shared_ptr< ChNodeFEAxyzD > > nodes
Definition: ProtChMoorings.h:149
cppCable::cppCable
cppCable(std::shared_ptr< ChSystem > system, std::shared_ptr< ChMesh > mesh, double length, int nb_elems, double d, double rho, double E, double L0, std::string beam_type)
Definition: ProtChMoorings.h:567
cppMultiSegmentedCable::elems_built
bool elems_built
Definition: ProtChMoorings.h:228
z
Double * z
Definition: Headers.h:49
cppMultiSegmentedCable::fluid_acceleration
std::vector< ChVector<> > fluid_acceleration
Definition: ProtChMoorings.h:215
cppCable::Cm_axial
double Cm_axial
Definition: ProtChMoorings.h:134
cppMultiSegmentedCable::d
std::vector< double > d
Definition: ProtChMoorings.h:207
cppMultiSegmentedCable::nb_nodes_tot
int nb_nodes_tot
Definition: ProtChMoorings.h:225
cppCable::setFluidAccelerationAtNodes
void setFluidAccelerationAtNodes(std::vector< ChVector<>> acc)
Definition: ProtChMoorings.h:838
cppMultiSegmentedCable::cppMultiSegmentedCable
cppMultiSegmentedCable(std::shared_ptr< ChSystem > system, std::shared_ptr< ChMesh > mesh, std::vector< double > length, std::vector< int > nb_nodes, std::vector< double > d, std::vector< double > rho, std::vector< double > E, std::string beam_type)
Definition: ProtChMoorings.h:258
cppMultiSegmentedCable::length
std::vector< double > length
Definition: ProtChMoorings.h:210
cppCable::fluid_density
std::vector< double > fluid_density
Definition: ProtChMoorings.h:160
cppCable::setDragCoefficients
void setDragCoefficients(double axial, double normal)
Definition: ProtChMoorings.h:850
cppMultiSegmentedCable::setContactMaterial
void setContactMaterial(std::shared_ptr< ChMaterialSurfaceSMC > material)
Definition: ProtChMoorings.h:548
ChElementCableANCFmod
Definition: ProtChMoorings.h:37
cppCable::setRestLengthPerElement
void setRestLengthPerElement(std::vector< double > length_array)
Definition: ProtChMoorings.h:861
cppCable::setIyy
void setIyy(double Iyy_in)
Definition: ProtChMoorings.h:619
cppMultiSegmentedCable::buildCable
void buildCable()
Definition: ProtChMoorings.h:351
cppCable::elemsBeamEuler
std::vector< std::shared_ptr< ChElementBeamEuler > > elemsBeamEuler
Definition: ProtChMoorings.h:152
cppCable::applyDrag
bool applyDrag
Definition: ProtChMoorings.h:145
cppMultiSegmentedCable::getForceFairlead
void getForceFairlead()
cppMultiSegmentedCable::setFluidDensityAtNodes
void setFluidDensityAtNodes(std::vector< double > dens)
Definition: ProtChMoorings.h:444
cppMultiSegmentedCable::cables
std::vector< std::shared_ptr< cppCable > > cables
Definition: ProtChMoorings.h:205
cppMultiSegmentedCable::nb_elems_tot
int nb_elems_tot
Definition: ProtChMoorings.h:226
cppCable::setAddedMassForce
void setAddedMassForce()
Definition: ProtChMoorings.h:910
cppMultiSegmentedCable::setFluidVelocityAtNodes
void setFluidVelocityAtNodes(std::vector< ChVector<>> vel)
Definition: ProtChMoorings.h:426
cppCable::setDragForce
void setDragForce()
Definition: ProtChMoorings.h:865
cppMultiSegmentedCable::system
std::shared_ptr< ChSystem > system
Definition: ProtChMoorings.h:196
cppMultiSegmentedCable::E
std::vector< double > E
Definition: ProtChMoorings.h:209
chrono
Definition: ChBodyAddedMass.cpp:4
cppAttachNodeToNodeFEAxyzD
void cppAttachNodeToNodeFEAxyzD(cppMultiSegmentedCable *cable1, int node1, cppMultiSegmentedCable *cable2, int node2)
Definition: ProtChMoorings.h:1011
cppCable::elemsCableANCF
std::vector< std::shared_ptr< ChElementCableANCF > > elemsCableANCF
Definition: ProtChMoorings.h:151
cppMultiSegmentedCable::updateDragForces
void updateDragForces()
Definition: ProtChMoorings.h:463
MyLoaderTriangular::MyLoaderTriangular
MyLoaderTriangular(std::shared_ptr< ChLoadableU > mloadable)
Definition: ProtChMoorings.h:92
vector
float * vector(long nl, long nh)
cppMultiSegmentedCable::forces_drag
std::vector< std::shared_ptr< ChVector< double > > > forces_drag
Definition: ProtChMoorings.h:221
cppMultiSegmentedCable::mvecs
std::vector< ChVector<> > mvecs
Definition: ProtChMoorings.h:204
cppCable::elems_loads_triangular
std::vector< std::shared_ptr< ChLoad< MyLoaderTriangular > > > elems_loads_triangular
Definition: ProtChMoorings.h:171
newMoorings
cppMultiSegmentedCable * newMoorings(std::shared_ptr< ChSystem > system, std::shared_ptr< ChMesh > mesh, std::vector< double > length, std::vector< int > nb_elems, std::vector< double > d, std::vector< double > rho, std::vector< double > E, std::string beam_type)
Definition: ProtChMoorings.h:991
cppCable::buildMesh
void buildMesh(bool add_lastnode)
Definition: ProtChMoorings.h:798
cppCable::buildNodesBeamEuler
void buildNodesBeamEuler(bool last_node)
Definition: ProtChMoorings.h:635
cppMultiSegmentedCable::body_front
std::shared_ptr< ChBody > body_front
Definition: ProtChMoorings.h:224
cppCable::elems_loads_volumetric
std::vector< std::shared_ptr< ChLoad< ChLoaderGravity > > > elems_loads_volumetric
Definition: ProtChMoorings.h:172
cppCable::Cd_axial
double Cd_axial
Definition: ProtChMoorings.h:132
cppMultiSegmentedCable::constraint_back
std::shared_ptr< ChLinkBase > constraint_back
Definition: ProtChMoorings.h:220
cppCable::setAddedMassCoefficients
void setAddedMassCoefficients(double axial, double normal)
Definition: ProtChMoorings.h:856
cppMultiSegmentedCable::buildNodes
void buildNodes()
Definition: ProtChMoorings.h:296
cppCable::applyBuoyancy
bool applyBuoyancy
Definition: ProtChMoorings.h:147
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8
cppCable::buildElements
void buildElements(bool set_lastnodes)
Definition: ProtChMoorings.h:714
cppMultiSegmentedCable::getNodalPositions
std::vector< std::shared_ptr< ChVector< double > > > getNodalPositions()
Definition: ProtChMoorings.h:501
cppMultiSegmentedCable::fluid_velocity
std::vector< ChVector<> > fluid_velocity
Definition: ProtChMoorings.h:214
cppMultiSegmentedCable::forces_addedmass
std::vector< std::shared_ptr< ChVector< double > > > forces_addedmass
Definition: ProtChMoorings.h:222
cppCable::applyForces
void applyForces()
Definition: ProtChMoorings.h:955
cppCable::forces_drag
std::vector< std::shared_ptr< ChVector< double > > > forces_drag
Definition: ProtChMoorings.h:168
cppCable::getNodalPositions
std::vector< std::shared_ptr< ChVector< double > > > getNodalPositions()
cppCable::buildElementsCableANCF
void buildElementsCableANCF(bool set_lastnodes)
Definition: ProtChMoorings.h:723
cppCable::Cm_normal
double Cm_normal
Definition: ProtChMoorings.h:135
cppCable::mdirs
std::vector< ChVector<> > mdirs
Definition: ProtChMoorings.h:139
cppMultiSegmentedCable::nodesDD
std::vector< std::shared_ptr< ChNodeFEAxyzDD > > nodesDD
Definition: ProtChMoorings.h:212
cppMultiSegmentedCable::nodesRot
std::vector< std::shared_ptr< ChNodeFEAxyzrot > > nodesRot
Definition: ProtChMoorings.h:213
cppCable
Definition: ProtChMoorings.h:126
cppCable::length
double length
Definition: ProtChMoorings.h:140
cppMultiSegmentedCable::fluid_density
std::vector< double > fluid_density
Definition: ProtChMoorings.h:216
cppMultiSegmentedCable::applyForces
void applyForces()
Definition: ProtChMoorings.h:475
cppMultiSegmentedCable::contact_material
std::shared_ptr< ChMaterialSurfaceSMC > contact_material
Definition: ProtChMoorings.h:206
MyLoaderTriangular::ComputeF
virtual void ComputeF(const double U, ChVectorDynamic<> &F, ChVectorDynamic<> *state_x, ChVectorDynamic<> *state_w)
Definition: ProtChMoorings.h:101