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

Problem using AMI

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree51Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 18, 2021, 03:30
Default
  #281
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compičgne, France
Posts: 125
Rep Power: 5
otaolafr is on a distinguished road
Quote:
Originally Posted by louisgag View Post
Having different number of cells on the two neighboring patches is not an issue.
It sounds like you have one cell face that doesn't find any neighbor, that's an issue.
There are some parameters to ignore this type of issue or you can verify visually that all faces properly match with one or more neighbors
hello louis,
thanks for your answer! I have being reading all over the forum without luck... as you can see in the image, the patches are superposed correctly. at least visually, did you meant another thing? there are more image in my original post if necessary
otaolafr is offline   Reply With Quote

Old   May 18, 2021, 04:24
Default
  #282
Senior Member
 
louisgag's Avatar
 
Louis Gagnon
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 334
Rep Power: 17
louisgag is on a distinguished road
Send a message via ICQ to louisgag
I don't know much about this type of use of the AMI interface but you could check whether it is like I said by trying the ACMI: https://openfoam.org/release/2-3-0/non-conforming-ami/
louisgag is offline   Reply With Quote

Old   May 18, 2021, 05:01
Default
  #283
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compičgne, France
Posts: 125
Rep Power: 5
otaolafr is on a distinguished road
Quote:
Originally Posted by louisgag View Post
I don't know much about this type of use of the AMI interface but you could check whether it is like I said by trying the ACMI: https://openfoam.org/release/2-3-0/non-conforming-ami/
hello louis,
I found at least a partial solution for my issue and made it work.
the problem is comming from the feature snapping. I was using a quarter of the geometry (that had two symmetry planes) as the input mesh for the snappy. and when I was doing this the features were perfectly detected, but that brought some problems.I tryied another workflow where I introduce a bigger surface mesh than my real volume and "cut it" with my background mesh therefore the features detected were less (as the ones in the cut will not be detected by surfaceFeatureExtract). this solved my issue. it is not a perfect solution but at least it works.... I will post this and an image ilustrating it in my thread if you want to have a look (so anyone that finish in that thread has an answer)
louisgag likes this.
otaolafr is offline   Reply With Quote

Old   October 22, 2021, 12:56
Default Error when creating AMI patches propeller
  #284
Member
 
Gabriel Felix
Join Date: May 2021
Location: Brazil
Posts: 30
Rep Power: 4
gabrielfelix is on a distinguished road
Hi folks,

I've been running propeller simulations over the last months, and I had been using snappyHexMesh for meshing the propeller geometry and simulation domain before jumping into cfMesh. My simulation structure is completely based on the pimpleFoam propeller tutorial, except that I modified it to run my geometry in compressible steady-state (rhoSimpleFoam) and using MRF technique.

SHM meshes were never as refined as they should be, specially at the leading-edge and near the blade tips. As reported in this thread:
[snappyHexMesh] Rough leading-edge and trailing-edge after snapping, I spent around 2 months trying to improve the mesh, which I actually did, however not sufficiently as I wanted. SHM fails to refine the surface after a certain surface refinement level and also fails to add boundary layers properly to the surface.

After researching for alternatives I came across cfMesh through this video: How to create your first mesh with cfMesh - tutorial by József Nagy that helped me a lot with the introduction to the mesher. It is a much simpler, more intuitive, increadibly fast, and requires fewer configurations compared to SHM. It really surprised me.

I have started meshing with it and the very first mesh I came out with was better than any mesh I had done before with SHM. Not only the surface refinement was excelent, but it succesfully added layers on the whole propeller/airfoil surface. It also executed the mesh in less than a minute, when compared to 10-30 minutes of SHM. I found cfMesh really great, but I'm having difficulties to integrate the mesh to my simulation structure and to dealing with some AMI patches, which I'm going to further detail next.

My domain is composed by:
- propellerTip: are the prop blades
- propellerSpinner: the prop spinner
- innerCylinderSmall: the "moving" domain
- outerCylinder: an outer cylinder that contains the other patches as well as the farfield upstream and downstream of the propeller



snappyHexMesh
The meshing process that I was using was: create a blockMesh wrapping the whole domain; extract stl file surface with surfaceFeatureExtract, mesh with snappyHexMesh;configure the boundary, inlet and outlet face sets; and finally create AMI, inlet and outlet patches.

Code:
blockMesh
surfaceFeatureExtract
snappyHexMesh
topoSet -dict system/createInletOutletSets.topoSetDict
createPatch -overwrite
blockMeshDict:
Code:
scale   1;
convertToMeters   1;

vertices
(
    (-0.65 -0.65 -0.65)
    ( 0.65 -0.65 -0.65)
    ( 0.65  0.65 -0.65)
    (-0.65  0.65 -0.65)
    (-0.65 -0.65  0.65)
    ( 0.65 -0.65  0.65)
    ( 0.65  0.65  0.65)
    (-0.65  0.65  0.65)
);


