时间步长
void FluidSimulation::_stepFluid(double dt) {
if (!_isSkippedFrame) {
//生成更新障碍对象线程
//04-Sep-2020 14h58m32s BEGIN Update Obstacle Objects
//04-Sep-2020 14h58m33s COMPLETE Update Obstacle Objects
_launchUpdateObstacleObjectsThread(dt);
//加载更新障碍对象线程
_joinUpdateObstacleObjectsThread();
//启动更新液位设置线程
//04-Sep-2020 14h58m33s BEGIN Update Liquid Level Set
//04-Sep-2020 14h58m33s COMPLETE Update Liquid Level Set
_launchUpdateLiquidLevelSetThread();
_joinUpdateLiquidLevelSetThread();
//启动平流速度场线程,_advectVelocityFieldThread = std::thread(&FluidSimulation::_advectVelocityField, this);
//04-Sep-2020 14h58m33s BEGIN Advect Velocity Field
//04-Sep-2020 14h58m33s COMPLETE Advect Velocity Field
_launchAdvectVelocityFieldThread();
_joinAdvectVelocityFieldThread();
//启动计算流体曲率网格线程
//
_launchCalculateFluidCurvatureGridThread();
//保存速度场
//04-Sep-2020 14h58m33s BEGIN Save Velocity Field
//04-Sep-2020 14h58m33s COMPLETE Save Velocity Field
_saveVelocityField();
//对速度场施加物体力
//04-Sep-2020 14h58m33s BEGIN Apply Force Fields
//04-Sep-2020 14h58m33s COMPLETE Apply Force Fields
_applyBodyForcesToVelocityField(dt);
//粘度解算器
//将粘度应用于速度场
//
_applyViscosityToVelocityField(dt);
if (_isSurfaceTensionEnabled) {
_joinCalculateFluidCurvatureGridThread();
}
//压力解算器
//04-Sep-2020 14h58m47s BEGIN Solve Pressure System
//04-Sep-2020 14h58m47s COMPLETE Solve Pressure System
_pressureSolve(dt);
//限制速度场
//04-Sep-2020 14h58m33s BEGIN Constrain Velocity Field
//04-Sep-2020 14h58m33s COMPLETE Constrain Velocity Field
_constrainVelocityFields();
if (_isDiffuseMaterialOutputEnabled) {
_joinCalculateFluidCurvatureGridThread();
}
_updateDiffuseMaterial(dt);
if (_isSheetSeedingEnabled) {
_joinCalculateFluidCurvatureGridThread();
}
_updateSheetSeeding();
//更新粒子速度
//04-Sep-2020 14h58m33s BEGIN Update Marker Particle Velocities
//04-Sep-2020 14h58m33s COMPLETE Update Marker Particle Velocities
_updateMarkerParticleVelocities();
//删除保存的速度场
//04-Sep-2020 14h58m33s BEGIN Delete Saved Velocity Field
//04-Sep-2020 14h58m33s COMPLETE Delete Saved Velocity Field
_deleteSavedVelocityField();
//提前标记粒子
//04-Sep-2020 14h58m33s BEGIN Advect Marker Particles
//04-Sep-2020 14h58m33s COMPLETE Advect Marker Particles
_advanceMarkerParticles(dt);
//更新流体对象
//04-Sep-2020 14h58m33s BEGIN Update Fluid Objects
//04-Sep-2020 14h58m34s COMPLETE Update Fluid Objects
_updateFluidObjects();
//输出仿真数据
//04-Sep-2020 14h58m34s BEGIN Generate Output Data
//04-Sep-2020 14h58m34s COMPLETE Generate Output Data
_outputSimulationData();
//04-Sep-2020 14h58m34s BEGIN Generate Surface Mesh
//04-Sep-2020 14h58m34s COMPLETE Generate Surface Mesh
}
}