PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
anonymous_namespace{main.cpp}::ContactWitness Class Reference
Inheritance diagram for anonymous_namespace{main.cpp}::ContactWitness:
Collaboration diagram for anonymous_namespace{main.cpp}::ContactWitness:

Public Member Functions

void checkStop (data::ModelData &data) override
 
void assertOk () const
 
- Public Member Functions inherited from postprocess::Postprocess
virtual ~Postprocess ()=default
 
virtual void close (data::ModelData &data)
 
virtual std::string twoParticle (data::ModelData &data)
 
virtual std::string compressive (data::ModelData &data)
 

Private Attributes

bool d_sawPp = false
 
bool d_sawWall = false
 
double d_minPpGap = 1.e300
 
double d_minGrainY = 1.e300
 
double d_Rc = 0.
 

Detailed Description

Records whether PP and wall contacts engaged at any step (floor top y=0).

Definition at line 119 of file main.cpp.

Member Function Documentation

◆ assertOk()

void anonymous_namespace{main.cpp}::ContactWitness::assertOk ( ) const
inline

Definition at line 155 of file main.cpp.

155 {
156 int saw_pp = d_sawPp ? 1 : 0;
157 int saw_wall = d_sawWall ? 1 : 0;
158 double min_pp = d_minPpGap;
159 double min_y = d_minGrainY;
160 double rc = d_Rc;
161 if (util::parallel::mpiSize() > 1) {
162 int saw_pp_g = 0, saw_wall_g = 0;
163 double min_pp_g = 0., min_y_g = 0., rc_g = 0.;
164 MPI_Allreduce(&saw_pp, &saw_pp_g, 1, MPI_INT, MPI_MAX,
166 MPI_Allreduce(&saw_wall, &saw_wall_g, 1, MPI_INT, MPI_MAX,
168 MPI_Allreduce(&min_pp, &min_pp_g, 1, MPI_DOUBLE, MPI_MIN,
170 MPI_Allreduce(&min_y, &min_y_g, 1, MPI_DOUBLE, MPI_MIN,
172 MPI_Allreduce(&rc, &rc_g, 1, MPI_DOUBLE, MPI_MAX,
174 saw_pp = saw_pp_g;
175 saw_wall = saw_wall_g;
176 min_pp = min_pp_g;
177 min_y = min_y_g;
178 rc = rc_g;
179 }
180 if (!saw_pp)
181 throw std::runtime_error(std::format(
182 "particle-particle contact missing: min_gap={:.6e} Rc={:.6e}", min_pp,
183 rc));
184 if (!saw_wall)
185 throw std::runtime_error(std::format(
186 "particle-wall contact missing: min_grain_y={:.6e} Rc={:.6e}", min_y,
187 rc));
188 if (util::parallel::mpiRank() == 0)
189 util::io::print(std::format(
190 "contacts OK: min_pp_gap={:.6e} min_grain_y={:.6e} Rc={:.6e}\n",
191 min_pp, min_y, rc));
192 }
void print(const T &msg, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
Prints formatted information.
Definition io.h:128
int mpiSize()
Get size (number) of processors.
int mpiRank()
get rank (id) of this processor
MPI_Comm mpiComm()
Get MPI comm.

References util::parallel::mpiComm(), util::parallel::mpiRank(), util::parallel::mpiSize(), and util::io::print().

Here is the call graph for this function:

◆ checkStop()

void anonymous_namespace{main.cpp}::ContactWitness::checkStop ( data::ModelData data)
inlineoverridevirtual

Reimplemented from postprocess::Postprocess.

Definition at line 121 of file main.cpp.

121 {
123 if (data.d_particlesListTypeParticle.size() < 2)
124 return;
125 const auto *g0 = data.d_particlesListTypeParticle[0];
126 const auto *g1 = data.d_particlesListTypeParticle[1];
127 double Rc = 0.;
128 try {
129 Rc = data.d_particleDeck_p->d_contactDeck.getContact(0, 0).d_contactR;
130 } catch (...) {
131 return;
132 }
133 d_Rc = Rc;
134 const double gap = g0->getXCenter().dist(g1->getXCenter()) -
135 g0->d_geom_p->boundingRadius() -
136 g1->d_geom_p->boundingRadius();
137 d_minPpGap = std::min(d_minPpGap, gap);
138 if (gap < Rc)
139 d_sawPp = true;
140
141 double min_y = 1.e300;
142 for (size_t i = 0; i < data.d_x.size(); ++i) {
143 if (data.getParticleFromAllList(data.d_ptId[i])->isWall())
144 continue;
145 min_y = std::min(min_y, data.d_x[i].d_y);
146 }
147 if (util::parallel::mpiSize() > 1)
148 MPI_Allreduce(MPI_IN_PLACE, &min_y, 1, MPI_DOUBLE, MPI_MIN,
150 d_minGrainY = std::min(d_minGrainY, min_y);
151 if (min_y < Rc)
152 d_sawWall = true;
153 }
virtual void checkStop(data::ModelData &data)
Definition contact.h:20

References postprocess::Postprocess::checkStop(), util::parallel::mpiComm(), and util::parallel::mpiSize().

Here is the call graph for this function:

Field Documentation

◆ d_minGrainY

double anonymous_namespace{main.cpp}::ContactWitness::d_minGrainY = 1.e300
private

Definition at line 198 of file main.cpp.

◆ d_minPpGap

double anonymous_namespace{main.cpp}::ContactWitness::d_minPpGap = 1.e300
private

Definition at line 197 of file main.cpp.

◆ d_Rc

double anonymous_namespace{main.cpp}::ContactWitness::d_Rc = 0.
private

Definition at line 199 of file main.cpp.

◆ d_sawPp

bool anonymous_namespace{main.cpp}::ContactWitness::d_sawPp = false
private

Definition at line 195 of file main.cpp.

◆ d_sawWall

bool anonymous_namespace{main.cpp}::ContactWitness::d_sawWall = false
private

Definition at line 196 of file main.cpp.


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