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

optimisationManager     singleRun;

primalSolvers
{
    p1
    {
        active                 true;
        type                   incompressible;
        solver                 simple;
        useSolverNameForFields true;

        solutionControls
        {
            nIters 3000;
            residualControl
            {
                "p.*"       1.e-7;
                "U.*"       1.e-7;
                "nuTilda.*" 1.e-7;
            }
        }
    }
    p2
    {
        active                 true;
        type                   incompressible;
        solver                 simple;
        useSolverNameForFields true;

        solutionControls
        {
            nIters 3000;
            residualControl
            {
                "p.*"       1.e-7;
                "U.*"       1.e-7;
                "nuTilda.*" 1.e-7;
            }
        }
    }
}

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

                // manage objectives
                //------------------
                objectives
                {
                    type                incompressible;
                    objectiveNames
                    {
                        losses
                        {
                            weight          1;
                            type            PtLosses;
                            patches         (Inlet Outlet);
                        }
                    }
                }

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

                // solution control
                //------------------
                solutionControls
                {
                    nIters 3000;
                    residualControl
                    {
                        "pa.*"       1.e-7;
                        "Ua.*"       1.e-7;
                        "nuaTilda.*" 1.e-7;
                    }
                }
            }
        }
    }
    am2
    {
        primalSolver             p2;
        operatingPointWeight     300;
        adjointSolvers
        {
            as2
            {
                // choose adjoint solver
                //----------------------
                active                 true;
                type                   incompressible;
                solver                 adjointSimple;
                useSolverNameForFields true;

                // manage objectives
                //------------------
                objectives
                {
                    type                incompressible;
                    objectiveNames
                    {
                        losses
                        {
                            weight              1;
                            type                PtLosses;
                        }
                    }
                }

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

                // solution control
                //------------------
                solutionControls
                {
                    nIters 3000;
                    residualControl
                    {
                        "pa.*"       1.e-7;
                        "Ua.*"       1.e-7;
                        "nuaTilda.*" 1.e-7;
                    }
                }
            }
        }
    }
}

optimisation
{
    sensitivities
    {
        type                surfacePoints;
        patches             (lower upper);
    }
}

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