blocks
(
    hex (0 1 2 3 4 5 6 7) (12 20 12) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    walls
    {
        type wall;
        faces
        (
            (2 6 5 1)
            (0 3 2 1)
            (0 4 7 3)
            (4 5 6 7)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (3 7 6 2)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (1 5 4 0)
        );
    }
);

// ************************************************************************* //
snappyHexMeshDict:
Code:
castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    innerCylinderSmall.stl
	{
		type triSurfaceMesh; 
		name innerCylinderSmall;
	}
	outerCylinder.stl
	{
		type triSurfaceMesh; 
		name outerCylinder;
	}
	propellerTip.stl
	{
		type triSurfaceMesh; 
		name propellerTip;
	}
    propellerSpinner.stl
	{
		type triSurfaceMesh; 
		name propellerSpinner;
	}
}


castellatedMeshControls
{

    maxLocalCells 1000000;

    maxGlobalCells 15000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 2;



    features
    (
        {
            file        "innerCylinderSmall.eMesh";
            level       2;
        }
        {
            file        "outerCylinder.eMesh";
            level       0;
        }
        {
            file        "propellerTip.eMesh";
            level       9;
        }
        {
            file        "propellerSpinner.eMesh";
            level       6;
        }
    );



    refinementSurfaces
    {
        innerCylinderSmall
        {
            level       (2 2);

            faceType    boundary;
            cellZone    innerCylinderSmall;
            faceZone    innerCylinderSmall;
            cellZoneInside  inside;
        }
        outerCylinder
        {
            level       (0 0);
        }
        propellerTip
        {
            level       (1 9);
        }
        propellerSpinner
        {
            level       (1 6);
        }
    }

    resolveFeatureAngle 0.1;


    refinementRegions
    {
        innerCylinderSmall
        {
            mode        inside;
            levels      ((1E15 2));
        }
        outerCylinder
        {
            mode        inside;
            levels      ((1E15 1));
        }
    }

    locationInMesh (0.01 -0.125 0.01);

    allowFreeStandingZoneFaces false;
}


snapControls
{
    nSmoothPatch 3;

    tolerance 1.0; // 1.0;

    nSolveIter 100;

    nRelaxIter 5;

        nFeatureSnapIter 10;

        implicitFeatureSnap true;

        explicitFeatureSnap false;

        multiRegionFeatureSnap true;
}


addLayersControls
{
    relativeSizes true;

    layers
    {
		"propellerTip.*"
			{
				nSurfaceLayers 3;
			}
    }

    expansionRatio 1.0;

    finalLayerThickness 0.3;

    minThickness 0.1;

    nGrow 0;

    featureAngle 30;

    nRelaxIter 3;

    nSmoothSurfaceNormals 1;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;

    maxThicknessToMedialRatio 0.3;

    minMedialAxisAngle 90;

    nBufferCellsNoExtrude 0;

    nLayerIter 100;
}


meshQualityControls
{
    maxNonOrtho 65;

    maxBoundarySkewness 4;
    maxInternalSkewness 4;

    maxConcave 80;

    minVol 1e-13;

    minTetQuality -1e30; // 1e-30;

    minArea -1;

    minTwist 0.01;

    minDeterminant 0.001;

    minFaceWeight 0.05;

    minVolRatio 0.01;

    minTriangleTwist -1;


    nSmoothScale 4;

    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

mergeTolerance 1e-6;


// ************************************************************************* //
createInletOutletSets.topoSetDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    {
        name    boundaryFaces;
        type    faceSet;
        action  new;
        source  patchToFace;
        patch   outerCylinder;
    }
    
    {
        name    outletFaces;
        type    faceSet;
        action  new;
        source  faceToFace;
        set     boundaryFaces;
    }

    {
        name    inletFaces;
        type    faceSet;
        action  new;
        source  faceToFace;
        set     boundaryFaces;
    }

    {
        name    outletFaces;
        type    faceSet;
        action  subset;
        source  normalToFace;
        normal  (0 -1 0);
        cos     0.3;    // Tolerance (max cos of angle)
    }

    {
        name    inletFaces;
        type    faceSet;
        action  subset;
        source  normalToFace;
        normal  (0 1 0);
        cos     0.3;    // Tolerance (max cos of angle)
    }
);

// ************************************************************************* //
createPatchDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
//       with transformations (i.e. cyclics).
pointSync false;

