- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **How to update polyPatchbs localPoints**
(*http://www.cfd-online.com/Forums/openfoam-solving/60361-how-update-polypatchbs-localpoints.html*)

My mesh is moving at each timeMy mesh is moving at each time step and I want to get the point coordinates on some polyPatch.
When I use mesh.readUpdate, polyPatch's localPoint is not updated? I am wandering how I can force this update operation. Thank you! |

You are doing something wrong:You are doing something wrong:
- polyMesh.readUpdate cals clearGeom on line 313 in polyMeshIO.C - polyMesh::clearGeom calls the clear or boundary patches arond line 232 in clearPolyMesh.C - polyPatch.clearGeom comes from the primitiva patch, file PrimitivePatchClear.C, line 49 which deletes the pointer to local points. Thus, after you do readUpdate, the local points in the patch will be recalculated by force. My guess is that you're either making a local copy somewhere along the way or thet you've messed about with my clear functions. Try switching on the primitive patch, poly patch and polyMesh debug flags and you should get some messages about recalculated local points. Please keep me posted, I need to be 100% sure that the code is OK. Hrv |

Well, I tried to set some debuWell, I tried to set some debug switch. But I don't know how to set "debug" for PrimitivePatch like below. Simply adding one entry in controlDict of foam gives segment fault.
void PrimitivePatch<face,>::clearGeom() { if (debug) { Info<<>::clearGeom() : " << "clearing geometric data" << endl; } deleteDemandDrivenData(localPointsPtr_); deleteDemandDrivenData(faceNormalsPtr_); deleteDemandDrivenData(pointNormalsPtr_); } |

In ~/.OpenFOAM-1.2/controlDictIn ~/.OpenFOAM-1.2/controlDict
set PrimitivePatch 1; in the DebugSwitches section. Hrv |

I found that the problem maybeI found that the problem maybe is caused by that in PrimitivePatch.H
... private: // Private data //- Reference to global list of points PointField points_; ... This part says it has a reference to the global list of points. But actually it is a copy of the global points and it's not updated anywhere. Unfortunately, everything are "recalculated" on this un-updated data. Correct me if I am wrong. |

You're wrong :-)
Look what You're wrong :-)
Look what it says: template<class> class FaceList, class PointField> class PrimitivePatch : This means that PointField is a third template argument for a PrimitivePatch. This is done so that the primitive patch machinery can take either a local point list or a reference to something else. Thus, a definition of a primitivePatch (the one polyPatch is derived from) is: typedef PrimitivePatch<face,> primitivePatch; Finally: class polyPatch : public patchIdentifier, public primitivePatch As you can see, the third template argument is const pointField& and all is well. Anyway, I am 100% certain this stuff is OK beucase there's a ton of stuff that relies to it. I would advise looking at the code that's using it instead. Good hunting, Hrv P.S. Did you get the messages from PrimitivePatch debug to see if the stuff is recalculated as I've suggested? Like I did :-) Take a CAREFUL look at how the recalculation of localPoints happens every time I ask for it. wooster*143-> magU .. movingCone /*---------------------------------------------------------------------------*\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: 1.2 | | \ / A nd | Web: http://www.openfoam.org | | \/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : magU .. movingCone Date : Dec 30 2005 Time : 20:31:45 Host : wooster PID : 31029 Root : .. Case : movingCone Nprocs : 1 Create time Create mesh for time = 0.000000e+00 void polyMesh::calcFaceCells() : calculating faceCells PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch Time = 0.000000e+00 polyMesh::readUpdateState polyMesh::readUpdate() : Updating mesh based on saved data. Cells instance: old = "constant" new = "constant" Points instance: old = "constant" new = "constant" No change PrimitivePatch<face,>::calcLocalPoints() : calculating localPoints in PrimitivePatch PrimitivePatch<face,>::calcMeshData() : calculating mesh data in PrimitivePatch PrimitivePatch<face,>::calcMeshData() : finished calculating mesh data in PrimitivePatch PrimitivePatch<face,>::calcLocalPoints() : finished calculating localPoints in PrimitivePatch Reading U Calculating magU mag(U): max: 0 min: 0 Time = 1.000000e-05 polyMesh::readUpdateState polyMesh::readUpdate() : Updating mesh based on saved data. Cells instance: old = "constant" new = "constant" Points instance: old = "constant" new = "1.000000e-05" Point motion void polyMesh::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::calcLocalPoints() : calculating localPoints in PrimitivePatch PrimitivePatch<face,>::calcLocalPoints() : finished calculating localPoints in PrimitivePatch Reading U PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch Calculating magU mag(U): max: 3.41646 min: 0.00140977 Time = 5.000000e-05 polyMesh::readUpdateState polyMesh::readUpdate() : Updating mesh based on saved data. Cells instance: old = "constant" new = "constant" Points instance: old = "1.000000e-05" new = "5.000000e-05" Point motion void polyMesh::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::calcLocalPoints() : calculating localPoints in PrimitivePatch PrimitivePatch<face,>::calcLocalPoints() : finished calculating localPoints in PrimitivePatch Reading U PrimitivePatch<face,>::calcFaceNormals() : calculating faceNormals in PrimitivePatch PrimitivePatch<face,>::calcFaceNormals() : finished calculating faceNormals in PrimitivePatch Calculating magU mag(U): max: 3.27453 min: 0.000860374 End void polyMesh::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearGeom() : clearing geometric data void polyMesh::clearAddressing() : clearing topology PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing PrimitivePatch<face,>::clearGeom() : clearing geometric data PrimitivePatch<face,>::clearTopology() : clearing patch addressing PrimitivePatch<face,>::clearPatchMeshAddr() : clearing patch-mesh addressing |

sorry guys, I made a mistake isorry guys, I made a mistake in my own code.
Now it's clear. Happy new year! |

All times are GMT -4. The time now is 08:55. |