CoupledBeam Class Reference
+ Inheritance diagram for CoupledBeam:

Public Member Functions

 CoupledBeam ()
 
void setupOomph ()
 
void setupMercury ()
 
void actionsBeforeSolve () override
 Write header of output file. More...
 
void actionsBeforeOomphTimeStep () override
 Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file. More...
 
double getBeamDeflection ()
 
 CoupledBeam ()
 
void setupOomph ()
 
void setupMercury ()
 
void actionsBeforeSolve () override
 Write header of output file. More...
 
void actionsBeforeOomphTimeStep () override
 Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file. More...
 
double getBeamDeflection ()
 
 CoupledBeam ()
 
void setupOomph ()
 
void setupMercury ()
 
void actionsBeforeSolve () override
 Write header of output file. More...
 
void actionsBeforeOomphTimeStep () override
 Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file. More...
 
double getBeamDeflection ()
 
 CoupledBeam ()
 
void setupOomph ()
 
void setupMercury ()
 
void actionsBeforeSolve () override
 Write header of output file. More...
 
void actionsBeforeOomphTimeStep () override
 Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file. More...
 
double getBeamDeflection ()
 
- Public Member Functions inherited from SCoupling< M, O >
 SCoupling ()=default
 
void solveSurfaceCoupling (const unsigned max_adapt=0)
 
void solveSurfaceCoupling (unsigned nStep, const unsigned max_adapt)
 
void solveSurfaceCouplingForgiving (unsigned nStep, double timeMaxMin=-constants::inf, const unsigned max_adapt=0)
 
void solveSurfaceCouplingFixedSolid ()
 
TriangleWallcreateTriangleWall (std::array< Vec3D, 3 > vertex)
 
void updateTriangleWall (TriangleWall *&wall, std::array< Vec3D, 3 > vertex)
 
void computeOneTimeStepForSCoupling (const unsigned &nStepsMercury, const unsigned max_adapt=0)
 
void createDPMWallsFromFiniteElems ()
 
void updateDPMWallsFromFiniteElems ()
 
void updateTractionOnFiniteElems ()
 
bool computeSCouplingForcesFromTriangles (ELEMENT *const elem_pt, const unsigned &nTriangles, unsigned &wallID, Vector< Vector< double > > &nodalCouplingForces)
 
void getElementBoundingBox (ELEMENT *&elem_pt, Vec3D &min, Vec3D &max)
 
void getSCoupledElements ()
 
void coupleBoundary (unsigned b)
 
void coupleBoundaries (std::vector< unsigned > b)
 
void disableLogSurfaceCoupling ()
 
void setSolidFeelsParticles (bool val)
 
bool getSolidFeelsParticles () const
 
- Public Member Functions inherited from BaseCoupling< M, O >
 BaseCoupling ()=default
 
void setName (std::string name)
 
std::string getName () const
 
void removeOldFiles () const
 
void writeEneTimeStep (std::ostream &os) const override
 
void writeEneHeader (std::ostream &os) const override
 
void solveOomph (int max_adapt=0)
 
void checkResidual ()
 
void solveMercury (unsigned long nt)
 
void setCGWidth (const double &width)
 
double getCGWidth ()
 
bool useCGMapping ()
 
CGFunctions::LucyXYZ getCGFunction ()
 

Public Attributes

std::ofstream out
 output file stream More...
 

Additional Inherited Members

- Public Types inherited from SCoupling< M, O >
typedef O::ELEMENT ELEMENT
 

Detailed Description

Define a coupled problem

Constructor & Destructor Documentation

◆ CoupledBeam() [1/4]

