CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Class to merge cells (Topology change) (https://www.cfd-online.com/Forums/openfoam-programming-development/223185-class-merge-cells-topology-change.html)

Tobi December 29, 2019 17:39

Class to merge cells (Topology change)
 
Hi all,



at the moment I am trying to create an application that checks the mesh while analyzing the cell types. If the cell type is, e.g., a wedge, I want to merge it with the surrounding cells. Up to now, I have all cellID's that has to be merged with the neighbors. Therefore, I also have all cell id's of the neighbors. While using the polyTopoChange class, I am trying to remove/merge the cells. This works actually fine, but here I do not have any idea, if the cell is removed, or if it is merged with the other one. Furthermore, there is still the problem while writing the mesh as the faces have to be updated too. Here is a snipped of the code:
Code:

    //- Get all wedge cells                                                   
    forAll(cellIDTetWedges, cellI)                                             
    {                                                                         
        const label cellID = cellIDTetWedges[cellI];                           
        cell toBeRemoved = mesh.cells()[cellID];                               
                                                                               
        // Get neigbor cells ID                                               
        const labelList& neigborIDs = mesh.cellCells(cellID);                 
                                                                               
        // Merge cell                                                         
        meshMani.removeCell(cellID, neigborIDs[0]);                           
                                                                               
        Info<< meshMani.cellRemoved(cellID) << endl;                           
        Info<< meshMani.cellRemoved(neigborIDs[0]) << endl;                   
    }                                                                         
                                                                               
    meshMani.changeMesh(test, false);

This results in:
Code:

0
1
0
1
0


--> FOAM FATAL ERROR:
Face 19868 is active but its owner has been deleted. This is usually due to deleting cells without modifying exposed faces to be boundary faces.

    From function void Foam::polyTopoChange::makeCells(Foam::label, Foam::labelList&, Foam::labelList&) const
    in file polyTopoChange/polyTopoChange/polyTopoChange.C at line 483.

Here we see, that cells are merged/removed and that I have to incoperate the faces. However, my question here is: Did anybody did something like that before? Any hint about the classes that I could use are warmly welcomed. Surely, I will also check snappyHexMesh. Maybe I will find the corresponding code that merges/splits cells.




PS: The intension could also be as follows: Removing the tet-wedge cell + all cells that are surrounding the cell. Then build a new cell.


Thanks in advance,
Tobi

atulkjoy January 27, 2020 16:25

Can you upload the case or some information ???


All times are GMT -4. The time now is 17:04.