void LangevinHullForceManager::postCalculation(){ int nTriangles, thisFacet; RealType thisArea; vector<Triangle> sMesh; Triangle thisTriangle; vector<Triangle>::iterator face; vector<StuntDouble*> vertexSDs; vector<StuntDouble*>::iterator vertex; Vector3d unitNormal, centroid, facetVel; Vector3d langevinForce, vertexForce; Vector3d extPressure, randomForce, dragForce; Mat3x3d hydroTensor, S; vector<Vector3d> randNums; // Compute surface Mesh surfaceMesh_->computeHull(localSites_); // Get number of surface stunt doubles sMesh = surfaceMesh_->getMesh(); nTriangles = sMesh.size(); if (doThermalCoupling_) { // Generate all of the necessary random forces randNums = genTriangleForces(nTriangles, variance_); } // Loop over the mesh faces thisFacet = 0; for (face = sMesh.begin(); face != sMesh.end(); ++face){ thisTriangle = *face; vertexSDs = thisTriangle.getVertices(); thisArea = thisTriangle.getArea(); unitNormal = thisTriangle.getUnitNormal(); centroid = thisTriangle.getCentroid(); facetVel = thisTriangle.getFacetVelocity(); langevinForce = V3Zero; if (doPressureCoupling_) { extPressure = -unitNormal * (targetPressure_ * thisArea) / PhysicalConstants::energyConvert; langevinForce += extPressure; } if (doThermalCoupling_) { hydroTensor = thisTriangle.computeHydrodynamicTensor(viscosity_); hydroTensor *= PhysicalConstants::viscoConvert; CholeskyDecomposition(hydroTensor, S); randomForce = S * randNums[thisFacet++]; dragForce = -hydroTensor * facetVel; langevinForce += randomForce + dragForce; } // Apply triangle force to stuntdouble vertices for (vertex = vertexSDs.begin(); vertex != vertexSDs.end(); ++vertex){ if ((*vertex) != NULL){ vertexForce = langevinForce / RealType(3.0); (*vertex)->addFrc(vertexForce); } } } veloMunge->removeComDrift(); veloMunge->removeAngularDrift(); Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); currSnapshot->setVolume(surfaceMesh_->getVolume()); currSnapshot->setHullVolume(surfaceMesh_->getVolume()); ForceManager::postCalculation(); }