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

dimensions      [0 0 0 1 0 0 0];

internalField   uniform 373.15;

boundaryField
{
    "(left|right|top|bottom)"
    {                                              
        // Dirichlet boundary                        
        type        codedFixedValue;                 
        value       uniform 0;                      
                                                   
        name        T_dirichlet;                              
                                                   
        code                                         
        #{                                           
                                                   
            // Gets current patch                      
            const fvPatch& boundaryPatch = patch();    
                                                   
            // Gets the patch face centres values      
            const vectorField& Cf = boundaryPatch.Cf(); 
                                                   
            // Gets the current field                  
            scalarField& field = *this;                         
                                                   
            // MMS                                     
                                                 
            // Loops over the patch                    
            forAll(Cf, faceI)                          
            {                                          
                // Gets the x component of the current cell 
                const scalar x = Cf[faceI].x(); 

                //Gets the y component of the current cell 
                const scalar y = Cf[faceI].y(); 
                                                  
                const scalar T = 225.0 + 150*Foam::cos(x*x + y*y); 
                                                 
                field[faceI] = T ;                                       
            }                                          

        #};                                          
    }

    defaultFaces
    {
        type            empty;
    }
}

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