|
[Sponsors] |
How to calculate the divergence of velocity at the grid vertex |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 1, 2013, 01:10 |
How to calculate the divergence of velocity at the grid vertex
|
#1 |
New Member
JM
Join Date: Jul 2013
Posts: 7
Rep Power: 12 |
Hello everyone
I want to calculate the divergence of velocity at the grid vertex using the value of cell center just like the attached file showing.Because the mesh file is unstructured,I don't know how to express the U(i+1,j+1)V(i+1,j+1),U(i,j+1)V(i,j+1) U(i+1,j)V(i+1,j),U(i,j)V(i,j). If anyone knows how to realize this,please tell me! Thank you very much! best regards! xiaof |
|
September 1, 2013, 05:51 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings xiaof,
Have a look into:
Bruno
__________________
|
|
September 2, 2013, 09:05 |
|
#3 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Hi xiaof,
You could calculate the cell-centred divergence field and then interpolate this volume field to the vertices, using pointVolInterpolation (available in OpenFOAM-1.6-ext, I'm not sure which class does this in standard OpenFOAM). Best regards, Philip |
|
September 2, 2013, 11:12 |
|
#4 |
New Member
JM
Join Date: Jul 2013
Posts: 7
Rep Power: 12 |
Hi Philip
Thank you for your method.With your method,I can get the divergence at the vertices.But I think it is different what I mean.I need to use the four cell-center velocity around the vertices to get the divergence. So if I get the vertices velocity, can I use Code:
fvc::div() or fvc::grad() thank you! xiaof |
|
September 2, 2013, 11:32 |
|
#5 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Hi xiaof,
I am not sure I understand what exactly you want to do, but I don't think the fvc/fvm operators will do exactly what you want. The fvc/fvm operators typically deal with volume fields (cell centre) and surface fields (face centre). You might be able to active what you want by manually calculating the value for each vertex, e.g. Code:
const labelListList& pointCells = mesh.pointCells(); // go through all points forAll(mesh.points(), pointi) { // go through all cells around pointi forAll(pointCells[pointi], celli) { label cellID = pointCells[pointi][celli]; // do some calculations here, maybe using centre co-ordinates // e.g. divU[pointi] += mesh.C()[cellID]*U[cellID]; } } Maybe you could explain a bit more about why you need to do this calculation, then we might be able to suggest the best way. Best regards, Philip |
|
September 2, 2013, 20:20 |
|
#6 |
New Member
JM
Join Date: Jul 2013
Posts: 7
Rep Power: 12 |
Hi Philip
Because we want want to test a new interpolate scheme.Although the divergence at cell center approaches to zero,the divergence at cell vertices might not.So we want to calculate the divergence of velocity at the grid vertex using the value of cell center. Code:
divU[pointi] += mesh.C()[cellID]*U[cellID]; With the centre co-ordinates,maybe we should calculate some weight coefficient. If the mesh is not hexahedron,how to calculate it with general method? Thank you! regards! xiaof |
|
September 3, 2013, 10:03 |
|
#7 | ||
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Quote:
Quote:
Hi xiaof, OK that sounds like an interesting interpolation scheme. As regards this code: Code:
divU[pointi] += mesh.C()[cellID]*U[cellID]; I cannot help you figure out how to do this for an unstructured grid; however, I would suggest you start by drawing some general polygons around a vertex and see if you can figure out a general method based on surrounding cell centre velocities and coordinates I suppose. For example, OpenFOAM calculates gradients and divergences by summing up terms on each face of a cell so the method is independent of the cell shapes and number of faces. To get the cell IDs of the cells surrounding a point is easy (OpenFOAM does the work), I will rewrite part of code from my previous post with more comments: Code:
// pointCells gives you a list of the cell IDs of the cells around every mesh point const labelListList& pointCells = mesh.pointCells(); // go through all points forAll(mesh.points(), pointi) { // now we go through all cells around pointi // i.e. there are pointCells[pointi].size() cells around pointi // and pointCells[pointi] gives you a list of the cell IDs forAll(pointCells[pointi], celli) { // here is the ID of celli label cellID = pointCells[pointi][celli]; // so we can use cellID to get the velocity or coordinates below // do some calculations here, maybe using centre co-ordinates // just and example calculation - does not mean anything! divU[pointi] += mesh.C()[cellID]*U[cellID]; } } Philip |
|||
September 4, 2013, 04:37 |
|
#8 |
New Member
JM
Join Date: Jul 2013
Posts: 7
Rep Power: 12 |
Hi Philip
Thank you for your explain.Now I can find the all cells around the pointi.What I want to make sue further is which one is the first one ,second one... As to the attached file,is it the leftdown cell is the first one cell.And then I can take different operation. Thank you very much! regards! xiaof |
|
September 4, 2013, 10:07 |
|
#9 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Quote:
In an unstructured mesh, there is no leftUp, rightUP, etc. because there might be 3 surrounding cells or 10 surrounding cells. So for your case, the only pertinent information you know is:
Philip |
||
December 18, 2014, 07:21 |
|
#10 |
Member
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12 |
Dear Philip,
I'm doing the post-processing of a vector field, I want to take an average of velocity along one direction, but I don't know how to get the velocity at the point or center of cell. Would you mind giving me some advice? Thanks! |
|
Tags |
divergence of velocity |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difficulty in calculating angular velocity of Savonius turbine simulation | alfaruk | CFX | 14 | March 17, 2017 06:08 |
Particle trace velocity structure in grid fire simulation | hanklord | Main CFD Forum | 0 | July 12, 2013 03:25 |
How to calculate velocity at a interior surface? | wanghaojie | Fluent UDF and Scheme Programming | 0 | March 23, 2012 10:21 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 09:11 |
Grid Independent Solution | Chuck Leakeas | Main CFD Forum | 2 | May 26, 2000 11:18 |