// Patches to create.
patches
(    
    {
        //- Master side patch
        name            AMI1;
        patchInfo
        {
            type            cyclicAMI;
            matchTolerance  0.0001;
            neighbourPatch  AMI2;
            transform       noOrdering;
        }
        constructFrom patches;
        patches (innerCylinderSmall);
    }

    {
        //- Slave side patch
        name            AMI2;
        patchInfo
        {
            type            cyclicAMI;
            matchTolerance  0.0001;
            neighbourPatch  AMI1;
            transform       noOrdering;
        }
        constructFrom patches;
        patches (innerCylinderSmall_slave);
    }


    {
        name inlet;
        patchInfo
        {
            type            patch;
        }
        constructFrom set;
        set inletFaces;
    }
    {
        name outlet;
        patchInfo
        {
            type            patch;
        }
        constructFrom set;
        set outletFaces;
    }
);

// ************************************************************************* //
cfMesh

Now, for cfMesh I tried to keep as much of the previous workflow as possible, however, as seen in this post: Problem using AMI post #184, due to cfMesh limitations I had to create two separate meshes: rotor containing innerCylinderSmall, propellerTip, and propellerSpinner; and stator containing outerCylinder. An then I merged them together with mergeMesh.

I created the mesh on both rotor and stator folders as
Code:
surfaceFeatureEdges rotor.stl rotor.fms
cartesianMesh

surfaceFeatureEdges stator.stl stator.fms
blockMesh
cartesianMesh
with meshDict.rotor:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "mesh";
    object      meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceFile "rotorSlave.fms";

minCellSize 0.005;

maxCellSize 0.01;

boundaryCellSize 0.05;

localRefinement
{
    "propellerTip"
    {
        //cellSize  0.000125;
        additionalRefinementLevels 6;
    }
}

boundaryLayers 
{
    //nLayers 3;
    
    thicknessRatio 1.1;
    
    maxFirstLayerThickness 0.5;
    
    patchBoundaryLayers
    {
        "propellerTip"
        {
            nLayers 3;
            
            allowDiscontinuity 0;
        }
    }
}
meshDict.stator:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "mesh";
    object      meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceFile "outerCylinder.fms";

minCellSize 0.01;

maxCellSize 0.1;

boundaryCellSize 0.1;
Then I execute:
Code:
cd stator
mergeMeshes . ../rotor
topoSet -dict system/createInletOutletSets.topoSetDict
createPatch -overwrite
However, createPatch fails to create AMI2 patch because there is no innerCylinderSmall_slave patch. Thus the AMI2 is created empty with zero faces, as is shown in boundary file below. The patch innerCylinderSmall_slave patch is created as simrego described on this thread below:
Quote:
Originally Posted by simrego View Post
Hi!


If I'm correct it is made in the refinementSurfaces/innerCylinderSmall entry where you define the faceType as boundary. So you split the mesh with walls. Then in the createPatch utility you correct it and create the cyclicAMI interface between them.
it is created in this section of SHM
Code:
refinementSurfaces
    {
        innerCylinderSmall
        {
            level       (2 2);

            faceType    boundary;
            cellZone    innerCylinderSmall;
            faceZone    innerCylinderSmall;
            cellZoneInside  inside;
        }
however, it is not created under cfMesh environment.

I tried many and many things that I saw in multiple threads without any success. I need to create the innerCylinderSmall_slave patch, but I dont know how to copy or duplicate the patch innerCylinderSmall.

createPatch log:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _7bdb509494-20201222 OPENFOAM=2012
Arch   : "LSB;label=32;scalar=64"
Exec   : createPatch -overwrite
Date   : Oct 21 2021
Time   : 15:01:31
Host   : MSI
PID    : 640
I/O    : uncollated
Case   : /mnt/c/Users/Felix/Documents/Mestrado/OpenFOAM/runs/liuPropeller/3liuAs31mscD30implicit/mesh/stator
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Reading "system/createPatchDict"

Adding new patch AMI1 as patch 4 from
{
    type            cyclicAMI;
    matchTolerance  0.0001;
    neighbourPatch  AMI2;
    transform       noOrdering;
}

Adding new patch AMI2 as patch 5 from
{
    type            cyclicAMI;
    matchTolerance  0.0001;
    neighbourPatch  AMI1;
    transform       noOrdering;
}

Adding new patch inlet as patch 6 from
{
    type            patch;
}

Adding new patch outlet as patch 7 from
{
    type            patch;
}


Moving faces from patch innerCylinderSmall to patch 4
--> FOAM Warning :
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching innerCylinderSmall_slave
Read 5050 faces from faceSet inletFaces
Read 4964 faces from faceSet outletFaces

Doing topology modification to order faces.

Not synchronising points.

Removing patches with no faces in them.

Removing zero-sized patch innerCylinderSmall type wall at position 1
Removing patches.
Writing repatched mesh to 0

End
boundary file with AMI2 with zero faces:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       polyBoundaryMesh;
    arch        "LSB;label=32;scalar=64";
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

7
(
    outerCylinder
    {
        type            wall;
        inGroups        1(wall);
        nFaces          18590;
        startFace       16194675;
    }
    propellerSpinner
    {
        type            wall;
        inGroups        1(wall);
        nFaces          14725;
        startFace       16213265;
    }
    propellerTip
    {
        type            wall;
        inGroups        1(wall);
        nFaces          1030388;
        startFace       16227990;
    }
    AMI1
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        nFaces          9448;
        startFace       17258378;
        matchTolerance  0.0001;
        transform       noOrdering;
        neighbourPatch  AMI2;
        AMIMethod       faceAreaWeightAMI;
        restartUncoveredSourceFace 1;
    }
    AMI2
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        nFaces          0;
        startFace       17267826;
        matchTolerance  0.0001;
        transform       noOrdering;
        neighbourPatch  AMI1;
        AMIMethod       faceAreaWeightAMI;
        restartUncoveredSourceFace 1;
    }
    inlet
    {
        type            patch;
        nFaces          5050;
        startFace       17267826;
    }
    outlet
    {
        type            patch;
        nFaces          4964;
        startFace       17272876;
    }
)

