My variables are stored at the center of the cells. How can I transfer these values to grid points? If I calculate the algebraic average value there may be a shock.

  • 5
    You will inevitably introduce some error when you interpolate the solution to the vertices. What is your purpose to do this ? If it is just visualization, then many softwares can render cell-center data. E.g., with Visit, you can plot color plots (pseudocolor) where Visit will put one color in each cell which represents the solution value in that cell. This should give a faithful representation of your solution without any interpolation. – Praveen Chandrashekar Oct 24 '17 at 11:32
  • I calculated a flow-field of airfoil use Euler Equation and post-process my data use tecplot360, but I can not represent the boundary of the object and there is a gap in the wake that ruined the contour lines. – swirling leaf Nov 1 '17 at 7:27

As mentioned in a previous comment, this depends on what your goal is. Modern visualization software such as Paraview allow a representation of data at cell centers or at cell vertices. Furthermore, you can switch on the fly and interpolate the data from the cell center to the vertices and vice-versa. In paraview this is achieved using the "Cell Data to Point Data" Filter (to go from cell center to vertices) and the Point Data to Cell Data (to go from cell vertices to cell center). I suggest you look into that, this is an easy way to switch from one visualisation option to another. However, I suggest that except for the "making nice movie part", you focus on visualizing the data at the cell center because this can give you a lot more information. If you have occurence of say, checkboard effect, those might end-up being smudged out when using the point data representation because of the interpolation.

  • I chose Tecplot360 to postprocess CFD results. Thank you! – swirling leaf Nov 1 '17 at 7:35
  • Then this becomes more a Tecplot360 issue than a generic question. In that case you would be better off asking on the forum of that software. – BlaB Nov 1 '17 at 11:13
  • in tec360, cell-center data is called "primary value", you can choose it instead of the default interpolated data called "flood", for instance in "Zone Style -> Contour -> Contour Type" – chris Nov 2 '17 at 8:30

Here is my C++ code for the output of FVM data file in tecplot format.

void OutPut()
{
    int nbPoints=PT->Field.mesh().NodeNumber;
    int nbCells=PT->Field.mesh().CellNumber;
    string name="Energy.dat";
    ofstream outfile("../"+name);
    outfile<<" VARIABLES=\"X\",\"Y\",\"U\", \"V\", \"T\" "<<endl;
    outfile<< "ZONE N="<<nbPoints<<",E="<nbCells<<",ZONETYPE=FEQUADRILATERAL"    <<endl;
    outfile<< "DATAPACKING=block "<<endl;
    outfile<<"  VARLOCATION=( [1,2]=NODAL,[3,4,5]=CELLCENTERED )"<<endl;    for(int i=0; i<nbPoints;i++)
    {
        outfile<< setprecision(20)<<scientific<<PT->Field.mesh().Coordinate[i][0]<<"   "<<endl;
    }
    for(int i=0; i<nbPoints;i++)
    {
        outfile<< setprecision(20)<<scientific<<PT->Field.mesh().Coordinate[i][1]<<"   "<<endl;
    }

    for(int i=0; i<nbCells;i++)
    {
        outfile<<this->U.Field()[i]<<" "<<endl;
    }
    for(int i=0; i<nbCells;i++)
    {
        outfile<<this->V.Field()[i]<<" "<<endl;
    }
    for(int i=0; i<nbCells;i++)
    {
        outfile<<this->Field.Field()[i]<<" "<<endl;
    }

    for(int i=0; i<nbCells;i++)
    {
        if(PT->Field.mesh().Connection[i].size()==3)
        {
            for(unsigned int j=0; j<PT->Field.mesh().Connection[i].size();j++) 
            {
                outfile<<PT->Field.mesh().Connection[i][j]+1<<" "; 
            }
            outfile<<PT->Field.mesh().Connection[i][2]+1;
            outfile<<endl;      
         }

         if(PT->Field.mesh().Connection[i].size()==4)
         {
             for(unsigned int j=0; j<PT>Field.mesh().Connection[i].size();j++)
             {
                 outfile<<PT->Field.mesh().Connection[i][j]+1<<" "; 
             }
             outfile<<endl;     
          }
     }
     outfile.close();
}

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.