// Include code for dynamic mesh motion { // Create point vector fields pointVectorField& intPointDisp = const_cast ( mesh.objectRegistry::lookupObject ( "pointDisplacement" ) ); // Get patch ID for int2ext label intPatch = mesh.boundaryMesh().findPatchID("int2ext"); // Correct point normals on cyclic boundaries (1,0,0) vectorField pointN = mesh.boundaryMesh()[intPatch].pointNormals(); vector N(1.0, 0.0, 0.0); for(std::map >::iterator iter = cList.begin(); iter != cList.end(); ++iter){ pointN[iter->second.first] = N; pointN[iter->second.second] = N; } // Calculate surface motion - interpolate faceGradC to points scalarField faceGradC = gradC.boundaryField()[intPatch]; primitivePatchInterpolation patchInterpolator(mesh.boundaryMesh()[intPatch]); scalarField pointGradC = patchInterpolator.faceToPointInterpolate(faceGradC); vectorField pointU = -pointGradC*pointN/Pe.value(); // Scale by Pe vectorField intDisp = pointU*runTime.deltaTValue(); // Correct points for interpolation error across cyclic boundary for(std::map >::iterator iter = cList.begin(); iter != cList.end(); ++iter){ vector avgX(0.5*(intDisp[iter->second.first].x() + intDisp[iter->second.second].x()), 0,0); intDisp[iter->second.first] = avgX; intDisp[iter->second.second] = avgX; } vectorField &intPatchDisp = refCast(intPointDisp.boundaryField()[intPatch]); intPointDisp.boundaryField()[intPatch] == intPatchDisp + intDisp; // Mesh relaxation for(int cycle=1; cycle <= meshCycles; cycle++){ Info << nl << "Mesh update cycle: " << cycle << endl; mesh.update(); } Info<< "Mesh update: ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << nl << endl; }