| 97 | } |
| 98 | |
| 99 | void TimeStepICSPH::step() |
| 100 | { |
| 101 | Simulation *sim = Simulation::getCurrent(); |
| 102 | TimeManager *tm = TimeManager::getCurrent (); |
| 103 | const Real h = tm->getTimeStepSize(); |
| 104 | const unsigned int nModels = sim->numberOfFluidModels(); |
| 105 | |
| 106 | ////////////////////////////////////////////////////////////////////////// |
| 107 | // search the neighbors for all particles |
| 108 | ////////////////////////////////////////////////////////////////////////// |
| 109 | sim->performNeighborhoodSearch(); |
| 110 | |
| 111 | #ifdef USE_PERFORMANCE_OPTIMIZATION |
| 112 | ////////////////////////////////////////////////////////////////////////// |
| 113 | // precompute the values V_j * grad W_ij for all neighbors |
| 114 | ////////////////////////////////////////////////////////////////////////// |
| 115 | START_TIMING("precomputeValues") |
| 116 | precomputeValues(); |
| 117 | STOP_TIMING_AVG |
| 118 | #endif |
| 119 | |
| 120 | ////////////////////////////////////////////////////////////////////////// |
| 121 | // compute volume/density maps boundary contribution |
| 122 | ////////////////////////////////////////////////////////////////////////// |
| 123 | if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Bender2019) |
| 124 | computeVolumeAndBoundaryX(); |
| 125 | else if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Koschier2017) |
| 126 | computeDensityAndGradient(); |
| 127 | |
| 128 | ////////////////////////////////////////////////////////////////////////// |
| 129 | // compute densities |
| 130 | ////////////////////////////////////////////////////////////////////////// |
| 131 | for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++) |
| 132 | computeDensities(fluidModelIndex); |
| 133 | |
| 134 | ////////////////////////////////////////////////////////////////////////// |
| 135 | // Reset accelerations and add gravity |
| 136 | ////////////////////////////////////////////////////////////////////////// |
| 137 | for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++) |
| 138 | clearAccelerations(fluidModelIndex); |
| 139 | |
| 140 | ////////////////////////////////////////////////////////////////////////// |
| 141 | // Compute all nonpressure forces like viscosity, vorticity, ... |
| 142 | ////////////////////////////////////////////////////////////////////////// |
| 143 | sim->computeNonPressureForces(); |
| 144 | |
| 145 | ////////////////////////////////////////////////////////////////////////// |
| 146 | // Update the time step size, e.g. by using a CFL condition |
| 147 | ////////////////////////////////////////////////////////////////////////// |
| 148 | sim->updateTimeStepSize(); |
| 149 | |
| 150 | ////////////////////////////////////////////////////////////////////////// |
| 151 | // compute new velocities only considering non-pressure forces |
| 152 | ////////////////////////////////////////////////////////////////////////// |
| 153 | for (unsigned int m = 0; m < nModels; m++) |
| 154 | { |
| 155 | FluidModel *fm = sim->getFluidModel(m); |
| 156 | const unsigned int numParticles = fm->numActiveParticles(); |
nothing calls this directly
no test coverage detected