CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Using mixedFvPatchField for convection BC (https://www.cfd-online.com/Forums/openfoam-solving/63058-using-mixedfvpatchfield-convection-bc.html)

mike_jaworski March 27, 2009 03:56

Using mixedFvPatchField for convection BC
 
Ok, so there are a few threads around the forums that make vague inferences to using mixedFvPatchFields for the convective BC. There are various explanations, stating that it mixes a reference value and a reference gradient to form... well, the mix. None of them are kind enough to actually supply a solution to using the boundary condition for this sort of problem. S. Radl went ahead and wrote a separate BC just for this problem, which worked under 1.4.1, though I'm trying to sort out why it's not compiling in 1.5-dev.

Even so, I've been bugged by the seeming insistence that the mixedFvPatchFields can solve the problem. I gave it a go, but I find reading OF code obtuse because I'm not much of a coder (my C++ is pretty weak) and I haven't been able to wade into it. So, if someone can actually check my basics in this, I'd very much appreciate it.

So, the mixedFvPatchFields file has the following line inside the evaluate function:

Code:

Field<Type>::operator=
  (
        valueFraction_*refValue_
      +
        (1.0 - valueFraction_)*
        (
            this->patchInternalField()
        + refGrad_/this->patch().deltaCoeffs()
        )
  );

Here's my first assumption, that the Field<Type>::operator actually refers to the patch value, which I will call pV. valueFraction will be referred to as vf, rV will be reference value and rG will refer to the reference gradient

Second assumption is that this->patchInternalfield() refers then, to the cell Value (cV) and that the final portion of rV / this->patch().deltaCoeffs() is a method for extrapolating from the cV to the patch surface using the refGrad only. I'll call the deltaCoeffs term D.

So, pV = vf * rV + (1-vf)*(cV + rG*D) eq. 1
Now, if those assumptions are correct, algebra shall ensue as follows:

pV = vf * rV + cV + rG*D - vf* cV - vf*rG*D eq. 2
pV = vf * rV + (1-vf)*rV - (1-vf)*rV + cV -vf * cV + (1-vf)*rG*D eq. 3
pV = rV - (1-vf)*rV + (1-vf)*cV + (1-vf)*rG*D eq. 4
pV - rV = (1-vf)*(rG*D + cV - rV) eq. 5

So, using statements by Hrv that setting vf = 1 is equivalent to a fixedValue BC, this is seen that eq. 5 reduces to pV = rV. So far so good. Setting vf = 0 results in the following:
pV - rV + rV = rG*D + cV eq. 6
pV = rG*D + cV eq. 7

So, at least the behavior makes sense to me and is consistent with what the smarter coder types say.

How to turn this into a convective BC for something like laplacianFoam?

if one sets the refGradient term to 0, then eq. 5 becomes:

pV - rV = (1-vf)*(cV - rV) eq. 8

numerically, the patch value gets set to some interpolation between the reference and the cell value. However, the (cV - rV) term was grouped in with the gradient term, which suggests to me that the RHS of eq. 8 is equivalent to a grad( value ) term. If this is the case, then:
1/(1-vf) * (pV - rV) = (cV - rV) can be rewritten in slightly more familiar terms with h = heat transfer coefficient, k = thermal conductivity and "value" being the temperature:

h / k * (T_{surf} - T_{ref} ) = grad ( T )

so 1 / (1-vf) = h / k and refGrad should be set to zero to obtain a convective boundary condition.

Is this correct or have I just wasted 30 minutes of typing??

Regards,
Mike J.

mike_jaworski March 28, 2009 00:22

So, that was a waste of time. If one is restricted to values of 0 < valueFraction < 1, the arbitrary heat transfer coefficients and conductivities easily surpass this. At the same time, a solver will still run using values outside 0 < vF < 1.

However, it's not the right result. A simple 1D case wound up with a temperature below the reference value. So much for this attempt.

awacs September 24, 2009 21:43

Dear Mike J.

I am interested in the convection BC too:

h / k * (T_{surf} - T_{ref} ) = grad ( T )

Have you got this convection BC

I am study the heating process of a solid, which has several heating channels for hot gas or hot oil flowing through. So the boundary condition at the channel wall belongs to the third-class, just as you mentioned above.

Please give me some tips. Thanks in advance.

Regards,
Jitao


All times are GMT -4. The time now is 10:12.