CoupledBeam::CoupledBeam ( )
inline
16  {
17  //set name
18  setName("CoupledBeam");
19  //remove existing output files
21 
22  // setup steps
23  setupOomph();
24  setupMercury();
25 
26  // setup time
27  setTimeMax(200);
28  setSaveCount(500);
29  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
30 
31  linear_solver_pt()->disable_doc_time();
32  //disable_info_in_newton_solve();
33 
34  // Solve the problem
35  writeToVTK();
37  saveSolidMesh();
38  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
void removeOldFiles() const
Definition: BaseCoupling.h:47
void setName(std::string name)
Definition: BaseCoupling.h:38
void setupOomph()
Definition: CoupledBeam.cpp:40
void setupMercury()
Definition: CoupledBeam.cpp:56
void solveSurfaceCoupling(const unsigned max_adapt=0)
Definition: SCoupling.h:51

References INFO, logger, BaseCoupling< M, O >::removeOldFiles(), BaseCoupling< M, O >::setName(), setupMercury(), setupOomph(), and SCoupling< M, O >::solveSurfaceCoupling().

◆ CoupledBeam() [2/4]

CoupledBeam::CoupledBeam ( )
inline
16  {
17  //set name
18  setName("CoupledBeamRolling");
19  //remove existing output files
21 
22  // setup steps
23  setupOomph();
24  setupMercury();
25 
26  // equalise time step
27  if (getOomphTimeStep()>getTimeStep()) {
28  setOomphTimeStep(getTimeStep());
29  } else {
30  setTimeStep(getOomphTimeStep());
31  }
32 
33  // setup time
34  setTimeMax(2.22);
35  setSaveCount(4);
36  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
37 
38  linear_solver_pt()->disable_doc_time();
39  //disable_info_in_newton_solve();
40 
41  // Solve the problem
42  writeToVTK();
44  saveSolidMesh();
45  }

References INFO, logger, BaseCoupling< M, O >::removeOldFiles(), BaseCoupling< M, O >::setName(), setupMercury(), setupOomph(), and SCoupling< M, O >::solveSurfaceCoupling().

◆ CoupledBeam() [3/4]

CoupledBeam::CoupledBeam ( )
inline
16  {
17  //set name
18  setName("CoupledBeamRolling2");
19  //remove existing output files
21 
22  // setup steps
23  setupOomph();
24  setupMercury();
25 
26  // equalise time step
27  if (getOomphTimeStep()>getTimeStep()) {
28  setOomphTimeStep(getTimeStep());
29  } else {
30  setTimeStep(getOomphTimeStep());
31  }
32 
33  // setup time
34  setTimeMax(2.22);
35  setSaveCount(4);
36  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
37 
38  linear_solver_pt()->disable_doc_time();
39  //disable_info_in_newton_solve();
40 
41  // Solve the problem
42  writeToVTK();
44  saveSolidMesh();
45  }

References INFO, logger, BaseCoupling< M, O >::removeOldFiles(), BaseCoupling< M, O >::setName(), setupMercury(), setupOomph(), and SCoupling< M, O >::solveSurfaceCoupling().

◆ CoupledBeam() [4/4]

CoupledBeam::CoupledBeam ( )
inline
16  {
17  //set name
18  setName("CoupledBeamUnitTest");
19  //remove existing output files
21 
22  // setup steps
23  setupOomph();
24  setupMercury();
25 
26  // equalise time step
27  if (getOomphTimeStep()>getTimeStep()) {
28  setOomphTimeStep(getTimeStep());
29  } else {
30  setTimeStep(getOomphTimeStep());
31  }
32 
33  // setup time
34  setTimeMax(100*getTimeStep());
35  setSaveCount(4);
36  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
37 
38  linear_solver_pt()->disable_doc_time();
39  //disable_info_in_newton_solve();
40 
41  // Solve the problem
42  writeToVTK();
44  saveSolidMesh();
45 
46  double velocity = particleHandler.getLastObject()->getVelocity().Z;
47  //logger(INFO,"Final particle velocity %", velocity);
48  helpers::check(velocity, 0.0495209, 1e-6, "final particle velocity");
49  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:16

References helpers::check(), e(), INFO, logger, BaseCoupling< M, O >::removeOldFiles(), BaseCoupling< M, O >::setName(), setupMercury(), setupOomph(), SCoupling< M, O >::solveSurfaceCoupling(), and Jeffery_Solution::velocity().

Member Function Documentation

◆ actionsBeforeOomphTimeStep() [1/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file.

115  {
116  double mass, elasticEnergy, kineticEnergy;
117  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
118  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
119  static double gravEnergy0 = getOomphGravity()*mass*com[2];
120  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
121  static double gravEnergyParticle0 = getGravitationalEnergy();
122  out << getOomphTime()
123  << ' ' << getBeamDeflection()
124  << ' ' << elasticEnergy
125  << ' ' << kineticEnergy
126  << ' ' << gravEnergy
127  << ' ' << getElasticEnergy()
128  << ' ' << getKineticEnergy()
129  << ' ' << getGravitationalEnergy()-gravEnergyParticle0;
130  for (const auto p: particleHandler) {
131  out << ' ' << p->getPosition();
132  }
133  out << std::endl;
134  }
float * p
Definition: Tutorial_Map_using.cpp:9
std::ofstream out
output file stream
Definition: CoupledBeam.cpp:101
double getBeamDeflection()
Definition: CoupledBeam.cpp:139

References getBeamDeflection(), out, and p.

◆ actionsBeforeOomphTimeStep() [2/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file.

133  {
134  double mass, elasticEnergy, kineticEnergy;
135  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
136  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
137  static double gravEnergy0 = getOomphGravity()*mass*com[2];
138  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
139  static double gravEnergyParticle0 = getGravitationalEnergy();
140  out << getOomphTime()
141  << ' ' << getBeamDeflection()
142  << ' ' << elasticEnergy
143  << ' ' << kineticEnergy
144  << ' ' << gravEnergy
145  << ' ' << getElasticEnergy()
146  << ' ' << getKineticEnergy()
147  << ' ' << getGravitationalEnergy()-gravEnergyParticle0;
148  for (const auto p: particleHandler) {
149  out << ' ' << p->getPosition();
150  }
151  out << std::endl;
152  }

References getBeamDeflection(), out, and p.

◆ actionsBeforeOomphTimeStep() [3/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file.

131  {
132  double mass, elasticEnergy, kineticEnergy;
133  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
134  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
135  static double gravEnergy0 = getOomphGravity()*mass*com[2];
136  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
137  static double gravEnergyParticle0 = getGravitationalEnergy();
138  out << getOomphTime()
139  << ' ' << getBeamDeflection()
140  << ' ' << elasticEnergy
141  << ' ' << kineticEnergy
142  << ' ' << gravEnergy
143  << ' ' << getElasticEnergy()
144  << ' ' << getKineticEnergy()
145  << ' ' << getGravitationalEnergy()-gravEnergyParticle0;
146  for (const auto p: particleHandler) {
147  out << ' ' << p->getPosition();
148  }
149  out << std::endl;
150 
151  }

References getBeamDeflection(), out, and p.

◆ actionsBeforeOomphTimeStep() [4/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

Each time step, compute deflection, elastic, kinetic and gravitational energy, and write to output file.

136  {
137  double mass, elasticEnergy, kineticEnergy;
138  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
139  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
140  static double gravEnergy0 = getOomphGravity()*mass*com[2];
141  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
142  static double gravEnergyParticle0 = getGravitationalEnergy();
143  out << getOomphTime()
144  << ' ' << getBeamDeflection()
145  << ' ' << elasticEnergy
146  << ' ' << kineticEnergy
147  << ' ' << gravEnergy
148  << ' ' << getElasticEnergy()
149  << ' ' << getKineticEnergy()
150  << ' ' << getGravitationalEnergy()-gravEnergyParticle0
151  << std::endl;
152  }

References getBeamDeflection(), and out.

◆ actionsBeforeSolve() [1/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

104  {
106  getName()+".gnu",
107  "set xlabel 'time'\n"
108  "set ylabel 'kinetic and potential energy'\n"
109  "p 'CoupledBeam.out' u 1:($3+$4) w lp t 'oomph-lib', '' u 1:(($6+$7-6.54498e-07 )) w lp t 'MercuryDPM', '' u 1:($3+$4+$6+$7-6.54498e-07) w lp t 'total'");
110  out.open(getName()+".out");
111  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
112  }
std::string getName() const
Definition: BaseCoupling.h:43
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29

References BaseCoupling< M, O >::getName(), out, and helpers::writeToFile().

◆ actionsBeforeSolve() [2/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

122  {
124  getName()+".gnu",
125  "set xlabel 'time'\n"
126  "set ylabel 'kinetic and potential energy'\n"
127  "p 'CoupledBeamRolling.out' u 1:($3+$4+$5) w lp t 'oomph-lib', '' u 1:(($6+$7+$8)) w lp t 'MercuryDPM', '' u 1:($3+$4+$5+$6+$7+$8) w lp t 'total'");
128  out.open(getName()+".out");
129  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
130  }

References BaseCoupling< M, O >::getName(), out, and helpers::writeToFile().

◆ actionsBeforeSolve() [3/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

120  {
122  getName()+".gnu",
123  "set xlabel 'time'\n"
124  "set ylabel 'kinetic and potential energy'\n"
125  "p 'CoupledBeamRolling.out' u 1:($3+$4+$5) w lp t 'oomph-lib', '' u 1:(($6+$7+$8)) w lp t 'MercuryDPM', '' u 1:($3+$4+$5+$6+$7+$8) w lp t 'total'");
126  out.open(getName()+".out");
127  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
128  }

References BaseCoupling< M, O >::getName(), out, and helpers::writeToFile().

◆ actionsBeforeSolve() [4/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

125  {
127  getName()+".gnu",
128  "set xlabel 'time'\n"
129  "set ylabel 'kinetic and potential energy'\n"
130  "p 'CoupledBeamUnitTest.out' u 1:($3+$4) w lp t 'oomph-lib', '' u 1:(($6+$7-6.54498e-07 )) w lp t 'MercuryDPM', '' u 1:($3+$4+$6+$7-6.54498e-07) w lp t 'total'");
131  out.open(getName()+".out");
132  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles\n";
133  }

References BaseCoupling< M, O >::getName(), out, and helpers::writeToFile().

◆ getBeamDeflection() [1/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

139  {
140  std::array<double,3> min, max;
141  getDomainSize(min, max);
142 
143  Vector<double> xi(3);
144  xi[0] = max[0];
145  xi[1] = 0.5*(max[1]+min[1]);
146  xi[2] = 0.5*(max[2]+min[2]);
147  double deflection = getDeflection(xi,2);
148  logger(INFO, "Beam deflection at center (% % %) is %",
149  xi[0], xi[1],xi[2], deflection);
150 
151  double mass, elasticEnergy, kineticEnergy;
152  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
153  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
154  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
155  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
156 
157  return deflection;
158  }
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23

References INFO, logger, max, and min.

Referenced by actionsBeforeOomphTimeStep(), and setupOomph().

◆ getBeamDeflection() [2/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

157  {
158  std::array<double,3> min, max;
159  getDomainSize(min, max);
160  Vector<double> xi(3);
161  xi[0] = 0.5*(max[0]+min[0]);
162  xi[1] = 0.5*(max[1]+min[1]);
163  xi[2] = 0.5*(max[2]+min[2]);
164  return getDeflection(xi,2);
165  }

References max, and min.

◆ getBeamDeflection() [3/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

156  {
157  std::array<double,3> min, max;
158  getDomainSize(min, max);
159 
160  Vector<double> xi(3);
161  xi[0] = 0.5*(max[0]+min[0]);
162  xi[1] = 0.5*(max[1]+min[1]);
163  xi[2] = 0.5*(max[2]+min[2]);
164  double deflection = getDeflection(xi,2);
165  logger(INFO, "Beam deflection at center (% % %) is %",
166  xi[0], xi[1],xi[2], deflection);
167 
168  double mass, elasticEnergy, kineticEnergy;
169  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
170  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
171  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
172  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
173  return deflection;
174  }

References INFO, logger, max, and min.

◆ getBeamDeflection() [4/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

157  {
158  std::array<double,3> min, max;
159  getDomainSize(min, max);
160 
161  Vector<double> xi(3);
162  xi[0] = 0.5*(max[0]+min[0]);
163  xi[1] = 0.5*(max[1]+min[1]);
164  xi[2] = 0.5*(max[2]+min[2]);
165  double deflection = getDeflection(xi,2);
166  logger(INFO, "Beam deflection at center (% % %) is %",
167  xi[0], xi[1],xi[2], deflection);
168 
169  double mass, elasticEnergy, kineticEnergy;
170  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
171  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
172  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
173  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
174 
175  return deflection;
176  }

References INFO, logger, max, and min.

◆ setupMercury() [1/4]

void CoupledBeam::setupMercury ( )
inline
56  {
57  // set domain min, max. Used to getDomainSize
58  std::array<double, 3> min, max;
59  getDomainSize(min, max);
60  // Translating the array into a Vec3D. Mercury works with Vec3D to set the domain
61  Vec3D minVec(min);
62  Vec3D maxVec(max);
63  // set domain in Mercury
64  setDomain(minVec, maxVec);
65  // add elastic species
66  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
67  species->setDensity(2e4);
68  const double radius = 0.1;
69  species->setStiffness(getElasticModulus()*2*radius);
70  logger(INFO,"Species: %", *species);
71  // add particle
72  SphericalParticle p(species);
73  p.setRadius(radius);
74  const double mass = species->getMassFromRadius(radius);
75  double overlap = mass*9.81/species->getStiffness();
76  p.setPosition({0.2,0.2,getZMax()+radius-overlap});
77  p.setVelocity({0.1,0,0});
78  auto particle = particleHandler.copyAndAddObject(p);
79  logger(INFO,"Particle: %", *particle);
80  p.setPosition({0.2,0.6,getZMax()+radius-overlap});
81  particle = particleHandler.copyAndAddObject(p);
82  logger(INFO,"Particle: %", *particle);
83  // set time step
84  double tc = species->getCollisionTime(species->getMassFromRadius(p.getRadius()));
85  setTimeStep(0.05*tc);
86  // set oomph and mercury time step equal
87  setOomphTimeStep(getTimeStep());
88  logger(INFO,"Mercury time step %", getTimeStep());
89  logger(INFO,"Oomph time step %", getOomphTimeStep());
90  // set output file properties
91  setParticlesWriteVTK(true);
92  wallHandler.setWriteVTK(true);
93  setFileType(FileType::NO_FILE);
94  restartFile.setFileType(FileType::ONE_FILE);
95  restartFile.writeFirstAndLastTimeStep();
96  // add gravity
97  setGravity({0,0,-9.81});
98  }
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
radius
Definition: UniformPSDSelfTest.py:15

References INFO, logger, max, min, NO_FILE, ONE_FILE, p, and UniformPSDSelfTest::radius.

Referenced by CoupledBeam().

◆ setupMercury() [2/4]

void CoupledBeam::setupMercury ( )
inline
75  {
76  // set domain min, max. Used to getDomainSize
77  std::array<double, 3> min;
78  std::array<double, 3> max;
79  getDomainSize(min, max);
80  // Translating the array into a Vec3D. Mercury works with Vec3D to set the domain
81  Vec3D minVec(min);
82  Vec3D maxVec(max);
83  // set domain in Mercury
84  setDomain(minVec, maxVec);
85  // add elastic species
86  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
87  species->setDensity(1000);
88  const double radius = 5e-3;
89  const double mass = species->getMassFromRadius(radius);
90  // stiffness such that k*(0.1*r)=.5*m*v^2
91  double velocity = 0.05;
92  double stiffness = mass*velocity*velocity/(0.01*radius*radius);
93  species->setStiffness(stiffness);
94  logger(INFO,"Species: %", *species);
95  // add particle
96  SphericalParticle p(species);
97  p.setRadius(radius);
98  double overlap = mass*9.8/species->getStiffness();
99  p.setPosition({getXMin()+radius,getYCenter(),getZMax()+p.getRadius()-overlap});
100  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
101  p.setVelocity({velocity,0,0});
102  auto particle = particleHandler.copyAndAddObject(p);
103  logger(INFO,"Particle: %", *particle);
104  // set time step
105  double tc = species->getCollisionTime(mass);
106  setTimeStep(0.05*tc);
107  logger(INFO,"Mercury time step %", getTimeStep());
108  // set output file properties
109  setParticlesWriteVTK(true);
110  wallHandler.setWriteVTK(true);
111  setFileType(FileType::NO_FILE);
112  restartFile.setFileType(FileType::ONE_FILE);
113  restartFile.writeFirstAndLastTimeStep();
114  // add gravity
115  setGravity({0,0,-9.8});
116  }

References e(), INFO, logger, max, min, NO_FILE, ONE_FILE, p, UniformPSDSelfTest::radius, and Jeffery_Solution::velocity().

◆ setupMercury() [3/4]

void CoupledBeam::setupMercury ( )
inline
75  {
76  // set domain min, max. Used to getDomainSize
77  std::array<double, 3> min;
78  std::array<double, 3> max;
79  getDomainSize(min, max);
80  // Translating the array into a Vec3D. Mercury works with Vec3D to set the domain
81  Vec3D minVec(min);
82  Vec3D maxVec(max);
83  // set domain in Mercury
84  setDomain(minVec, maxVec);
85  // add elastic species
86  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
87  species->setDensity(1000);
88  const double radius = 5e-3;
89  const double mass = species->getMassFromRadius(radius);
90  // stiffness such that k*o=mg
91  double stiffness = mass*9.8/(0.2*radius);
92  species->setStiffness(stiffness);
93  logger(INFO,"Species: %", *species);
94  // add particle
95  SphericalParticle p(species);
96  p.setRadius(radius);
97  p.setPosition({getXMin()+radius,getYCenter(),getZMax()+0.8*p.getRadius()});
98  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
99  p.setVelocity({0.05,0,0});
100  auto particle = particleHandler.copyAndAddObject(p);
101  logger(INFO,"Particle: %", *particle);
102  // set time step
103  double tc = species->getCollisionTime(mass);
104  setTimeStep(0.05*tc);
105  logger(INFO,"Mercury time step %", getTimeStep());
106  // set output file properties
107  setParticlesWriteVTK(true);
108  wallHandler.setWriteVTK(true);
109  setFileType(FileType::NO_FILE);
110  restartFile.setFileType(FileType::ONE_FILE);
111  restartFile.writeFirstAndLastTimeStep();
112  // add gravity
113  setGravity({0,0,-9.8});
114  }

References e(), INFO, logger, max, min, NO_FILE, ONE_FILE, p, and UniformPSDSelfTest::radius.

◆ setupMercury() [4/4]

void CoupledBeam::setupMercury ( )
inline
79  {
80  // set domain min, max. Used to getDomainSize
81  std::array<double, 3> min;
82  std::array<double, 3> max;
83  getDomainSize(min, max);
84  // Translating the array into a Vec3D. Mercury works with Vec3D to set the domain
85  Vec3D minVec(min);
86  Vec3D maxVec(max);
87  // set domain in Mercury
88  setDomain(minVec, maxVec);
89  // add elastic species
90  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
91  species->setDensity(1000);
92  const double radius = 5e-3;
93  const double mass = species->getMassFromRadius(radius);
94  // stiffness such that k*(0.1*r)=.5*m*v^2
95  double velocity = 0.05;
96  double stiffness = mass*velocity*velocity/(0.01*radius*radius);
97  species->setStiffness(stiffness);
98  logger(INFO,"Species: %", *species);
99  // add particle
100  SphericalParticle p(species);
101  p.setRadius(radius);
102  p.setPosition({getXCenter(),getYCenter(),getZMax()+p.getRadius()});
103  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
104  p.setVelocity({0,0,-velocity});
105  auto particle = particleHandler.copyAndAddObject(p);
106  logger(INFO,"Particle: %", *particle);
107  // set time step
108  double tc = species->getCollisionTime(mass);
109  setTimeStep(0.02*tc);
110  logger(INFO,"Mercury time step %", getTimeStep());
111  // set output file properties
112  setParticlesWriteVTK(true);
113  wallHandler.setWriteVTK(true);
114  setFileType(FileType::NO_FILE);
115  restartFile.setFileType(FileType::ONE_FILE);
116  restartFile.writeFirstAndLastTimeStep();
117  // add gravity
118  setGravity({0,0,-0});
119  }

References e(), INFO, logger, max, min, NO_FILE, ONE_FILE, p, UniformPSDSelfTest::radius, and Jeffery_Solution::velocity().

◆ setupOomph() [1/4]

void CoupledBeam::setupOomph ( )
inline
40  {
41  setElasticModulus(100e6);
42  setDensity(1309);
43  double h = 0.4;
44  setSolidCubicMesh(30, 2, 2, 0, 30*h, 0, 2*h, 0, 2*h);
45  //pin at xmin and xmax
46  pinBoundary(Boundary::X_MIN);
47  // solve
48  setNewtonSolverTolerance(1e-4);
49  prepareForSolve();
50  solveSteady();
52  // couple boundaries
53  coupleBoundary(Boundary::Z_MAX);
54  }
void coupleBoundary(unsigned b)
Definition: SCoupling.h:692

References SCoupling< M, O >::coupleBoundary(), e(), and getBeamDeflection().

Referenced by CoupledBeam().

◆ setupOomph() [2/4]

void CoupledBeam::setupOomph ( )
inline
47  {
48  setElasticModulus(1e6);
49  setDensity(2500);
50  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
51  //pin at xmin and xmax
52  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
53  // set time step
54  //set time scale of oscillation
55  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
56  double b = 0.04, d = 0.01, l = 0.08;
57  double inertia = b*d*d*d/12;
58  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
59  double timeScale = 2*constants::pi/omega; //0.06
60  setOomphTimeStep(0.04*timeScale);
61  logger(INFO,"Oomph time step %", getOomphTimeStep());
62  //set dissipation
63  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
64  //setDissipation(criticalDissipation);
65  //logger(INFO,"Adding dissipation %",criticalDissipation);
66  //setBodyForceAsGravity();
67  setNewtonSolverTolerance(3e-8);
68  prepareForSolve();
69  solveSteady();
71  // couple boundaries
72  coupleBoundary(Boundary::Z_MAX);
73  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Scalar * b
Definition: benchVecAdd.cpp:17
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
Vector::Scalar omega(const Vector &t, const Vector &s, RealScalar angle)
Definition: IDRS.h:36
double timeScale
Time scale.
Definition: VCoupledElement.h:13
const Mdouble pi
Definition: ExtendedMath.h:23

References b, SCoupling< M, O >::coupleBoundary(), e(), getBeamDeflection(), INFO, logger, Eigen::internal::omega(), constants::pi, Eigen::bfloat16_impl::pow(), sqrt(), and Global_Physical_Variables::timeScale.

◆ setupOomph() [3/4]

void CoupledBeam::setupOomph ( )
inline
47  {
48  setElasticModulus(1e6);
49  setDensity(2500);
50  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
51  //pin at xmin and xmax
52  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
53  // set time step
54  //set time scale of oscillation
55  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
56  double b = 0.04, d = 0.01, l = 0.08;
57  double inertia = b*d*d*d/12;
58  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
59  double timeScale = 2*constants::pi/omega; //0.06
60  setOomphTimeStep(0.04*timeScale);
61  logger(INFO,"Oomph time step %", getOomphTimeStep());
62  //set dissipation
63  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
64  //setDissipation(criticalDissipation);
65  //logger(INFO,"Adding dissipation %",criticalDissipation);
66  //setBodyForceAsGravity();
67  setNewtonSolverTolerance(3e-8);
68  prepareForSolve();
69  solveSteady();
71  // couple boundaries
72  coupleBoundary(Boundary::Z_MAX);
73  }

References b, SCoupling< M, O >::coupleBoundary(), e(), getBeamDeflection(), INFO, logger, Eigen::internal::omega(), constants::pi, Eigen::bfloat16_impl::pow(), sqrt(), and Global_Physical_Variables::timeScale.

◆ setupOomph() [4/4]

void CoupledBeam::setupOomph ( )
inline
51  {
52  setElasticModulus(1e6);
53  setDensity(2500);
54  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
55  //pin at xmin and xmax
56  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
57  // set time step
58  //set time scale of oscillation
59  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
60  double b = 0.04, d = 0.01, l = 0.08;
61  double inertia = b*d*d*d/12;
62  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
63  double timeScale = 2*constants::pi/omega; //0.06
64  setOomphTimeStep(0.04*timeScale);
65  logger(INFO,"Oomph time step %", getOomphTimeStep());
66  //set dissipation
67  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
68  //setDissipation(criticalDissipation);
69  //logger(INFO,"Adding dissipation %",criticalDissipation);
70  //setBodyForceAsGravity();
71  setNewtonSolverTolerance(3e-8);
72  prepareForSolve();
73  solveSteady();
75  // couple boundaries
76  coupleBoundary(Boundary::Z_MAX);
77  }

References b, SCoupling< M, O >::coupleBoundary(), e(), getBeamDeflection(), INFO, logger, Eigen::internal::omega(), constants::pi, Eigen::bfloat16_impl::pow(), sqrt(), and Global_Physical_Variables::timeScale.

Member Data Documentation

◆ out

std::ofstream CoupledBeam::out

output file stream

Referenced by actionsBeforeOomphTimeStep(), and actionsBeforeSolve().


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