CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to write the sampled field values of a curved internal surface? (https://www.cfd-online.com/Forums/openfoam-post-processing/237393-how-write-sampled-field-values-curved-internal-surface.html)

cfdcheckers July 15, 2021 12:51

How to write the sampled field values of a curved internal surface?
 
I am trying to sample the field values on an internal curved surface. The way I managed to sample the values was using the function object surfaceInterpolate in controlDict. For this I created a dummy surface where I needed the sampling and defined it as "empty" physical surface, and correspondingly making it empty in each 0 folder files.



Code:

functions
{
    dummySurfaceData
    {
        type            surfaceInterpolate; //surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        writeControl    writeTime;
        writeFields    true;
        surfaceFormat  raw;
        regionType      faceZone; //faceZone;
        name            dummySurface;
        operation      none;
        fields
        (
            (p pNear) (T TNear) (U UNear)
        );
  }
}

If I open the results in paraview I can see the data on the faceZone but I did not find any file written for the dummySurface field values in the case folder. All I see is the pNear, TNear and UNear files in the time folders but the entries for the dummySurface are none in those.


So am wondering if there's any way I can write these sampled field values to a (csv) file?

piu58 July 15, 2021 13:31

You may define lines where you get the results. Here an example:

Code:

setFormat raw;
surfaceFormat raw;
type    sets;
libs    ("libsampling.so");
interpolationScheme cellPoint;
fields (  U  ); // Fields to sample.


sets (
    w0 {  type lineUniform; axis distance; nPoints 500;
      start (  -0.03 0  0 );
      end (  -0.06 0  0 );
    }
    w5 {  type lineUniform; axis distance; nPoints 300;
start (  -0.0295442 0.00520945  0 );
end (  -0.0413619 0.00729324  0 );
    }

    w10 {  type lineUniform; axis distance; nPoints 300;
start (  -0.0281908 0.0102606  0 );
end (  -0.0394671 0.0143648  0 );
    }
}

  );


cfdcheckers July 15, 2021 15:21

Quote:

Originally Posted by piu58 (Post 808232)
You may define lines where you get the results. Here an example:


Thanks Uwe for a quick example. I just tried this, in my case it will probably be arcUniform type. However, this method requires me to use start and end angle values. This will not be very convenient when I have changes in the dimensions. I intend to do multiple simulations by changing cylinder diameters. That's why a defined patch name would be very convenient, I thought.

Additionally, I do not want to specify number of cells manually.



Any way out in that case?

cfdcheckers July 17, 2021 10:28

Ok, I tried to parameterise it so that it makes a little more convenient.

But it seems mag(U) is not recognised now. Strange. On the forum it doesn't seem like it's been noticed in recent times.


Update: I realised why. It couldn't recognise the field because it doesn't exist! Found an easy way to tackle this by including #includeFunc mag(U) in controlDict


All times are GMT -4. The time now is 22:46.