CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to update polyPatchbs localPoints

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2005, 18:11
Default My mesh is moving at each time
  #1
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 17
liu is on a distinguished road
My 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!
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Old   December 28, 2005, 18:26
Default You are doing something wrong:
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   December 28, 2005, 18:58
Default Well, I tried to set some debu
  #3
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 17
liu is on a distinguished road
Well, 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_);
}
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Old   December 28, 2005, 19:23
Default In ~/.OpenFOAM-1.2/controlDict
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
In ~/.OpenFOAM-1.2/controlDict

set

PrimitivePatch 1;

in the DebugSwitches section.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   December 30, 2005, 15:09
Default I found that the problem maybe
  #5
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 17
liu is on a distinguished road
I 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.
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Old   December 30, 2005, 15:31
Default You're wrong :-) Look what
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   December 30, 2005, 17:27
Default sorry guys, I made a mistake i
  #7
liu
Senior Member
 
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 17
liu is on a distinguished road
sorry guys, I made a mistake in my own code.
Now it's clear.

Happy new year!
__________________
Xiaofeng Liu, Ph.D., P.E.,
Assistant Professor
Department of Civil and Environmental Engineering
Penn State University
223B Sackett Building
University Park, PA 16802


Web: http://water.engr.psu.edu/liu/
liu is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
velocity update fluent_urs FLUENT 6 July 8, 2008 11:41
FLEXlm update or ?? Kasper Skriver Siemens 2 March 1, 2007 10:38
IcoTopoFoam update hjasak OpenFOAM Running, Solving & CFD 0 March 28, 2005 21:32
UDF update profile ramesh FLUENT 0 June 29, 2003 14:14
MOUSE - any update? Pei-Ying Hsieh Main CFD Forum 1 March 19, 2001 05:04


All times are GMT -4. The time now is 21:01.