CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Mesh Utilities

combineCells?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 8, 2009, 03:52
Default combineCells?
  #1
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
Hello,

I would have liked to know if there was a directTopoAction which could be used with directTopoChange which could merge two neighbouring cells into one and delete their initially shared faces?

I saw that there was a combineFaces action which does the same thing for faces.

Otherwise, would you give me some advice about how to encode such a class? What other class would you advise me to look at to have a better idea of how to code a directTopoAction which would do what I need?

Thank you a lot.

Virginie
virginie_e is offline   Reply With Quote

Old   April 10, 2009, 07:36
Default
  #2
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
Hello,

I have tried to use the function removeCell of directTopoChange removeCell(label cell, label mergeCell). I have a few questions about it:
-what does this function excatly do? Does it create a resulting cell which possesses the same label as mergeCell but which is delimited also by the faces of cell? Are the common faces deleted?
- I have tried to set a function to merge two cells with the following programm:

void freeSurfaceGiulianiMerge::mergeCells(label cell, label mergeCell)
{
directTopoChange* topo1 = new directTopoChange(mesh());
directTopoChange& topo = *topo1;
topo.removeCell(cell, mergeCell);
autoPtr<mapPolyMesh> map = topo.changeMesh(mesh(), false);
updateMesh(map);
}

// Update mesh corresponding to the given map
void freeSurfaceGiulianiMerge::updateMesh(const mapPolyMesh& mpm)
{
// Delete oldPoints in polyMesh
//mesh_.resetMotion();

// Update polyMesh.
mesh_.updateMesh(mpm);
// Clear out surface-interpolation
//surfaceInterpolation::movePoints();
// Clear-out fvMesh geometry and addressing
//mesh_.clearOut();

// Update topology for all registered classes
meshObjectBase::allUpdateTopology<fvMesh>(mesh_);

// Map all fields
mapFields(mpm);
Info << " mapFields(mpm);" << endl;
}


// Map all fields in time using the given map
void freeSurfaceGiulianiMerge::mapFields(const mapPolyMesh& meshMap)
{
if (debug)
{
Info << "void freeSurfaceGiulianiMerge::mapFields(const mapPolyMesh& meshMap): "
<< "Mapping fvFields."
<< endl;
}

//- Field mapping class
fvMeshMapper fieldMapper(mesh_,meshMap);
// Map all the volFields in the objectRegistry
MapGeometricFields<scalar, fvPatchField, fvMeshMapper, volMesh>
(fieldMapper);
MapGeometricFields<vector, fvPatchField, fvMeshMapper, volMesh>
(fieldMapper);
// Map all the surfaceFields in the objectRegistry
MapGeometricFields<scalar, fvsPatchField, fvMeshMapper, surfaceMesh>
(fieldMapper);
// Old volumes are not mapped since interpolation is
// performed at the same time level.
}

which is inspired from a class by Sandeep Menon. However, I got the following error:

*** glibc detected *** double free or corruption (out): 0x000000000065c770 ***

which occurs when the function autoPtr<mapPolyMesh> map = topo.changeMesh(mesh(), false);
is used. Have you got an idea what this could be due to?

Thank you a lot.

Virginie
virginie_e is offline   Reply With Quote

Old   April 13, 2009, 18:02
Default
  #3
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 386
Rep Power: 15
deepsterblue will become famous soon enough
Looks like the destructor / delete operator is called on a pointer that's already been deallocated. autoPtr is designed to delete it's contents when it goes out of scope, so the only way to figure it out is to step-through and debug using gdb.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   May 11, 2009, 02:38
Default
  #4
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
Hi Virginie,

could you manage the combine-work? One can probably use the available multigrid functions for this... but I do not know how!?

Fabian
braennstroem is offline   Reply With Quote

Old   May 11, 2009, 03:14
Default
  #5
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
Hi Fabian,

What I managed to do is a function which combines two cells belonging to the same patch (freeSurface as I am using interTrackFoam) but so far it only works in 2D and it still has bugs sometimes...
However, I can send you my class if you are interested. Perhaps it might help you? If yes, could you give me your e-mail address?

Virginie
virginie_e is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 00:10.