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

dimensions      [0 0 0 1 0 0 0];

internalField uniform 910.6781;

boundaryField
{
    htc
	{
        //type            fixedValue;
        //value           uniform 700.;
	    type            codedMixed;

	    refValue        uniform 24.5;
	    refGradient     uniform 0.;
	    valueFraction   uniform 1.;

	    name    	    convHeatTrans;   // name of generated BC

	    code
	    #{
			//Info<< "        Updated BC for temperature" << endl;
			const scalarField DT = patch().lookupPatchField<volScalarField, scalar>("DT");
            //const scalarField rho = patch().lookupPatchField<volScalarField, scalar>("rho");
            //const scalarField cp = patch().lookupPatchField<volScalarField, scalar>("cp");  
			//const scalar HTC = 10.;
			//dimensionedScalar HTC("HTC",dimensionSet (0,0,0,0,0,0,0), 10000.);

			const scalarField HTC = patch().lookupPatchField<volScalarField, scalar>("HTC");
            

			const scalar Tref = 24.5;
            //const scalar DT = 1e-5;
            //const scalar rhoCp = 6.4e6;
	 		
			this->refValue() = Tref;
			this->refGrad() = 0.;
	//		this->valueFraction() = HTC.value()/(DT*this->patch().deltaCoeffs() + HTC.value());
			//this->valueFraction() = HTC/(DT*this->patch().deltaCoeffs() + HTC);
            
            this->valueFraction() = HTC/(DT*this->patch().deltaCoeffs() + HTC);
            //Info << "DT: " << DT << endl;

//			this->valueFraction() = scalar(6.5e06)*HTC/(DT*this->patch().deltaCoeffs() + HTC);
	    #};

	    //codeInclude
	    //#{
	    //    #include "fvCFD.H"
	    //#};

	    //codeOptions
	    //#{
	    //    -I$(LIB_SRC)/finiteVolume/lnInclude
	    //#};
	}

    wall
    {
        type            zeroGradient;
    }
    back
    {
        type            zeroGradient;
    }
    front
    {
        type            zeroGradient;
    }
}


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