Velocity gradient at particle location

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Bobopart
Posts: 8
Joined: Fri Feb 15, 2013 12:13 pm

Velocity gradient at particle location

Post by Bobopart »

Hello,

I use the lagrangian particle tracking module, and I am interested in the particle rotation. In order to solve set of equations for the particle angular velocity, I need to know the velocity gradient at the particle location.

Is there a way to compute the velocity gradient at the particle location using the subroutines already coded in Code_Saturne (for instance with grdcel ...) ?

If not, I could compute the velocity gradient at the cells centre using grdcel, and then interpolate (with a tri-linear interpolation) this gradient at the particle location from the values computed at the neighbouring cells centre. In this case, is there a routine that can interpolate cell centre variables to any point in the domain ?

Thanks a lot

Boris
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Velocity gradient at particle location

Post by Yvan Fournier »

Hello,

Yes, gradients are already used in a similar manner as what you need in the Lagrangian module.
There is no function to interpolate values at "any" point in the domain, so the simplest solution is to use the cell value corrected by the gradient (i.e. linear approximation / 1st order Taylor approximation).

You may find examples in the "lagr" subdirectory of the code sources, searching for "grad".

Best regards,

Yvan
Bobopart
Posts: 8
Joined: Fri Feb 15, 2013 12:13 pm

Re: Velocity gradient at particle location

Post by Bobopart »

Hello Yvan,

So, if I understand well, it is not possible to compute the velocity gradient at the particle location directly.

To determine the velocity at the particle location, it is quite straightforward with a 1st order Taylor expansion. But to know the velocity gradient at the particle location, It does seem so straightforward. In this case, I have to compute with grdcel the gradient of each components of the velocity gradient. As the velocity gradient has 9 components, I guess that the cost will not be negligible.

it seems that a tri-linear (or Lagrange) interpolation would be easier to implement. I didn't mention it, but I only work with structured orthogonal mesh. I already have a look, but I didn't find a variable that contains the index of the cells that are in the neighborhood of a particular cell. Is there such a variable that would help to find the neighbors of each cells ?

Thanks a lot.

Boris
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Velocity gradient at particle location

Post by Yvan Fournier »

Hello,

The structured orthogonal mesh won't help you so much, as the code structure won't exploit it, although that hypothesis can help you simplify weighting interpolation.

If you have many particles (on average > 1 particle/cell), it is still cheaper to pre-compute the gradient then use a 1-st order Taylor expansion (and has the advantage of existing examples in the code). If your particles are sparser, using a local-only computation may be more efficient.

We have several structures you may use:
- the Lagrangian module uses a cell->faces connectivity, which you may combine with the face->cells connectivity to search for neighboring cells.
- in version 5.0, there is also a cs_mesh_adjancency _t structure (instantiated in the cs_global_mesh_adjacency variable) which contains both a cell->cells adjacency (for cells connected through faces) and an associated optional extended cells adjacency (whose existence depends on gradient reconstruction options, and contains the additional cells adjacency).

The most practical for your case (except for the gradient + Taylor option) would be to have a cells->vertices adjacency. Such structures are created temporarily for some algorithms (see cs_mesh_connect.c or cs_mesh_halo.c in the sources) but are not maintained throughout the computation (except possibly in the new CDO models, not yet complete or compatible with the Lagrangian model)

Best regards,

Yvan
Post Reply