@@ -25,44 +25,6 @@ SphManager::~SphManager() {
25
25
26
26
}
27
27
28
- void SphManager::initDensities () {
29
- /*
30
- std::vector<SphParticle> each_neighbour_particles;
31
- std::unordered_map <int, std::vector<SphParticle>> each_neighbour_static_rim_particles;
32
-
33
- for (auto& each_domain : domains) {
34
- if (each_domain.second.hasStaticParticles()) {
35
- // gets neighbour particle map from domain
36
- each_neighbour_static_rim_particles = each_domain.second.getStaticNeighbourRimParticles();
37
-
38
- for (auto& each_particle : each_domain.second.getStaticParticles()) {
39
- // gets particles of domain the particle is in
40
- each_neighbour_particles = each_domain.second.getStaticParticles();
41
-
42
- for (auto& domain_id : neighbour_search->findRelevantNeighbourDomains(each_particle.position, domain_dimensions)) {
43
- // tests if domain of particle has neighbour particles for currently looked at neighbour domain
44
- if (each_neighbour_static_rim_particles.count(domain_id) != 0) {
45
- each_neighbour_particles.insert(each_neighbour_particles.end(),
46
- each_neighbour_static_rim_particles.at(domain_id).begin(),
47
- each_neighbour_static_rim_particles.at(domain_id).end());
48
- }
49
- }
50
-
51
- each_neighbour_particles = neighbour_search->findNeigbours(each_particle.position, each_neighbour_particles);
52
- neighbour_particles.push_back(std::pair<SphParticle, std::vector<SphParticle>>(each_particle, each_neighbour_particles));
53
- }
54
- }
55
- }
56
- */
57
-
58
- for (auto & each_domain : domains) {
59
- for (auto & each_particle : each_domain.second .getStaticParticles ()) {
60
- // computeLocalDensity(each_particle);
61
- each_particle.local_density = 10.0 ;
62
- }
63
- }
64
- }
65
-
66
28
void SphManager::simulate () {
67
29
MPI_Comm_rank (slave_comm, &mpi_rank);
68
30
@@ -79,8 +41,6 @@ void SphManager::simulate() {
79
41
std::cout << " finished static rim exchange" << std::endl;
80
42
}
81
43
82
- initDensities ();
83
-
84
44
MPI_Barrier (slave_comm);
85
45
86
46
if (mpi_rank == 0 ) {
@@ -262,12 +222,12 @@ void SphManager::computeLocalDensity(SphParticle& particle) {
262
222
local_density += neighbour_particle.mass * kernel->computeKernelValue (particle.position - neighbour_particle.position );
263
223
}
264
224
265
- // if (local_density < FLUID_REFERENCE_DENSITY) {
266
- // particle.local_density = FLUID_REFERENCE_DENSITY;
267
- // }
268
- // else {
225
+ if (local_density < FLUID_REFERENCE_DENSITY) {
226
+ particle.local_density = FLUID_REFERENCE_DENSITY;
227
+ }
228
+ else {
269
229
particle.local_density = local_density;
270
- // }
230
+ }
271
231
}
272
232
273
233
Vector3 SphManager::computeDensityAcceleration (SphParticle& particle) {
@@ -644,7 +604,7 @@ void SphManager::exportParticles() {
644
604
645
605
for (auto & each_domain : domains) {
646
606
if (each_domain.second .hasFluidParticles ()) {
647
- for (SphParticle& each_particle : each_domain.second .getParticles ()) { // change getParticles to getFluidParticles later
607
+ for (SphParticle& each_particle : each_domain.second .getFluidParticles ()) { // change getParticles to getFluidParticles later
648
608
particles_to_export.push_back (each_particle);
649
609
}
650
610
}
0 commit comments