CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   adjointShapeOptimizationFoam checkerboarding inlet (https://www.cfd-online.com/Forums/openfoam-solving/103229-adjointshapeoptimizationfoam-checkerboarding-inlet.html)

sylvester June 14, 2012 05:52

adjointShapeOptimizationFoam checkerboarding inlet
 
5 Attachment(s)
For an optimization study I am working with an Ahmed body using adjointShapeOptimizationFoam.

As you can see from the picture 'ahmed_alpha.jpg' the solver works really well near the body, trying to extend the body with an aerodynamic fairing. However near the inlet I am experiencing a strange checkerboarding problem in my adjoint equations, see pictures 'ahmed_pa.jpg' and 'ahmend_Ua.jpg'. All pictures are taken after (only) 100 iterations.After a further several hundred iterations the adjoint flow field fully diverges. The primal flow field is smooth, as expected, see pictures 'ahmed_p.jpg' and 'ahmed_U.jpg'.

The adjoint boundary conditions are taken from the adjointShapeOptimizationFoam tutorial (see below), as are the values for lambda and alphaMax. The fvSolution and fvSchemes settings (see below) are based on the tutorials with lower adjoint relaxations and uncorrected in stead of corrected schemes. Lower values of relTol and relaxation where also tested, but without improvements. CheckMesh reports 'Mesh OK', with no warnings.

Does anyone have suggestions on how best to solve this?

Thanks!

regards,
Sylvester

Code:

solvers
{
    "(p|pa)"
    {
        solver          GAMG;
        tolerance      1e-08;
        relTol          0.01;
        smoother        GaussSeidel;
        nPreSweeps      0;
        nPostSweeps    2;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }
    "(U|Ua|k|omega)"
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        nSweeps        2;
        tolerance      1e-08;
        relTol          0.1;
    }
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
    fields
    {
        p              0.3;
        pa              0.1;
        alpha          0.1;
    }
    equations
    {
        U              0.7;
        Ua              0.1; 
        "(k|omega)"    0.7;
    }

Code:

ddtSchemes
{
    default        steadyState;
}

gradSchemes
{
    default        Gauss linear;
}

divSchemes
{
    default        Gauss upwind;
    div((nuEff*dev(T(grad(U))))) Gauss linear;
    div((nuEff*dev(T(grad(Ua))))) Gauss linear;
}

laplacianSchemes
{
    default        Gauss linear uncorrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        uncorrected;
}

fluxRequired
{
    default        no;
    p;
    pa;
}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [ 0 2 -2 0 0 0 0 ];

internalField  uniform 0;

boundaryField
{
    ".*"
    {
        type            zeroGradient;
    }
    outlet
    {
        type            adjointOutletPressure;
        value          uniform 0;
    }
    symmetry
    {
        type            symmetryPlane;
    }
}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      Ua;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [ 0 1 -1 0 0 0 0 ];

internalField  uniform ( -1 0 0 );

boundaryField
{
    ".*"
    {
        type            fixedValue;
        value          uniform ( 0 0 0 );
    }
    inlet
    {
        type            fixedValue;
        value          uniform ( -1 0 0 );
    }
    outlet
    {
        type            adjointOutletVelocity;
        value          uniform ( 0 0 0 );
    }
    farfield
    {
        type            slip;
    }
    symmetry
    {
        type            symmetryPlane;
    }
}


sylvester June 19, 2012 04:46

pseudo staggered approach for the adjoint equations
 
2 Attachment(s)
Hi!

Using a pseudo staggered approach for the adjoint equations helps, see the images below.

I've modified adjointShapeOptimizationFoam a bit so it uses the pseudo staggered grid approach also used in, for example, buoyantBoussinesqSimpleFoam.

As you can see in the images, this approach removes the checkerboarding near the floor, but it does not completely remove it over the full surface of the inlet. The adjoint equations only diverge at the inlet, the rest of the domain are OK. The second image also shows that the calculation of 'alpha' is unaffected by the pseudo staggering.

Any directions on how to proceed would be much appreciated!

Regards,
Sylvester

immortality January 7, 2013 15:51

hi.how did you solved the problem?can this solver be used for compressible flows?could you introduce me some useful papers or texts about using the method?i want to know how points are changed according to this solver.can it be used with optimization algorithms like ant colony or other ones?thank you.

sylvester January 8, 2013 04:38

Hi,

I haven't been able to work on this, so not much progress has been made. The adjoint solver in OpenFOAM is for incompressible flows only. For compressible flows the adjoint equations also exist, so you should be able to make a compressible version. A Google search will probably provide you with references on this.

regards,
Sylvester

immortality January 8, 2013 05:44

thanks.if send me a suitable to start pdf ill be very thankful to you!
Force.of.love@gmail.com

C. Okubo May 28, 2018 10:36

Hi!

I know its been a while since this post started. Any news? I am facing the same problem. Even though I was able to have some better results by using a limited grad(Ua) and relaxation factors higher for pa than Ua, I would say that something inside the solver needs attention. If you check adjoint velocities at the inlet, they point to an akward direction, this make confuse sensitivities and inlet of the domains happens to have some checkerboard. See this other post:

https://www.cfd-online.com/Forums/op...-behavior.html

I still was not able to fix this (if this is something that needs to be fixed).

Regards,

Okubo


All times are GMT -4. The time now is 00:54.