// ************************************************************************* //
I saw that createBaffles could do the job, but I could not find any configuration that would help me. I tried to set up the dict below, but it didn't work.
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

internalFacesOnly true;

baffles
{
    baffleFaces
    {
        type		faceZone;
        zoneName	innerCylinderSmall;
    	flip		false;
	
        patches
        {
            master
            {
                name            innerCylinderSmall;
                type            wall;
            }
            slave { ${..master} }
        }
    }
}
What do you folks think I should do? But trying to keep as much of the original workflow?

I'll make available both the snappyHexMesh and cfMesh case folder which I mentioned above:
https://drive.google.com/file/d/1uq8...ew?usp=sharing

Images from the differences of SHM and cfMesh meshes. Left SHM, right cfMesh
Attached Images
File Type: jpg Imagem1.jpg (19.9 KB, 25 views)
File Type: jpg Imagem2.jpg (137.6 KB, 28 views)
gabrielfelix is offline   Reply With Quote

Old   December 2, 2021, 01:13
Default
  #285
New Member
 
Join Date: Oct 2021
Posts: 2
Rep Power: 0
mrk17 is on a distinguished road
Hi Gabriel,

I am facing the same problem. I am trying to setup a case for rhoPimpleFoam to analyse the flow around a propeller.

Like you, I used the snappyHexMesh without success. It just wont work. Then I turned to cfMesh which gave a good mesh. But I am facing issues with the AMI interface.

Per my understanding, when using SHM it will create a faceZone for the innerCylinder patch and a cellZone for the region it encloses (in our case the rotating region). But it will not separate the mesh into two regions (which is what AMI needs). Using the faceZone / the slave patches created by SHM we can use createBaffles / createPatch to separate the mesh into two regions and define AMIs.

In cfMesh, since there are two meshes (rotating and stationary), merging them together creates the two regions AMI needs. All that's left to do is to define AMI with createPatch or edit the boundary file like wyldckat suggested in this post. And I was able to create AMI patches without any issues. But the problem comes when I run the case. I get the following warning every time the solver tries to create weights for the AMI. I just couldn't figure this out.

Code:
AMI: Creating addressing and weights between 376 source faces and 87808 target faces
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
AMI: Patch source sum(weights) min:0.99999753 max:1.01689 average:1.0039146
AMI: Patch target sum(weights) min:0.99869123 max:1.0003692 average:0.99999442
Did you get your case working? If so could you please let me know how you did it?

It will be very helpful if someone could shed some light on this issue I am facing. It seems the face normals are wrong, but I can't figure out how to resolve it.

Regards,
MRK
gabrielfelix likes this.
mrk17 is offline   Reply With Quote

Old   March 16, 2022, 15:49
Default
  #286
Member
 
Gabriel Felix
Join Date: May 2021
Location: Brazil
Posts: 30
Rep Power: 4
gabrielfelix is on a distinguished road
Quote:
Originally Posted by mrk17 View Post
Hi Gabriel,

I am facing the same problem. I am trying to setup a case for rhoPimpleFoam to analyse the flow around a propeller.

Like you, I used the snappyHexMesh without success. It just wont work. Then I turned to cfMesh which gave a good mesh. But I am facing issues with the AMI interface.

Per my understanding, when using SHM it will create a faceZone for the innerCylinder patch and a cellZone for the region it encloses (in our case the rotating region). But it will not separate the mesh into two regions (which is what AMI needs). Using the faceZone / the slave patches created by SHM we can use createBaffles / createPatch to separate the mesh into two regions and define AMIs.

