/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2512                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      optimisationDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

optimisationManager    steadyOptimisation;

primalSolvers
{
    p1
    {
        active                 true;
        type                   incompressible;
        solver                 simple;
        consistent             true;
        solutionControls
        {
            nIters 3000;
            nInitialIters 10000;
            consistent             true;
            residualControl
            {
                "p.*"       1.e-7;
                "U.*"       1.e-7;
            }
        }
    }
}

adjointManagers
{
    am1
    {
        primalSolver             p1;
        adjointSolvers
        {
            as1
            {
                // choose adjoint solver
                //----------------------
                active                 true;
                type                   incompressible;
                solver                 adjointSimple;
                consistent             true;

                // manage objectives
                //------------------
                objectives
                {
                    type            incompressible;
                    objectiveNames
                    {
                        drag
                        {
                            weight          1.;
                            type            force;
                            patches         (pressure suction);
                            direction       (0.9993908270189999 0.034899496703 0);
                            Aref            2.;
                            rhoInf          1.225;
                            UInf            6;
                            normalise       true;
                        }
                    }
                }

                // ATC treatment
                //--------------
                ATCModel
                {
                    ATCModel        standard;
                }

                // solution control
                //------------------
                solutionControls
                {
                    nIters        3000;
                    nInitialIters 10000;
                    consistent             true;
                    residualControl
                    {
                        "pa.*"       1.e-7;
                        "Ua.*"       1.e-7;
                    }
                }
            }
            lift
            {
                // choose adjoint solver
                //----------------------
                active                  true;
                type                    incompressible;
                solver                  adjointSimple;
                isDoubleSidedConstraint true;
                consistent              true;

                // manage objectives
                //------------------
                objectives
                {
                    type            incompressible;
                    objectiveNames
                    {
                        lift
                        {
                            weight          1000.;
                            type            force;
                            patches         (pressure suction);
                            direction       (-0.034899496703 0.9993908270189999 0);
                            Aref            2.;
                            rhoInf          1.225;
                            UInf            6;
                            target          0.05340147181439196;
                            targetLeft      0.05320147181439196;
                        }
                    }
                }

                // ATC treatment
                //--------------
                ATCModel
                {
                    ATCModel        standard;
                }

                // solution control
                //------------------
                solutionControls
                {
                    nIters        3000;
                    nInitialIters 10000;
                    consistent             true;
                    residualControl
                    {
                        "pa.*"       1.e-7;
                        "Ua.*"       1.e-7;
                    }
                }
            }
            vol
            {
                // choose adjoint solver
                //----------------------
                active                 true;
                type                   null;
                isConstraint           true;

                // manage objectives
                //------------------
                objectives
                {
                    type                geometric;
                    objectiveNames
                    {
                        vol
                        {
                            weight          -1;
                            type            partialVolume;
                            patches         (pressure suction);
                            target          -0.15;
                        }
                    }
                }
            }
        }
    }
}

optimisation
{
    convergence
    {
        objective       1.e-04;
    }
    designVariables
    {
        type            shape;
        shapeType       volumetricBSplines;
        sensitivityType shapeFI;
        patches         (pressure suction);
        maxInitChange   5.e-3;
        nonOverlappingCPs true;
    }
    updateMethod
    {
        method          ISQP;
        delta           1;
        lineSearch
        {
            type ArmijoConditions;
            stepUpdateType quadratic;
            minRatio 0.05;
        }
    }
}

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