View Issue Details

IDProjectCategoryView StatusLast Update
0000585OpenFOAMBugpublic2015-05-01 16:46
Reporterhannes Assigned Touser2 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformamd64OSUbuntuOS Version12.04
Summary0000585: Failure to initialize cyclicAMI
DescriptionOn initialization, the solver stops with the following message:

AMI: Creating addressing and weights between 1141 source faces and 1141 target faces
--> FOAM Warning :
    From function AMIInterpolation<SourcePatch, TargetPatch>::checkPatches(const primitivePatch&, const primitivePatch&)
    in file lnInclude/AMIInterpolation.C at line 146
    Source and target patch bounding boxes are not similar
    source box span : (499.483 802.555 526)
    target box span : (537.422 762.678 526)
    source box : (0 -303.165 -263) (499.483 499.39 263)
    target box : (-499.494 -263.291 -263) (37.9281 499.387 263)
    inflated target box : (-553.047 -316.845 -316.553) (91.4813 552.94 316.553)

Steps To Reproduce*unpack attached case
*run e.g. simpleFoam
Additional InformationThe case includes a periodic boundary (rotational) with triangular faces.
When displaying the patches in paraview and rotating one of them by the periodic angle onto the other, they look pretty good aligned.
The patch pairs rotor_upstream/stator_upstream and rotor_downstream/stator_downstream adjacent to the periodic boundary have been stitched by stitchMesh.
TagsNo tags attached.

Relationships

has duplicate 0000864 closeduser2 cyclicAMIPolyPatch::findFaceMaxRadius computes wrong rotation 

Activities

hannes

2012-07-16 12:02

reporter   ~0001464

Sorry, upload of case file did not work. Probably too big (3.3MB).
Please download from here: http://www.kroegeronline.net/exchange/case.tgz

hannes

2012-07-18 14:31

reporter   ~0001473

Last edited: 2012-07-18 14:34

I have now tried a modification of the case with a conformal triangular mesh on the periodic boundary. You can download it here: http://www.kroegeronline.net/exchange/case2.tgz
I have also replaced the stitched boundaries by AMI interfaces. They make no problems.

With this case the initialization works but a number of weighting factors remain zero (I would expect them all to be equal to 1):
 AMI: Patch source weights min/max/average = 2.16726e-13, 1, 0.99384
 AMI: Patch target weights min/max/average = 0, 1, 0.99384
In turn, the solver crashes because of division by zero.

Modifying the "matchTolerance" doesn't seem to help.
The solver runs, if I shift the "rotationCentre" slightly off the axis, i.e. by 1e-6:
rotor_cyclm
{
 type cyclicAMI;
 nFaces 974;
 startFace 268024;
 neighbourPatch rotor_cyclp;
 matchTolerance 0.0001;
 transform rotational;
 rotationAxis (0.000000 0.000000 1.000000);
 rotationCentre (-1e-6 0.000000 0.000000);
}
This workaround will probably fail, if I have a number of very thin prism layers intersecting the periodic boundary...

user2

2012-08-01 09:41

  ~0001522

Thanks for the report. OpenFOAM is not currently well set-up to handle non-planar cyclic patches - we'll investigate further.

hannes

2013-03-21 12:02

reporter   ~0002031

As the version 2.2.x is now available, I have picked up this issue again and could make some progress.

I have used some other case for my current attempts, but the topology of the cyclic patches is similar. By inspecting the debug output (*.OBJ-files) for this case, I noticed that the neighbour patch was rotated by the wrong angle. I'm not fully sure, but it seems to me that the point with the maximal radius on each patch is used to determine the angle. This could get ambiguous here, because the upper edge of the cyclic patch goes along a constant radius but with changing circumferential angle.

I have circumvented the problem by introducing the possibility to prescribe a fixed rotation angle. I have made the following changes (the files "RodriguesRotation.H" and "RodriguesRotation.C" have been borrowed from OpenFOAM-1.6-ext and added to the my copy of the library):

 src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
index 1d37199..303ba6c 100644
@@ -31,6 +31,7 @@ License
 #include "addToRunTimeSelectionTable.H"
 #include "faceAreaIntersect.H"
 #include "ops.H"
+#include "RodriguesRotation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -138,6 +139,8 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
     {
         case ROTATIONAL:
         {
+ if (!rotationAngle_.valid())
+ {
             point n0 = vector::zero;
             if (half0Ctrs.size())
             {
@@ -181,7 +184,23 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
             const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
             const_cast<vectorField&>(separation()).setSize(0);
             const_cast<boolList&>(collocated()) = boolList(1, false);
+ }
+ else
+ {
+ const_cast<tensorField&>(forwardT()) = tensorField
+ (
+ 1,
+ RodriguesRotation(rotationAxis_, -rotationAngle_())
+ );
+ const_cast<tensorField&>(reverseT()) = tensorField
+ (
+ 1,
+ RodriguesRotation(rotationAxis_, rotationAngle_())
+ );
 
+ const_cast<vectorField&>(separation()).setSize(0);
+ const_cast<boolList&>(collocated()) = boolList(1, false);
+ }
             break;
         }
         case TRANSLATIONAL:
@@ -416,6 +435,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
     nbrPatchID_(-1),
     rotationAxis_(vector::zero),
     rotationCentre_(point::zero),
+ rotationAngle_(NULL),
     separationVector_(vector::zero),
     AMIPtr_(NULL),
     AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
@@ -446,6 +466,11 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
             dict.lookup("rotationAxis") >> rotationAxis_;
             dict.lookup("rotationCentre") >> rotationCentre_;
 
+ if (dict.found("rotationAngle"))
+ {
+ rotationAngle_.reset(new scalar(readScalar(dict.lookup("rotationAngle"))));
+ }
+
             scalar magRot = mag(rotationAxis_);
             if (magRot < SMALL)
             {

 src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H
index 45aef51..53200af 100644
@@ -74,6 +74,8 @@ private:
                 //- point on axis of rotation for rotational cyclics
                 point rotationCentre_;
 
+ autoPtr<scalar> rotationAngle_;
+
 
             // For translation

Maybe some similar solution could be introduced into the upstream repo.

Regards, Hannes

user2

2014-02-18 08:59

  ~0002831

Functionality updated in version 2.3.x - see http://www.openfoam.org/version2.3.0/ami.php

Issue History

Date Modified Username Field Change
2012-07-16 11:53 hannes New Issue
2012-07-16 12:02 hannes Note Added: 0001464
2012-07-18 14:31 hannes Note Added: 0001473
2012-07-18 14:34 hannes Note Edited: 0001473
2012-08-01 09:41 user2 Note Added: 0001522
2012-08-01 09:41 user2 Assigned To => user2
2012-08-01 09:41 user2 Status new => acknowledged
2013-03-21 12:02 hannes Note Added: 0002031
2014-02-18 08:59 user2 Note Added: 0002831
2014-02-18 08:59 user2 Status acknowledged => resolved
2014-02-18 08:59 user2 Fixed in Version => 2.3.x
2014-02-18 08:59 user2 Resolution open => fixed
2014-02-18 08:59 user2 Relationship added has duplicate 0000864