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/)
-   -   Runtime sampling of line (https://www.cfd-online.com/Forums/openfoam-post-processing/132490-runtime-sampling-line.html)

alientxtmsgs April 1, 2014 13:32

Runtime sampling of line
 
Hello openFoam community,

I have a problem that I am trying to solve with sampling of field variable over a line. What I would like to do is to add a piece of script into my controlDict so that I can obtain the sampled fields during runtime at the same interval as the timestep. I can easily use sampleDict and the command sample to do this after the simulation has finished but I would like to achieve a much higher sampling frequency than just the write output.

At the bottom of my controlDict I have written:

Code:

functions {
  WG9 {
      type sets;
      functionObjectLibs ("libsampling.so");
      setFormat raw;
      interpolationScheme cell;
      outputControl timeStep;
      outputInterval 1;
      axis    z;
      start  (10.369 2.05 0);
      end    (10.369 2.05 1.15);
      nPoints 100;
      fields (alpha1);
  }
}

It seems to run fine without any errors but there is no output folder (I would expect a postProcessing folder to appear after simulation starts much like it does when you run the "forces" function)

Does anyone know if this is even possible what I am trying to accomplish? If so, do I appear to be missing something?

Steven

alientxtmsgs April 2, 2014 21:31

Hello all,

Just for reference I would like to post the solution I have found. Actually, it was someone elses solution I adapted to my own case (found here http://www.cfd-online.com/Forums/ope...ampledset.html), but it eluded me for a good few days.

To sample a field along a user-specified line with an output frequency equal to the time step I added this to the bottom of my controlDict:

Code:

functions {
alpha1 //call this whatever you like
  {
    type sets;
    enabled true;
    verbose true;
    interpolationScheme cellPoint;
    outputControl timeStep;
    outputInterval 1;
    setFormat raw;
    fields (alpha1); //insert the fields you would like to sample
    sets
    (
      WG9 //give the line a name. You can add more sample lines below this one
      {
        type uniform;
        axis z;
        start (10.369 2.05 0);
        end  (10.369 2.05 1.15);
        nPoints 100;
      }
    );
}
  }

I didn't have to add any function object libraries which seems odd to me :confused:. Works just fine though.

Cheers,
Steven


All times are GMT -4. The time now is 19:06.