In cfMesh, since there are two meshes (rotating and stationary), merging them together creates the two regions AMI needs. All that's left to do is to define AMI with createPatch or edit the boundary file like wyldckat suggested in this post. And I was able to create AMI patches without any issues. But the problem comes when I run the case. I get the following warning every time the solver tries to create weights for the AMI. I just couldn't figure this out.

Code:
AMI: Creating addressing and weights between 376 source faces and 87808 target faces
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual void Foam::faceAreaWeightAMI::calcInterArea(Foam::label, Foam::label, Foam::scalar&, Foam::vector&) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 414
    Invalid normal for source face 0 points 3((-0.493139 -0.15 -0.869936) (-0.607758 -0.15 -0.794109) (-0.397416 -0.15 -0.773014)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 14 points 4((-0.607758 -0.15 -0.794109) (-0.598065 -0.15 -0.59814) (-0.401316 -0.15 -0.58872) (-0.397416 -0.15 -0.773014)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 31158 points 4((0.800022 0.15 0.390017) (0.800034 0.15 0.400026) (0.810078 0.15 0.400056) (0.810052 0.15 0.390038))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 1 points 4((0.810078 0.15 0.400056) (0.810113 0.15 0.410082) (0.820232 0.15 0.41016) (0.820164 0.15 0.400115))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 2 points 4((0.800052 0.15 0.410039) (0.800077 0.15 0.420057) (0.810163 0.15 0.420116) (0.810113 0.15 0.410082))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 31051 points 4((0.790014 0.15 0.400011) (0.790022 0.15 0.410017) (0.800052 0.15 0.410039) (0.800034 0.15 0.400026))
--> FOAM Warning :
    From virtual bool Foam::faceAreaWeightAMI::overlaps(Foam::label, Foam::label, Foam::scalar) const
    in file AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C at line 493
    Invalid normal for source face 1 points 3((-0.493139 -0.15 -0.869936) (-0.397416 -0.15 -0.773014) (-0.38022 -0.15 -0.924895)) target face 0 points 4((0.800034 0.15 0.400026) (0.800052 0.15 0.410039) (0.810113 0.15 0.410082) (0.810078 0.15 0.400056))
AMI: Patch source sum(weights) min:0.99999753 max:1.01689 average:1.0039146
AMI: Patch target sum(weights) min:0.99869123 max:1.0003692 average:0.99999442
Did you get your case working? If so could you please let me know how you did it?

It will be very helpful if someone could shed some light on this issue I am facing. It seems the face normals are wrong, but I can't figure out how to resolve it.

Regards,
MRK
Can you send me your case files so I can see how you did it?
gabrielfelix is offline   Reply With Quote

Old   June 13, 2022, 02:48
Default
  #287
New Member
 
Gorg
Join Date: Oct 2013
Posts: 5
Rep Power: 11
gorg88 is on a distinguished road
Anyone resolve this problem?
gorg88 is offline   Reply With Quote

Old   September 4, 2022, 23:12
Default
  #288
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 374
Rep Power: 17
quarkz is on a distinguished road
Hi gabrielfelix,

Did you manage to fix your problem? I hope to learn from you. Also, your files can't be downloaded.

Quote:
Originally Posted by gabrielfelix View Post
Hi folks,

I've been running propeller simulations over the last months, and I had been using snappyHexMesh for meshing the propeller geometry and simulation domain before jumping into cfMesh. My simulation structure is completely based on the pimpleFoam propeller tutorial, except that I modified it to run my geometry in compressible steady-state (rhoSimpleFoam) and using MRF technique.

SHM meshes were never as refined as they should be, specially at the leading-edge and near the blade tips. As reported in this thread:
[snappyHexMesh] Rough leading-edge and trailing-edge after snapping, I spent around 2 months trying to improve the mesh, which I actually did, however not sufficiently as I wanted. SHM fails to refine the surface after a certain surface refinement level and also fails to add boundary layers properly to the surface.

After researching for alternatives I came across cfMesh through this video: How to create your first mesh with cfMesh - tutorial by József Nagy that helped me a lot with the introduction to the mesher. It is a much simpler, more intuitive, increadibly fast, and requires fewer configurations compared to SHM. It really surprised me.

I have started meshing with it and the very first mesh I came out with was better than any mesh I had done before with SHM. Not only the surface refinement was excelent, but it succesfully added layers on the whole propeller/airfoil surface. It also executed the mesh in less than a minute, when compared to 10-30 minutes of SHM. I found cfMesh really great, but I'm having difficulties to integrate the mesh to my simulation structure and to dealing with some AMI patches, which I'm going to further detail next.

My domain is composed by:
- propellerTip: are the prop blades
- propellerSpinner: the prop spinner
- innerCylinderSmall: the "moving" domain
- outerCylinder: an outer cylinder that contains the other patches as well as the farfield upstream and downstream of the propeller



snappyHexMesh
The meshing process that I was using was: create a blockMesh wrapping the whole domain; extract stl file surface with surfaceFeatureExtract, mesh with snappyHexMesh;configure the boundary, inlet and outlet face sets; and finally create AMI, inlet and outlet patches.

Code:
blockMesh
surfaceFeatureExtract
snappyHexMesh
topoSet -dict system/createInletOutletSets.topoSetDict
createPatch -overwrite
blockMeshDict:
Code:
scale   1;
convertToMeters   1;

vertices
(
    (-0.65 -0.65 -0.65)
    ( 0.65 -0.65 -0.65)
    ( 0.65  0.65 -0.65)
    (-0.65  0.65 -0.65)
    (-0.65 -0.65  0.65)
    ( 0.65 -0.65  0.65)
    ( 0.65  0.65  0.65)
    (-0.65  0.65  0.65)
);


blocks
(
    hex (0 1 2 3 4 5 6 7) (12 20 12) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    walls
    {
        type wall;
        faces
        (
            (2 6 5 1)
            (0 3 2 1)
            (0 4 7 3)
            (4 5 6 7)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (3 7 6 2)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (1 5 4 0)
        );
    }
);

// ************************************************************************* //
snappyHexMeshDict:
Code:
castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    innerCylinderSmall.stl
	{
		type triSurfaceMesh; 
		name innerCylinderSmall;
	}
	outerCylinder.stl
	{
		type triSurfaceMesh; 
		name outerCylinder;
	}
	propellerTip.stl
	{
		type triSurfaceMesh; 
		name propellerTip;
	}
    propellerSpinner.stl
	{
		type triSurfaceMesh; 
		name propellerSpinner;
	}
}


castellatedMeshControls
{

    maxLocalCells 1000000;

    maxGlobalCells 15000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 2;



    features
    (
        {
            file        "innerCylinderSmall.eMesh";
            level       2;
        }
        {
            file        "outerCylinder.eMesh";
            level       0;
        }
        {
            file        "propellerTip.eMesh";
            level       9;
        }
        {
            file        "propellerSpinner.eMesh";
            level       6;
        }
    );



    refinementSurfaces
    {
        innerCylinderSmall
        {
            level       (2 2);

            faceType    boundary;
            cellZone    innerCylinderSmall;
            faceZone    innerCylinderSmall;
            cellZoneInside  inside;
        }
        outerCylinder
        {
            level       (0 0);
        }
        propellerTip
        {
            level       (1 9);
        }
        propellerSpinner
        {
            level       (1 6);
        }
    }

    resolveFeatureAngle 0.1;


    refinementRegions
    {
        innerCylinderSmall
        {
            mode        inside;
            levels      ((1E15 2));
        }
        outerCylinder
        {
            mode        inside;
            levels      ((1E15 1));
        }
    }

    locationInMesh (0.01 -0.125 0.01);

    allowFreeStandingZoneFaces false;
}


snapControls
{
    nSmoothPatch 3;

    tolerance 1.0; // 1.0;

    nSolveIter 100;

    nRelaxIter 5;

        nFeatureSnapIter 10;

        implicitFeatureSnap true;

        explicitFeatureSnap false;

        multiRegionFeatureSnap true;
}


addLayersControls
{
    relativeSizes true;

    layers
    {
		"propellerTip.*"
			{
				nSurfaceLayers 3;
			}
    }

    expansionRatio 1.0;

    finalLayerThickness 0.3;

    minThickness 0.1;

    nGrow 0;

    featureAngle 30;

    nRelaxIter 3;

    nSmoothSurfaceNormals 1;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;

    maxThicknessToMedialRatio 0.3;

    minMedialAxisAngle 90;

    nBufferCellsNoExtrude 0;

    nLayerIter 100;
}


meshQualityControls
{
    maxNonOrtho 65;

    maxBoundarySkewness 4;
    maxInternalSkewness 4;

    maxConcave 80;

    minVol 1e-13;

    minTetQuality -1e30; // 1e-30;

    minArea -1;

    minTwist 0.01;

    minDeterminant 0.001;

    minFaceWeight 0.05;

    minVolRatio 0.01;

    minTriangleTwist -1;


    nSmoothScale 4;

    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

mergeTolerance 1e-6;


// ************************************************************************* //
createInletOutletSets.topoSetDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    {
        name    boundaryFaces;
        type    faceSet;
        action  new;
        source  patchToFace;
        patch   outerCylinder;
    }
    
    {
        name    outletFaces;
        type    faceSet;
        action  new;
        source  faceToFace;
        set     boundaryFaces;
    }

    {
        name    inletFaces;
        type    faceSet;
        action  new;
        source  faceToFace;
        set     boundaryFaces;
    }

    {
        name    outletFaces;
        type    faceSet;
        action  subset;
        source  normalToFace;
        normal  (0 -1 0);
        cos     0.3;    // Tolerance (max cos of angle)
    }

    {
        name    inletFaces;
        type    faceSet;
        action  subset;
        source  normalToFace;
        normal  (0 1 0);
        cos     0.3;    // Tolerance (max cos of angle)
    }
);

// ************************************************************************* //
createPatchDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
//       with transformations (i.e. cyclics).
pointSync false;

// Patches to create.
patches
(    
    {
        //- Master side patch
        name            AMI1;
        patchInfo
        {
            type            cyclicAMI;
            matchTolerance  0.0001;
            neighbourPatch  AMI2;
            transform       noOrdering;
        }
        constructFrom patches;
        patches (innerCylinderSmall);
    }

    {
        //- Slave side patch
        name            AMI2;
        patchInfo
        {
            type            cyclicAMI;
            matchTolerance  0.0001;
            neighbourPatch  AMI1;
            transform       noOrdering;
        }
        constructFrom patches;
        patches (innerCylinderSmall_slave);
    }


    {
        name inlet;
        patchInfo
        {
            type            patch;
        }
        constructFrom set;
        set inletFaces;
    }
    {
        name outlet;
        patchInfo
        {
            type            patch;
        }
        constructFrom set;
        set outletFaces;
    }
);

// ************************************************************************* //
cfMesh

Now, for cfMesh I tried to keep as much of the previous workflow as possible, however, as seen in this post: Problem using AMI post #184, due to cfMesh limitations I had to create two separate meshes: rotor containing innerCylinderSmall, propellerTip, and propellerSpinner; and stator containing outerCylinder. An then I merged them together with mergeMesh.

I created the mesh on both rotor and stator folders as
Code:
surfaceFeatureEdges rotor.stl rotor.fms
cartesianMesh

surfaceFeatureEdges stator.stl stator.fms
blockMesh
cartesianMesh
with meshDict.rotor:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "mesh";
    object      meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceFile "rotorSlave.fms";

minCellSize 0.005;

maxCellSize 0.01;

boundaryCellSize 0.05;

localRefinement
{
    "propellerTip"
    {
        //cellSize  0.000125;
        additionalRefinementLevels 6;
    }
}

boundaryLayers 
{
    //nLayers 3;
    
    thicknessRatio 1.1;
    
    maxFirstLayerThickness 0.5;
    
    patchBoundaryLayers
    {
        "propellerTip"
        {
            nLayers 3;
            
            allowDiscontinuity 0;
        }
    }
}
meshDict.stator:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "mesh";
    object      meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceFile "outerCylinder.fms";

minCellSize 0.01;

maxCellSize 0.1;

boundaryCellSize 0.1;
Then I execute:
Code:
cd stator
mergeMeshes . ../rotor
topoSet -dict system/createInletOutletSets.topoSetDict
createPatch -overwrite
However, createPatch fails to create AMI2 patch because there is no innerCylinderSmall_slave patch. Thus the AMI2 is created empty with zero faces, as is shown in boundary file below. The patch innerCylinderSmall_slave patch is created as simrego described on this thread below:

it is created in this section of SHM
Code:
refinementSurfaces
    {
        innerCylinderSmall
        {
            level       (2 2);

            faceType    boundary;
            cellZone    innerCylinderSmall;
            faceZone    innerCylinderSmall;
            cellZoneInside  inside;
        }
however, it is not created under cfMesh environment.

I tried many and many things that I saw in multiple threads without any success. I need to create the innerCylinderSmall_slave patch, but I dont know how to copy or duplicate the patch innerCylinderSmall.

createPatch log:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _7bdb509494-20201222 OPENFOAM=2012
Arch   : "LSB;label=32;scalar=64"
Exec   : createPatch -overwrite
Date   : Oct 21 2021
Time   : 15:01:31
Host   : MSI
PID    : 640
I/O    : uncollated
Case   : /mnt/c/Users/Felix/Documents/Mestrado/OpenFOAM/runs/liuPropeller/3liuAs31mscD30implicit/mesh/stator
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Reading "system/createPatchDict"

Adding new patch AMI1 as patch 4 from
{
    type            cyclicAMI;
    matchTolerance  0.0001;
    neighbourPatch  AMI2;
    transform       noOrdering;
}

Adding new patch AMI2 as patch 5 from
{
    type            cyclicAMI;
    matchTolerance  0.0001;
    neighbourPatch  AMI1;
    transform       noOrdering;
}

Adding new patch inlet as patch 6 from
{
    type            patch;
}

Adding new patch outlet as patch 7 from
{
    type            patch;
}


Moving faces from patch innerCylinderSmall to patch 4
--> FOAM Warning :
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching innerCylinderSmall_slave
Read 5050 faces from faceSet inletFaces
Read 4964 faces from faceSet outletFaces

Doing topology modification to order faces.

Not synchronising points.

Removing patches with no faces in them.

Removing zero-sized patch innerCylinderSmall type wall at position 1
Removing patches.
Writing repatched mesh to 0

End
boundary file with AMI2 with zero faces:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       polyBoundaryMesh;
    arch        "LSB;label=32;scalar=64";
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

7
(
    outerCylinder
    {
        type            wall;
        inGroups        1(wall);
        nFaces          18590;
        startFace       16194675;
    }
    propellerSpinner
    {
        type            wall;
        inGroups        1(wall);
        nFaces          14725;
        startFace       16213265;
    }
    propellerTip
    {
        type            wall;
        inGroups        1(wall);
        nFaces          1030388;
        startFace       16227990;
    }
    AMI1
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        nFaces          9448;
        startFace       17258378;
        matchTolerance  0.0001;
        transform       noOrdering;
        neighbourPatch  AMI2;
        AMIMethod       faceAreaWeightAMI;
        restartUncoveredSourceFace 1;
    }
    AMI2
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        nFaces          0;
        startFace       17267826;
        matchTolerance  0.0001;
        transform       noOrdering;
        neighbourPatch  AMI1;
        AMIMethod       faceAreaWeightAMI;
        restartUncoveredSourceFace 1;
    }
    inlet
    {
        type            patch;
        nFaces          5050;
        startFace       17267826;
    }
    outlet
    {
        type            patch;
        nFaces          4964;
        startFace       17272876;
    }
)

