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

USource
{
    type            coded;
    selectionMode   all;
    field           U;
    codeAddSup
    #{
        const volVectorField& U = eqn.psi();
        vectorField& USource = eqn.source();
        const fvMesh& mesh = U.mesh();
        const DimensionedField<scalar, volMesh>& V = mesh.V();
        const meshCellZones& cellZones = mesh.cellZones();
        scalar A = 1.0;
        scalar Cd = 500;
        forAll(cellZones[0], i)
        {
            label k = cellZones[0][i];
            USource[k] -= -Cd*A*mag(U[k])*U[k]*V[k];
        }
    #};
}


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