Interpolate U.internalField to arbitrary distributed points
Given a set of n arbitrary distributed points stored in an array:
Code:
double xyz[3*n] = {x1, y1, z1, ..., xn, yn, zn}; |
Hi,
some code snippets to start with: Code:
#include "volFields.H" // Diverse fields called by fvCFD.H Cheers, David |
Hi David*,
Sorry for my very late reply. I have been quite busy. Thank you for your suggestion. I gave it a try this week. It compiles fine, however, I am getting a "Segmentation Violation" error. This can be related to either invalid memory access or using too much memory. Do you know how memory-intensive this method is? I am interpolating from 116k cells to 500k points. |
It seems that I was interpolating to points which were located outside the source domain. By resolving that I am no longer getting the error. However, the result does include some nan's :(
How can this be possible when the source volVectorField does not include any nan's? EDIT: Never mind there are nan's in the source field. |
Good to hear you figured it out! You probably know already how to check if a point is within the mesh:
Code:
(continued from above) |
I was not yet aware of that, thanks for the tip!
|
So now I have my code running correctly. It is, however, a bit slow because I interpolate to a lot of points. Maybe you guys have suggestions to make this more efficient.
I converted pisoFoam into an object-oriented solver. One of the methods of this PisoFoamSolver class is used to interpolate the vorticity field to arbitrary points (the number of points exceed 100k). Please see the code below I have come up with thanks to David*. NOTE: Because I am running 2D simulations I am only interested in the z-component of the vorticity field. Code:
void PisoFoamSolver::interpolate_velocity(double *xProbes, |
All times are GMT -4. The time now is 06:18. |