// ************************************************************************* //
I saw that createBaffles could do the job, but I could not find any configuration that would help me. I tried to set up the dict below, but it didn't work.
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

internalFacesOnly true;

baffles
{
    baffleFaces
    {
        type		faceZone;
        zoneName	innerCylinderSmall;
    	flip		false;
	
        patches
        {
            master
            {
                name            innerCylinderSmall;
                type            wall;
            }
            slave { ${..master} }
        }
    }
}
What do you folks think I should do? But trying to keep as much of the original workflow?

I'll make available both the snappyHexMesh and cfMesh case folder which I mentioned above:
https://drive.google.com/file/d/1uq8...ew?usp=sharing

Images from the differences of SHM and cfMesh meshes. Left SHM, right cfMesh
quarkz is offline   Reply With Quote

Old   September 4, 2022, 23:51
Default
  #289
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 374
Rep Power: 17
quarkz is on a distinguished road
Btw,

I have read thru all the pages here. I need to rotate my elevator on a plane using AMI. I followed the propeller and annularThermalMixer tutorials. Steady state worked well.

However, rotating the elevator gave 0 weight error after a while of running. I went back to start from the propeller tutorial, slowly modifying step by step to debug for errors. The final objective is to get to my rotating elevator problem.

In my case, the elevator is orientated in a sideway pointing down orientation. The simulation works well even when I change my domain size and replace the propeller for the elevator to match my problem.

