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 ()
 
void solveSurfaceCoupling (unsigned nStep)
 
void solveSurfaceCouplingFixedSolid ()
 
TriangleWallcreateTriangleWall (std::array< Vec3D, 3 > vertex)
 
void updateTriangleWall (TriangleWall *&wall, std::array< Vec3D, 3 > vertex)
 
void computeOneTimeStepForSCoupling (const unsigned &nStepsMercury)
 
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 ()
 
- 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 ()
 
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
37  {
38  //set name
39  setName("CoupledBeam");
40  //remove existing output files
42 
43  // setup steps
44  setupOomph();
45  setupMercury();
46 
47  // setup time
48  setTimeMax(200);
49  setSaveCount(500);
50  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
51 
52  linear_solver_pt()->disable_doc_time();
53  //disable_info_in_newton_solve();
54 
55  // Solve the problem
56  writeToVTK();
58  saveSolidMesh();
59  }
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:68
void setName(std::string name)
Definition: BaseCoupling.h:59
void setupOomph()
Definition: CoupledBeam.cpp:61
void setupMercury()
Definition: CoupledBeam.cpp:77
void solveSurfaceCoupling()
Definition: SCoupling.h:72

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

◆ CoupledBeam() [2/4]

CoupledBeam::CoupledBeam ( )
inline
37  {
38  //set name
39  setName("CoupledBeamRolling");
40  //remove existing output files
42 
43  // setup steps
44  setupOomph();
45  setupMercury();
46 
47  // equalise time step
48  if (getOomphTimeStep()>getTimeStep()) {
49  setOomphTimeStep(getTimeStep());
50  } else {
51  setTimeStep(getOomphTimeStep());
52  }
53 
54  // setup time
55  setTimeMax(2.22);
56  setSaveCount(4);
57  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
58 
59  linear_solver_pt()->disable_doc_time();
60  //disable_info_in_newton_solve();
61 
62  // Solve the problem
63  writeToVTK();
65  saveSolidMesh();
66  }

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

◆ CoupledBeam() [3/4]

CoupledBeam::CoupledBeam ( )
inline
37  {
38  //set name
39  setName("CoupledBeamRolling2");
40  //remove existing output files
42 
43  // setup steps
44  setupOomph();
45  setupMercury();
46 
47  // equalise time step
48  if (getOomphTimeStep()>getTimeStep()) {
49  setOomphTimeStep(getTimeStep());
50  } else {
51  setTimeStep(getOomphTimeStep());
52  }
53 
54  // setup time
55  setTimeMax(2.22);
56  setSaveCount(4);
57  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
58 
59  linear_solver_pt()->disable_doc_time();
60  //disable_info_in_newton_solve();
61 
62  // Solve the problem
63  writeToVTK();
65  saveSolidMesh();
66  }

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

◆ CoupledBeam() [4/4]

CoupledBeam::CoupledBeam ( )
inline
37  {
38  //set name
39  setName("CoupledBeamUnitTest");
40  //remove existing output files
42 
43  // setup steps
44  setupOomph();
45  setupMercury();
46 
47  // equalise time step
48  if (getOomphTimeStep()>getTimeStep()) {
49  setOomphTimeStep(getTimeStep());
50  } else {
51  setTimeStep(getOomphTimeStep());
52  }
53 
54  // setup time
55  setTimeMax(100*getTimeStep());
56  setSaveCount(4);
57  logger(INFO,"timeMax: %, nTimeSteps %", getTimeMax(), getTimeMax()/getTimeStep());
58 
59  linear_solver_pt()->disable_doc_time();
60  //disable_info_in_newton_solve();
61 
62  // Solve the problem
63  writeToVTK();
65  saveSolidMesh();
66 
67  double velocity = particleHandler.getLastObject()->getVelocity().Z;
68  //logger(INFO,"Final particle velocity %", velocity);
69  helpers::check(velocity, 0.0495209, 1e-6, "final particle velocity");
70  }
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:37

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

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.

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

References getBeamDeflection(), and out.

