
[Sponsors] 
November 24, 2009, 04:43 
How to get the heighth,length of a 2D cell?

#1 
Member
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 9 
I want to improve my postprocessing tool for my wave tank to make it suitable for a wave tank with nonuniform mesh.In order to get the average value of a field with nonuniform mesh,I have to calculate the size of each cell (the heigt,length,width of a rectangular cell) as a weight factor,but I don't know how to get this kind of geomertric information of a cell.
One method is to get the coordinate value of the vertices of a cell,then make one subtract another.But I can't go on at the detail. Code:
forAll(mesh.cellCentres,cellid) { if(abs(mesh.cellCentres[cellid].x()x)<=deltaX/2) //deltaX:the length of a cell, choose out the cells at the x point along the 2D wave tank { ncells++; sumField+=field[cellid]*deltaY;//deltaY: the height of a cell weight+=deltaY; Info<<ncells<<"cell No"<< cellid <<"field value"<<field[cellid]<<endl; } } sumField=sumField/weight; //the average value of the gamma field at the x point along the wave tank in the following short script: Code:
const labelList patchCells = this>patch().faceCells(); const fvPatchScalarField& gamma=patch().lookupPatchField<volScalarField,scalar >("gamma"); const pointField& points = mesh.points(); forAll(patchCells,i) { labelList cellpoints=mesh.cellPoints(patchCells[i]); label size=cellpoints.size(); for(int j=0,j<size,j++) //???如何读取单元尺寸 { points[cellpoints[j]].y() ... gamma[patchCells[i]]*... waveAtWavemaker_=... ｝ Is there anyone can help me?Thanks two attachments: the old version of the wave tank postprocessing tool, and another is a new version waiting to be improved to postprocess the nonuniform mesh wave tank. 

December 2, 2009, 22:05 

#2 
Member
Richard Kenny
Join Date: Mar 2009
Posts: 64
Rep Power: 10 
isn't it possible to simply use gAverage (volume averaging)?
Richard 

May 4, 2014, 16:49 

#3 
New Member
Join Date: Oct 2013
Posts: 19
Rep Power: 5 
Hey guys,
Do you know how i can find the deltaX, deltaY and deltaZ of a cell? I can use some thing like "scalar dx = mesh.C()[0].x() * 2.;" for serial, but for parallel case it needs many considerations... So do you know any simple function? 

March 25, 2015, 07:47 
Did you get an answer to get dx, dy and dz?

#4 
New Member
Sam Fredriksson
Join Date: Dec 2010
Posts: 20
Rep Power: 7 
Did you get an answer to get dx, dy and dz?


June 8, 2016, 06:59 

#5  
New Member
Lennart
Join Date: Feb 2016
Posts: 21
Rep Power: 2 
Hey guys,
Quote:
Code:
mesh.delta() Code:
forAll(owner, facei) { delta[facei] = C[neighbour[facei]]  C[owner[facei]]; } 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to determine the direction of cell face vectors on processor patches  sebastian_vogl  OpenFOAM Programming & Development  1  October 11, 2016 13:17 
How to determine the direction of cell face vectors on processor patches  sebastian_vogl  OpenFOAM Running, Solving & CFD  0  October 27, 2009 09:47 
Trimmed cell and embedded refinement mesh conversion issues  michele  OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ...  2  July 15, 2005 04:15 
Warning 097  AB  CDadapco  6  November 15, 2004 05:41 
cell to cell relation  CMB  CDadapco  1  December 4, 2003 05:05 