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

Create dynamic cellSet

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

Like Tree1Likes
  • 1 Post By Pedro24

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2012, 12:34
Default Create dynamic cellSet
  #1
Member
 
Pierre HORGUE
Join Date: May 2009
Posts: 33
Rep Power: 16
Pedro24 is on a distinguished road
Hello,

I want to create a dynamic set of cells, i.e., which evolves with time.

Example :

I created a Bounding box ( xmin(t), ymin(t) ) ( xmax(t), ymax(t) )

With the function boxToCell, I can define a set "myCellSet" which contains all the cells within the Bounding box (using the "setSet" tools). But I want that this set of cells evolves with time which means that i must include this operation in my solver "myInterFoam.C" (for example) :

At the timestep 1, "myCellSet" contains all cells in (xmin(1) ymin(1)) (xmax(1) ymax(1)

At the timestep 2, "myCellSet" contains all cells in (xmin(2) ymin(2)) (xmax(2) ymax(2))

....

My problem is that i created successfully a "dynamic" bounding box but i can't create a topoSet containing the cell labels of my bounding box.

How can I create at each time step this topoSet ?

Thank you

Pierre
Pedro24 is offline   Reply With Quote

Old   May 4, 2012, 03:45
Default
  #2
Member
 
Pierre HORGUE
Join Date: May 2009
Posts: 33
Rep Power: 16
Pedro24 is on a distinguished road
Hi ,

I finally found how to create a cellSet (and the cellZone associated) dynamically in a box which evolves with time. Here is my code :

// size of the box where minPoint and maxPoint evolves with time
const point minPoint(xmin,ymin,zmin);
const point maxPoint(xmax,ymax,zmax);

// IStringStream generation
string buffer = "(";
string aux = " ";
std:stringstream sXmin,sYmin,sZmin,sXmax,sYmax,sZmax;
sXmin << xmin;
sYmin << ymin;
sZmin << zmin;
sXmax << xmax;
sYmax << ymax;
sZmax << zmax;
buffer = buffer + sXmin.str() + aux + sYmin.str() + aux + sZmin.str();
aux = ") (";
buffer = buffer + aux;
aux = " ";
buffer = buffer + sXmax.str()+ aux + sYmax.str() + aux + sZmax.str() ;
aux = ")";
buffer = buffer + aux;
IStringStream isString(buffer);

// cellSet creation
const globalMeshData& parData = mesh.globalData();
label typSize =
max
(
parData.nTotalCells(),
max
(
parData.nTotalFaces(),
parData.nTotalPoints()
)
);

const word setType = "cellSet";
const word setName = "myVofSet";
autoPtr<topoSet> currentSetPtr = topoSet::New(setType, mesh, setName, typSize);
topoSet& currentSet = currentSetPtr();

// boxToCell creation
word sourceType="boxToCell";
autoPtr<topoSetSource> setSource
(
topoSetSource::New
(
sourceType,
mesh,
isString
)
);

// Application of the topoSetSource to "myVofSet"
topoSetSource::setAction action = topoSetSource::toAction("new");
setSource().applyToSet(action, currentSet);


// cellZone creation
Info<< "Adding set " << currentSet.name() << " as a cellZone." << endl;
SortableList<label> cellLabels(currentSet.toc());
label sz = mesh.cellZones().size();
mesh.cellZones().setSize(sz+1);
mesh.cellZones().set
(
sz,
new cellZone
(
currentSet.name(),
cellLabels,
sz,
mesh.cellZones()
)
);


Now, I have a "dynamic" cellZone and I want to extract a submesh of all cells in the cellZone. Do you know if is it possible ?

Thanks,

Pierre
Artur likes this.
Pedro24 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
[blockMesh] Create a "triangular box" with blockMesh voingiappone OpenFOAM Meshing & Mesh Conversion 4 May 22, 2015 02:22
How to define cells which belongs to ratating patch in MRFSImpleFoam bharat OpenFOAM Running, Solving & CFD 26 August 18, 2013 18:35
[mesh manipulation] Tutorial for dynamic mesh gizmo OpenFOAM Meshing & Mesh Conversion 3 January 13, 2011 12:17
Create a cellSet out of the gamma directory cricke OpenFOAM Running, Solving & CFD 11 July 12, 2009 03:52
Create 3d Grid query - Star cd 3.24.0 version Pankaj Siemens 3 October 15, 2008 09:36


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