However, I found that once I rotate the orientation such that the axis is (0 1 1), the simulation becomes unstable. It seems that reducing the initial time step from 1e-5 to 1e-6 and decreasing the CFL from 1 to 0.5 helps. Simulation runs till 0.8s before it suddenly crashes. Still not sure why.

Any other suggestion? Has anyone tried the new NCC in OF v10? The simulation diverges in its own propeller implementation and I can't get it to work as there's segmentation error at the last step.

Thanks!
quarkz is offline   Reply With Quote

Old   March 7, 2023, 20:26
Default
  #290
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 374
Rep Power: 17
quarkz is on a distinguished road
Some updates to my problem. It seems that generating a new grid can help mitigate some problems. Using lowWeightCorrection = 0.2 also helps.
quarkz is offline   Reply With Quote

Old   March 7, 2023, 20:32
Default
  #291
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 374
Rep Power: 17
quarkz is on a distinguished road
Btw, for those AMI experts out there, supposed I have a propeller and I am trying to use AMI to simulate its rotation. I create an additional AMI cylinder over the propeller.

Supposed I have a wall body next to the propeller. If my AMI cylinder intersects the wall body, is it ok? In other words, are we allowed in OpenFOAM to let the AMI clyinder and wall body overlap one another? Will it give numerical error?

I just tried a similar simulation using moveDynamicMesh and I found that my grid is giving a lot of problem with stuffs like negative volume, incorrect face.

I wonder if it's due the cylinder wall body intersection...
quarkz is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


All times are GMT -4. The time now is 03:18.