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

understanding interpolatedFaces.H in pEqn.H of the overset mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2022, 08:04
Default understanding interpolatedFaces.H in pEqn.H of the overset mesh
  #1
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Hello all,


I'm trying to understand the source in the file interpolatedFaces.H located in pEqn.H of the solver overPimpleDyMFaom.


I understood that the code loops over of all faces. If a face is adjacent to a calculated and an interpolated cell if first look for the closest cell in the different mesh parts (the overlapping meshes in the overset approach). After that it uses all neighbors of the latter closest cell to interpolated the H/A field to the face.



After that it does some transformations before assigning the H/A field to the cell center of the interpolated cell.



What I do not understand is why transform the interpolated vectorField H/A before transferring it to the center of the interpolated cell?


The Part of the code I do not understand is the following:


Code:
    if (cellId != -1)
    {
        const vector& n = faceNormals[faceI];
        vector n1(Zero);

        // 2-D cases
        if (mesh.nSolutionD() == 2)
        {
            for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
            {
                if (mesh.geometricD()[cmpt] == -1)
                {
                    switch (cmpt)
                    {
                        case vector::X:
                        {
                            n1 = vector(0, n.z(), -n.y());
                            break;
                        }

                        case vector::Y:
                        {
                            n1 = vector(n.z(), 0, -n.x());
                            break;
                        }

                        case vector::Z:
                        {
                            n1 = vector(n.y(), -n.x(), 0);
                            break;
                        }
                    }
                }
            }
        }
        else if (mesh.nSolutionD() == 3)
        {
            //Determine which is the primary direction
            if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z()))
            {
                n1 = vector(n.y(), -n.x(), 0);
            }
            else if (mag(n.y()) > mag(n.z()))
            {
                n1 = vector(0, n.z(), -n.y());
            }
            else
            {
                n1 = vector(-n.z(), 0, n.x());
            }
        }
        n1.normalise();

        const vector n2 = normalised(n ^ n1);

        tensor rot =
            tensor
            (
               n.x() ,n.y(), n.z(),
               n1.x() ,n1.y(), n1.z(),
               n2.x() ,n2.y(), n2.z()
            );

//         tensor rot =
//             tensor
//             (
//                n  & x ,n  & y, n  & z,
//                n1 & x ,n1 & y, n1 & z,
//                n2 & x ,n2 & y, n2 & z
//             );

        U1Contrav[faceI].x() =
           2*transform(rot, UIntFaces[faceI]).x()
           - transform(rot, HbyA[receptorNeigCell[faceI]]).x();

        U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();

        U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();

        HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);

Any idea why the transformation is performed. Maybe one has to consider that an interpolated face can have more than one neighbor which cell is calculated?


Best


Michael
mAlletto is offline   Reply With Quote

Old   April 16, 2022, 06:21
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Hello all


I continued analyzing the code. Let's say we have a face normal vector pointing in x-direction. Then the vectors n, n1 and n2 look like this:


n = (1  \ 0 \ 0), n1 = (0 \ -1 \ 0), n2 = (0 \ 0 \ -1)

The rotation matrix looks like this:


rot = 
\begin{array}{rrr} 
1 & 0 & 0 \\ 
0 & -1 & 0 \\ 
0 & 0 & -1 \\ 
\end{array}


For this case the application of the rotation matrix to a vector


u = (u_x \ u_y \ u_z )


we get



u = (u_x \ -u_y \ -u_z )

Last edited by mAlletto; April 17, 2022 at 04:46.
mAlletto is offline   Reply With Quote

Old   April 18, 2022, 05:42
Default
  #3
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Let's analyze the code chunk



Code:
        U1Contrav[faceI].x() =
           2*transform(rot, UIntFaces[faceI]).x()
           - transform(rot, HbyA[receptorNeigCell[faceI]]).x();

        U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();

        U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();

        HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);
a bit further.


For a face normal pointing in x-direction we get:


U_{con,x} = 2*U_{int,x} - HbyA_x = 2*U_{int,x} - HbyA_x  - HbyA_x + HbyA_x = HbyA_x + 2*\Delta U_x


U_{con,y} = - HbyA_y


U_{con,z} =  - HbyA_z


and after applying the backward transformation:


HbyA_x = 2*U_{int,x} - HbyA_x =  U_{int,x} + \Delta U_x


HbyA_y =  HbyA_y


HbyA_z =   HbyA_z


It seem that for a face pointing in x-direction the twice the difference between Hbya and the interpolated velocity at the face is added.

Last edited by mAlletto; April 23, 2022 at 02:26.
mAlletto is offline   Reply With Quote

Old   April 23, 2022, 02:30
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Ok from the above equation it seems that the vector


\frac{\mathbf{H}}{A_p} a the calculated cells is set equal to the velocity resulting from the inverse distance interpolation at the face plus some correction which should correct the mass imbalance coming from the overset interpolation
mAlletto 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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
foam-extend-4.1 release hjasak OpenFOAM Announcements from Other Sources 19 July 16, 2021 05:02
Overset simulation fails when using 2 close together overset + background mesh quarkz OpenFOAM Running, Solving & CFD 0 January 7, 2021 02:36
Overset MESH problem DFBI 6DOF Ale85 STAR-CCM+ 0 October 1, 2013 12:25
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11


All times are GMT -4. The time now is 02:20.