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

optimisationManager singleRun;

primalSolvers
{
    op1
    {
        active                 true;
        type                   incompressible;
        solver                 simple;

        solutionControls
        {
            consistent yes;
            nIters 1000;
            residualControl
            {
                "p.*"       1.e-5;
                "U.*"       1.e-5;
            }
            averaging
            {
                average     true;
                startIter   500;
            }
        }
    }
}

adjointManagers
{
    adjManager1
    {
        primalSolver             op1;
        adjointSolvers
        {
            adjS1
            {
                // choose adjoint solver
                //----------------------
                active                 true;
                type                   incompressible;
                solver                 adjointSimple;

                // manage objectives
                //------------------
                objectives
                {
                    type incompressible;
                    objectiveNames
                    {
                        drag
                        {
                            weight     1.;
                            type       force;
                            patches    ("motorBike.*");
                            direction  (1 0 0);
                            Aref       0.75;
                            rhoInf     1;
                            UInf       20;
                        }
                    }
                }
                // ATC treatment
                //--------------
                ATCModel
                {
                    ATCModel          standard;
                    extraConvection   0;
                    nSmooth           0;
                    zeroATCPatchTypes (wall patch);
                    maskType          pointCells;
                }
                // solution control
                //------------------
                solutionControls
                {
                    consistent yes;
                    nIters 1000;
                    residualControl
                    {
                        "pa.*"       1.e-5;
                        "Ua.*"       1.e-5;
                    }
                }
            }
        }
    }
}


optimisation
{
    sensitivities
    {
        type               surfacePoints;
        patches            (motorBikeGroup);
        includeSurfaceArea false;
        adjointEikonalSolver
        {
            tolerance 1.e-5;
            iters     1000;
            epsilon   0.1;
        }
    }
}

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