Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "rawTopoChangerFvMesh.H"
00027 #include <OpenFOAM/mapPolyMesh.H>
00028 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00029 #include <finiteVolume/volFields.H>
00030 #include <finiteVolume/linear.H>
00031
00032
00033
00034 namespace Foam
00035 {
00036 defineTypeNameAndDebug(rawTopoChangerFvMesh, 0);
00037 addToRunTimeSelectionTable
00038 (
00039 topoChangerFvMesh,
00040 rawTopoChangerFvMesh,
00041 IOobject
00042 );
00043 }
00044
00045
00046
00047
00048
00049 Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io)
00050 :
00051 topoChangerFvMesh(io)
00052 {}
00053
00054
00055
00056
00057 Foam::rawTopoChangerFvMesh::~rawTopoChangerFvMesh()
00058 {}
00059
00060
00061
00062
00063 bool Foam::rawTopoChangerFvMesh::update()
00064 {
00065
00066 Info<< "rawTopoChangerFvMesh : Checking for topology changes..."
00067 << endl;
00068 autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
00069
00070 bool hasChanged = topoChangeMap.valid();
00071
00072 if (hasChanged)
00073 {
00074 Info<< "rawTopoChangerFvMesh : Done topology changes..."
00075 << endl;
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 PackedList<1> mappedFace(nFaces());
00086
00087 const label nOldInternal = topoChangeMap().oldPatchStarts()[0];
00088
00089 const labelList& faceMap = topoChangeMap().faceMap();
00090 for (label faceI = 0; faceI < nInternalFaces(); faceI++)
00091 {
00092 if (faceMap[faceI] >= 0)
00093 {
00094 mappedFace[faceI] = 1;
00095 }
00096 }
00097 for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++)
00098 {
00099 if (faceMap[faceI] >= 0 && faceMap[faceI] >= nOldInternal)
00100 {
00101 mappedFace[faceI] = 1;
00102 }
00103 }
00104
00105 const List<objectMap>& fromFaces = topoChangeMap().facesFromFacesMap();
00106
00107 forAll(fromFaces, i)
00108 {
00109 mappedFace[fromFaces[i].index()] = 1;
00110 }
00111
00112 const List<objectMap>& fromEdges = topoChangeMap().facesFromEdgesMap();
00113
00114 forAll(fromEdges, i)
00115 {
00116 mappedFace[fromEdges[i].index()] = 1;
00117 }
00118
00119 const List<objectMap>& fromPts = topoChangeMap().facesFromPointsMap();
00120
00121 forAll(fromPts, i)
00122 {
00123 mappedFace[fromPts[i].index()] = 1;
00124 }
00125
00126
00127 Info<< "rawTopoChangerFvMesh : zeroing unmapped boundary values."
00128 << endl;
00129 zeroUnmappedValues<scalar, fvPatchField, volMesh>(mappedFace);
00130 zeroUnmappedValues<vector, fvPatchField, volMesh>(mappedFace);
00131 zeroUnmappedValues<sphericalTensor, fvPatchField, volMesh>(mappedFace);
00132 zeroUnmappedValues<symmTensor, fvPatchField, volMesh>(mappedFace);
00133 zeroUnmappedValues<tensor, fvPatchField, volMesh>(mappedFace);
00134
00135
00136 Info<< "rawTopoChangerFvMesh :"
00137 << " recreating phi for unmapped boundary values." << endl;
00138 const volVectorField& U = lookupObject<volVectorField>("U");
00139 surfaceScalarField& phi = const_cast<surfaceScalarField&>
00140 (
00141 lookupObject<surfaceScalarField>("phi")
00142 );
00143 setUnmappedValues
00144 (
00145 phi,
00146 mappedFace,
00147 (linearInterpolate(U) & Sf())()
00148 );
00149
00150
00151 if (topoChangeMap().hasMotionPoints())
00152 {
00153 pointField newPoints = topoChangeMap().preMotionPoints();
00154
00155
00156 Info<< "rawTopoChangerFvMesh :"
00157 << " calling modifyMotionPoints." << endl;
00158 topoChanger_.modifyMotionPoints(newPoints);
00159
00160
00161 Info<< "rawTopoChangerFvMesh :"
00162 << " calling movePoints." << endl;
00163
00164 movePoints(newPoints);
00165 }
00166 }
00167 else
00168 {
00169
00170
00171 }
00172
00173 changing(hasChanged);
00174
00175 return hasChanged;
00176 }
00177
00178
00179