CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Updating face properties for a moving mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Artur

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 6, 2015, 10:21
Default Updating face properties for a moving mesh
  #1
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Hi All,

I am trying to extract face centres and normal vectors of a set of faces described by a patch. It works fine for a stationary mesh but when I move the code to a dynamic mesh solver and apply rotation to the faces I am interested in the face normal vector does not update but the face centre does.

In other words, the second quantity of the following is always the same:

Code:
Info << mesh.Cf().boundaryField()[patchi][patchFaceI] << " "
     << mesh.Sf().boundaryField()[patchi][patchFaceI] << endl;
Any suggestions how to fix it? I'm digging through the code but haven't found anything yet...

All the best,

A
Artur is offline   Reply With Quote

Old   January 6, 2015, 11:10
Default
  #2
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
I'm sorry, I was looking at a wrong face. Everything works as it should, it was just me being stupid.

In case someone wonders, here's a piece of code computing the normal of a face (taken from primitiveMeshGeometry.C) I used to find the mistake:

Code:
    const labelList& f = mesh.faces()[faceI];
    const List<point>& p = mesh.points();
    
    label nPoints = f.size();
    
    vector sumN = vector::zero;

    point fCentre = p[f[0]];
    for (label pi = 1; pi < nPoints; pi++)
    {
        fCentre += p[f[pi]];
    }

    fCentre /= nPoints;

    for (label pi = 0; pi < nPoints; pi++)
    {
        const point& nextPoint = p[f[(pi + 1) % nPoints]];

        vector n = (nextPoint - p[f[pi]])^(fCentre - p[f[pi]]);

        sumN += n;
    }

    Info << 0.5*sumN << endl; // final result for the area vector
gentela likes this.
Artur is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Meshing & Mesh Conversion 13 February 17, 2022 08:34
Question on moving mesh, mesh velocity is really small! ripperjack Main CFD Forum 2 April 28, 2014 14:37
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36


All times are GMT -4. The time now is 05:37.