◆ actionsBeforeOomphTimeStep() [2/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

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

150  {
151  double mass, elasticEnergy, kineticEnergy;
152  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
153  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
154  static double gravEnergy0 = getOomphGravity()*mass*com[2];
155  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
156  static double gravEnergyParticle0 = getGravitationalEnergy();
157  out << getOomphTime()
158  << ' ' << getBeamDeflection()
159  << ' ' << elasticEnergy
160  << ' ' << kineticEnergy
161  << ' ' << gravEnergy
162  << ' ' << getElasticEnergy()
163  << ' ' << getKineticEnergy()
164  << ' ' << getGravitationalEnergy()-gravEnergyParticle0;
165  for (const auto p: particleHandler) {
166  out << ' ' << p->getPosition();
167  }
168  out << std::endl;
169  }

References getBeamDeflection(), and out.

◆ actionsBeforeOomphTimeStep() [3/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

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

148  {
149  double mass, elasticEnergy, kineticEnergy;
150  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
151  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
152  static double gravEnergy0 = getOomphGravity()*mass*com[2];
153  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
154  static double gravEnergyParticle0 = getGravitationalEnergy();
155  out << getOomphTime()
156  << ' ' << getBeamDeflection()
157  << ' ' << elasticEnergy
158  << ' ' << kineticEnergy
159  << ' ' << gravEnergy
160  << ' ' << getElasticEnergy()
161  << ' ' << getKineticEnergy()
162  << ' ' << getGravitationalEnergy()-gravEnergyParticle0;
163  for (const auto p: particleHandler) {
164  out << ' ' << p->getPosition();
165  }
166  out << std::endl;
167 
168  }

References getBeamDeflection(), and out.

◆ actionsBeforeOomphTimeStep() [4/4]

void CoupledBeam::actionsBeforeOomphTimeStep ( )
inlineoverride

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

153  {
154  double mass, elasticEnergy, kineticEnergy;
155  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
156  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
157  static double gravEnergy0 = getOomphGravity()*mass*com[2];
158  double gravEnergy = getOomphGravity()*mass*com[2]-gravEnergy0;
159  static double gravEnergyParticle0 = getGravitationalEnergy();
160  out << getOomphTime()
161  << ' ' << getBeamDeflection()
162  << ' ' << elasticEnergy
163  << ' ' << kineticEnergy
164  << ' ' << gravEnergy
165  << ' ' << getElasticEnergy()
166  << ' ' << getKineticEnergy()
167  << ' ' << getGravitationalEnergy()-gravEnergyParticle0
168  << std::endl;
169  }

References getBeamDeflection(), and out.

◆ actionsBeforeSolve() [1/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

121  {
123  getName()+".gnu",
124  "set xlabel 'time'\n"
125  "set ylabel 'kinetic and potential energy'\n"
126  "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'");
127  out.open(getName()+".out");
128  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
129  }
std::string getName() const
Definition: BaseCoupling.h:64
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

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

◆ actionsBeforeSolve() [2/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

139  {
141  getName()+".gnu",
142  "set xlabel 'time'\n"
143  "set ylabel 'kinetic and potential energy'\n"
144  "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'");
145  out.open(getName()+".out");
146  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
147  }

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

◆ actionsBeforeSolve() [3/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

137  {
139  getName()+".gnu",
140  "set xlabel 'time'\n"
141  "set ylabel 'kinetic and potential energy'\n"
142  "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'");
143  out.open(getName()+".out");
144  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles particlePosition\n";
145  }

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

◆ actionsBeforeSolve() [4/4]

void CoupledBeam::actionsBeforeSolve ( )
inlineoverride

Write header of output file.

142  {
144  getName()+".gnu",
145  "set xlabel 'time'\n"
146  "set ylabel 'kinetic and potential energy'\n"
147  "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'");
148  out.open(getName()+".out");
149  out << "time deflection elasticEnergy kineticEnergy gravEnergy elasticEnergyInteractions kineticEnergyParticles gravEnergyParticles\n";
150  }

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

◆ getBeamDeflection() [1/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] = max[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 
174  return deflection;
175  }

References INFO, and logger.

Referenced by actionsBeforeOomphTimeStep(), and setupOomph().

◆ getBeamDeflection() [2/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

174  {
175  std::array<double,3> min, max;
176  getDomainSize(min, max);
177  Vector<double> xi(3);
178  xi[0] = 0.5*(max[0]+min[0]);
179  xi[1] = 0.5*(max[1]+min[1]);
180  xi[2] = 0.5*(max[2]+min[2]);
181  return getDeflection(xi,2);
182  }

◆ getBeamDeflection() [3/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

173  {
174  std::array<double,3> min, max;
175  getDomainSize(min, max);
176 
177  Vector<double> xi(3);
178  xi[0] = 0.5*(max[0]+min[0]);
179  xi[1] = 0.5*(max[1]+min[1]);
180  xi[2] = 0.5*(max[2]+min[2]);
181  double deflection = getDeflection(xi,2);
182  logger(INFO, "Beam deflection at center (% % %) is %",
183  xi[0], xi[1],xi[2], deflection);
184 
185  double mass, elasticEnergy, kineticEnergy;
186  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
187  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
188  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
189  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
190  return deflection;
191  }

References INFO, and logger.

◆ getBeamDeflection() [4/4]

double CoupledBeam::getBeamDeflection ( )
inline

Outputs deflection at midpoint

174  {
175  std::array<double,3> min, max;
176  getDomainSize(min, max);
177 
178  Vector<double> xi(3);
179  xi[0] = 0.5*(max[0]+min[0]);
180  xi[1] = 0.5*(max[1]+min[1]);
181  xi[2] = 0.5*(max[2]+min[2]);
182  double deflection = getDeflection(xi,2);
183  logger(INFO, "Beam deflection at center (% % %) is %",
184  xi[0], xi[1],xi[2], deflection);
185 
186  double mass, elasticEnergy, kineticEnergy;
187  Vector<double> com(3), linearMomentum(3), angularMomentum(3);
188  getMassMomentumEnergy(mass, com, linearMomentum, angularMomentum, elasticEnergy, kineticEnergy);
189  logger(INFO, "mass %, linearMomentum %, angularMomentum %, elasticEnergy %, totalEnergy %",
190  mass, linearMomentum, angularMomentum, elasticEnergy, elasticEnergy+kineticEnergy);
191 
192  return deflection;
193  }

References INFO, and logger.

◆ setupMercury() [1/4]

void CoupledBeam::setupMercury ( )
inline
77  {
78  //set domain
79  std::array<double, 3> min, max;
80  getDomainSize(min, max);
81  setDomain(min, max);
82  // add elastic species
83  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
84  species->setDensity(2e4);
85  const double radius = 0.1;
86  species->setStiffness(getElasticModulus()*2*radius);
87  logger(INFO,"Species: %", *species);
88  // add particle
89  SphericalParticle p(species);
90  p.setRadius(radius);
91  const double mass = species->getMassFromRadius(radius);
92  double overlap = mass*9.81/species->getStiffness();
93  p.setPosition({0.2,0.2,getZMax()+radius-overlap});
94  p.setVelocity({0.1,0,0});
95  auto particle = particleHandler.copyAndAddObject(p);
96  logger(INFO,"Particle: %", *particle);
97  p.setPosition({0.2,0.6,getZMax()+radius-overlap});
98  particle = particleHandler.copyAndAddObject(p);
99  logger(INFO,"Particle: %", *particle);
100  // set time step
101  double tc = species->getCollisionTime(species->getMassFromRadius(p.getRadius()));
102  setTimeStep(0.05*tc);
103  // set oomph and mercury time step equal
104  setOomphTimeStep(getTimeStep());
105  logger(INFO,"Mercury time step %", getTimeStep());
106  logger(INFO,"Oomph time step %", getOomphTimeStep());
107  // set output file properties
108  setParticlesWriteVTK(true);
109  wallHandler.setWriteVTK(true);
110  setFileType(FileType::NO_FILE);
111  restartFile.setFileType(FileType::ONE_FILE);
112  restartFile.writeFirstAndLastTimeStep();
113  // add gravity
114  setGravity({0,0,-9.81});
115  }
@ 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:33
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37

References BaseParticle::getRadius(), INFO, logger, NO_FILE, ONE_FILE, BaseInteractable::setPosition(), BaseParticle::setRadius(), and BaseInteractable::setVelocity().

Referenced by CoupledBeam().

◆ setupMercury() [2/4]

void CoupledBeam::setupMercury ( )
inline
96  {
97  //set domain
98  std::array<double, 3> min;
99  std::array<double, 3> max;
100  getDomainSize(min, max);
101  setDomain(min, max);
102  // add elastic species
103  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
104  species->setDensity(1000);
105  const double radius = 5e-3;
106  const double mass = species->getMassFromRadius(radius);
107  // stiffness such that k*(0.1*r)=.5*m*v^2
108  double velocity = 0.05;
109  double stiffness = mass*velocity*velocity/(0.01*radius*radius);
110  species->setStiffness(stiffness);
111  logger(INFO,"Species: %", *species);
112  // add particle
113  SphericalParticle p(species);
114  p.setRadius(radius);
115  double overlap = mass*9.8/species->getStiffness();
116  p.setPosition({getXMin()+radius,getYCenter(),getZMax()+p.getRadius()-overlap});
117  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
118  p.setVelocity({velocity,0,0});
119  auto particle = particleHandler.copyAndAddObject(p);
120  logger(INFO,"Particle: %", *particle);
121  // set time step
122  double tc = species->getCollisionTime(mass);
123  setTimeStep(0.05*tc);
124  logger(INFO,"Mercury time step %", getTimeStep());
125  // set output file properties
126  setParticlesWriteVTK(true);
127  wallHandler.setWriteVTK(true);
128  setFileType(FileType::NO_FILE);
129  restartFile.setFileType(FileType::ONE_FILE);
130  restartFile.writeFirstAndLastTimeStep();
131  // add gravity
132  setGravity({0,0,-9.8});
133  }

References BaseParticle::getRadius(), INFO, logger, NO_FILE, ONE_FILE, BaseInteractable::setPosition(), BaseParticle::setRadius(), and BaseInteractable::setVelocity().

◆ setupMercury() [3/4]

void CoupledBeam::setupMercury ( )
inline
96  {
97  //set domain
98  std::array<double, 3> min;
99  std::array<double, 3> max;
100  getDomainSize(min, max);
101  setDomain(min, max);
102  // add elastic species
103  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
104  species->setDensity(1000);
105  const double radius = 5e-3;
106  const double mass = species->getMassFromRadius(radius);
107  // stiffness such that k*o=mg
108  double stiffness = mass*9.8/(0.2*radius);
109  species->setStiffness(stiffness);
110  logger(INFO,"Species: %", *species);
111  // add particle
112  SphericalParticle p(species);
113  p.setRadius(radius);
114  p.setPosition({getXMin()+radius,getYCenter(),getZMax()+0.8*p.getRadius()});
115  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
116  p.setVelocity({0.05,0,0});
117  auto particle = particleHandler.copyAndAddObject(p);
118  logger(INFO,"Particle: %", *particle);
119  // set time step
120  double tc = species->getCollisionTime(mass);
121  setTimeStep(0.05*tc);
122  logger(INFO,"Mercury time step %", getTimeStep());
123  // set output file properties
124  setParticlesWriteVTK(true);
125  wallHandler.setWriteVTK(true);
126  setFileType(FileType::NO_FILE);
127  restartFile.setFileType(FileType::ONE_FILE);
128  restartFile.writeFirstAndLastTimeStep();
129  // add gravity
130  setGravity({0,0,-9.8});
131  }

References BaseParticle::getRadius(), INFO, logger, NO_FILE, ONE_FILE, BaseInteractable::setPosition(), BaseParticle::setRadius(), and BaseInteractable::setVelocity().

◆ setupMercury() [4/4]

void CoupledBeam::setupMercury ( )
inline
100  {
101  //set domain
102  std::array<double, 3> min;
103  std::array<double, 3> max;
104  getDomainSize(min, max);
105  setDomain(min, max);
106  // add elastic species
107  auto species = speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
108  species->setDensity(1000);
109  const double radius = 5e-3;
110  const double mass = species->getMassFromRadius(radius);
111  // stiffness such that k*(0.1*r)=.5*m*v^2
112  double velocity = 0.05;
113  double stiffness = mass*velocity*velocity/(0.01*radius*radius);
114  species->setStiffness(stiffness);
115  logger(INFO,"Species: %", *species);
116  // add particle
117  SphericalParticle p(species);
118  p.setRadius(radius);
119  p.setPosition({getXCenter(),getYCenter(),getZMax()+p.getRadius()});
120  //p.setPosition({getXCenter(),getYMax()+p.getRadius(),getZCenter()});
121  p.setVelocity({0,0,-velocity});
122  auto particle = particleHandler.copyAndAddObject(p);
123  logger(INFO,"Particle: %", *particle);
124  // set time step
125  double tc = species->getCollisionTime(mass);
126  setTimeStep(0.02*tc);
127  logger(INFO,"Mercury time step %", getTimeStep());
128  // set output file properties
129  setParticlesWriteVTK(true);
130  wallHandler.setWriteVTK(true);
131  setFileType(FileType::NO_FILE);
132  restartFile.setFileType(FileType::ONE_FILE);
133  restartFile.writeFirstAndLastTimeStep();
134  // add gravity
135  setGravity({0,0,-0});
136  }

References BaseParticle::getRadius(), INFO, logger, NO_FILE, ONE_FILE, BaseInteractable::setPosition(), BaseParticle::setRadius(), and BaseInteractable::setVelocity().

◆ setupOomph() [1/4]

void CoupledBeam::setupOomph ( )
inline
61  {
62  setElasticModulus(100e6);
63  setDensity(1309);
64  double h = 0.4;
65  setSolidCubicMesh(30, 2, 2, 0, 30*h, 0, 2*h, 0, 2*h);
66  //pin at xmin and xmax
67  pinBoundary(Boundary::X_MIN);
68  // solve
69  setNewtonSolverTolerance(1e-4);
70  prepareForSolve();
71  solveSteady();
73  // couple boundaries
74  coupleBoundary(Boundary::Z_MAX);
75  }
void coupleBoundary(unsigned b)
Definition: SCoupling.h:681

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

Referenced by CoupledBeam().

◆ setupOomph() [2/4]

void CoupledBeam::setupOomph ( )
inline
68  {
69  setElasticModulus(1e6);
70  setDensity(2500);
71  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
72  //pin at xmin and xmax
73  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
74  // set time step
75  //set time scale of oscillation
76  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
77  double b = 0.04, d = 0.01, l = 0.08;
78  double inertia = b*d*d*d/12;
79  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
80  double timeScale = 2*constants::pi/omega; //0.06
81  setOomphTimeStep(0.04*timeScale);
82  logger(INFO,"Oomph time step %", getOomphTimeStep());
83  //set dissipation
84  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
85  //setDissipation(criticalDissipation);
86  //logger(INFO,"Adding dissipation %",criticalDissipation);
87  //setBodyForceAsGravity();
88  setNewtonSolverTolerance(3e-8);
89  prepareForSolve();
90  solveSteady();
92  // couple boundaries
93  coupleBoundary(Boundary::Z_MAX);
94  }
double timeScale
Time scale.
Definition: VCoupledElement.h:34
const Mdouble pi
Definition: ExtendedMath.h:45

References SCoupling< M, O >::coupleBoundary(), getBeamDeflection(), INFO, logger, constants::pi, and Global_Physical_Variables::timeScale.

◆ setupOomph() [3/4]

void CoupledBeam::setupOomph ( )
inline
68  {
69  setElasticModulus(1e6);
70  setDensity(2500);
71  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
72  //pin at xmin and xmax
73  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
74  // set time step
75  //set time scale of oscillation
76  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
77  double b = 0.04, d = 0.01, l = 0.08;
78  double inertia = b*d*d*d/12;
79  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
80  double timeScale = 2*constants::pi/omega; //0.06
81  setOomphTimeStep(0.04*timeScale);
82  logger(INFO,"Oomph time step %", getOomphTimeStep());
83  //set dissipation
84  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
85  //setDissipation(criticalDissipation);
86  //logger(INFO,"Adding dissipation %",criticalDissipation);
87  //setBodyForceAsGravity();
88  setNewtonSolverTolerance(3e-8);
89  prepareForSolve();
90  solveSteady();
92  // couple boundaries
93  coupleBoundary(Boundary::Z_MAX);
94  }

References SCoupling< M, O >::coupleBoundary(), getBeamDeflection(), INFO, logger, constants::pi, and Global_Physical_Variables::timeScale.

◆ setupOomph() [4/4]

void CoupledBeam::setupOomph ( )
inline
72  {
73  setElasticModulus(1e6);
74  setDensity(2500);
75  setSolidCubicMesh(7, 5, 5, 0, 0.16, 0, 0.04, 0, 0.01);
76  //pin at xmin and xmax
77  pinBoundaries({Boundary::X_MIN, Boundary::X_MAX});
78  // set time step
79  //set time scale of oscillation
80  //https://vlab.amrita.edu/?sub=3&brch=175&sim=1080&cnt=1
81  double b = 0.04, d = 0.01, l = 0.08;
82  double inertia = b*d*d*d/12;
83  double omega = 1.875*1.875*sqrt(getElasticModulus()*inertia/(getDensity()*b*d*std::pow(l,4)));
84  double timeScale = 2*constants::pi/omega; //0.06
85  setOomphTimeStep(0.04*timeScale);
86  logger(INFO,"Oomph time step %", getOomphTimeStep());
87  //set dissipation
88  //double criticalDissipation = 0.1 * sqrt(elasticModulus_ * density_ / lengthScale); //TW
89  //setDissipation(criticalDissipation);
90  //logger(INFO,"Adding dissipation %",criticalDissipation);
91  //setBodyForceAsGravity();
92  setNewtonSolverTolerance(3e-8);
93  prepareForSolve();
94  solveSteady();
96  // couple boundaries
97  coupleBoundary(Boundary::Z_MAX);
98  }

References SCoupling< M, O >::coupleBoundary(), getBeamDeflection(), INFO, logger, constants::pi, 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: