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

9 point laplacian

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2011, 20:10
Default 9 point laplacian
  #1
Member
 
valerio
Join Date: Jun 2009
Location: Nancy
Posts: 30
Rep Power: 16
Alucard is on a distinguished road
Goodmorning,
I'm trying to solve a PDE (ex: dT/dt=Lapl(T)) and I would try to access the 8 points close to a cell "i" in order to calculate a 9 point laplacian.
The idea it's to solve it in a esplicit way using a forAll loop on the internal mesh points of the domain.
The mesh is regular and the domain is a square (nothing complicated).
Can you please tell me, once that I start the farAll loop how to find the neighboors of (exemple) alpha[i]? and how they are ordered (N,S,E,W,NE,NW,SW and SE)?
thank you

Last edited by Alucard; November 26, 2011 at 03:59.
Alucard is offline   Reply With Quote

Old   November 26, 2011, 02:48
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hello and good morning to you

1. You can get all of the neighbours including the cell, cellI, itself by using the following:

Code:
const labelListList & cellPoints( mesh.cellPoints() );
const labelListList & pointCells( mesh.pointCells() );

label count(0);
const labelList & cps( cellPoints[cellI] );

forAll(cps, pointi)
    count += pointCells[cps[pointi]].size();

labelList allCellCells(count);
count = 0;

forAll(cps, pointi)
{
const labelList & pcs( pointCells[cellPoints[cellI]] );
forAll( pcs, celli)
allCellCells[count++] = pcs[celli];
}

// Do a sort and a unique to remove duplicates
2. You cannot be ensured any particular ordering at all, as the underlying mesh structure in OF is unstructured.

Good luck,

Niels
ngj is offline   Reply With Quote

Old   November 28, 2011, 06:17
Default
  #3
Member
 
valerio
Join Date: Jun 2009
Location: Nancy
Posts: 30
Rep Power: 16
Alucard is on a distinguished road
Thank you very much i try it (infact i solve a more complicated equation than the heat transfer one but I needed the 9 points stencil so your answer is really what I need)
--
Best regards,
Valerio
Alucard is offline   Reply With Quote

Old   November 28, 2011, 06:28
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Valerio

Good. BTW: Note that the outlined code also works in 3D, which would give you the entire 27 cell stencil.

I typically use the std::sort and std::unique to truncate the list of cell labels.

Best regards,

Niels
ngj 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
block-structured mesh for t-junction Robert@cfd ANSYS Meshing & Geometry 20 November 11, 2011 05:59
Problem with UDF compiling for kTkLW model Wantami FLUENT 0 July 18, 2011 06:11
CFX Post: Problems with moving point cloud for changing time steps spatialtime CFX 0 December 7, 2009 05:56
[Gmsh] Gmsh and samplesurface touf OpenFOAM Meshing & Mesh Conversion 2 December 10, 2007 03:27
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 16:44.