CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Boundary condition (http://www.cfd-online.com/Forums/openfoam-programming-development/75229-boundary-condition.html)

OFU April 20, 2010 03:35

Boundary condition
 
Hi all,

For my computations I need to specify a special boundary condition for U at the inner wall, so that I can set Ux and Uy to fixedValue and Uz to zeroGradient. But a I don't have experience in creating new boundary conditions, so at the moment I don't know how to realize this. I found something to read about creating new boundary conditions but nothing about boundary conditions which allow to specify a value for each of the three components of U. Can somebody help me? Or is there already such a boundary condition in OF 1.6?

Thanks,
Jennifer

herbert April 21, 2010 11:10

Hi Jennifer,

I think the directionMixedBC should be able to do this job.

Good luck
Stefan

OFU April 22, 2010 09:46

Hi Stefan,

thanks for your answer. I had a look on directionMixed BCs, but now I don't understand how to use them :(
Can you perhaps give me an example or explain me how to use this boundary condition?

Jennifer

herbert April 22, 2010 10:18

Hi Jennifer,

this boundary condition is a blending between fixedValue and fixedGradient. The syntax is as follows
Code:

type              directionMixed;
refValue        uniform (ux uy uz);
refGradient    uniform (dUx dUy dUz);
valueFraction  uniform (XX XY XZ YY YZ ZZ);

Meaning of the single terms:
refValue: components of U needed for fixedValue
refGradient: components of gradient needed for fixedGradient
valueFraction: symmetric tensor which indicates if BC for a component is fixedValue (1) or fixedGradient (0)


An easy example: Think about an outlet where you want the normal component of U (e.g. z-Direction) to be zeroGradient but the other components to be zero. Then the syntax is:
Code:

type              directionMixed;
refValue        uniform (0 0 0);
refGradient    uniform (0 0 0);
valueFraction  uniform (1 0 0 1 0 0);

I hope everything's clear now:)

Good luck
Stefan

theory37 July 15, 2010 10:30

directionMixed for symmTensor
 
Stefan,

Thank you for this concise explanation of directionMixed. I am having some difficulty understanding how this boundary condition might be applied to a symmetric tensor. I'd like to be able set certain components of the tensor to be zeroGradient in the normal direction (Y, in my case), while setting the rest of the components to be fixedValue. I've tried several different variations and searched the forums with little success.

Say I want the XY, YY, and YZ components of my symmTensor to have a fixedValue of 7, while the XX, XZ, and ZZ be zeroGradient. Supposing my tensor started as
Code:

[1 1 1    1 1    1]
for my entire domain. I first tried something like this:
Code:

   
    type            directionMixed;
    refValue        uniform ( 7 7 7  7 7  7 );
    refGradient    uniform ( 0 0 0  0 0  0 );
    valueFraction  uniform ( 0 1 0  1 1  0 );

This yields
Code:

[7 21 7    67 21    7]
when I would have expected
Code:

[1 7 1    7 7    1]
Obviously I am missing something here. I am also confused about why refValue has 6 components rather than just one - I want to set each individual tensor component to one value, not an entire tensor. I've tried several other variations with equally strange results.

Is this even possible to do in the current implementation of directionMixed?

Thank you in advance,

Mike

P.S. - I tried this with a vector and it worked brilliantly:
Code:

   
    type          directionMixed;
    refValue      uniform ( 7 7 7 );
    refGradient    uniform ( 0 0 0 );
    valueFraction  uniform ( 1 0 0 0 0 1 );

If my vector began as [1 1 1] (for the entire domain), this yielded the expected [7 1 7].

theory37 July 15, 2010 13:23

Answered my own question, sort of
 
After digging in to /src/OpenFOAM/primitives/transform/symmTransform.H I discovered that, when operating on a symmTensor, this boundary condition does the following:

For given symmTensors valueFraction, refValue, and refGradient along with the value of the symmTensorField at this patch ( this->patchInternalField(), which I'll call R for short ), directionMixed will return
Code:


  R(at the boundary patch) =
  [ valueFraction & refValue & valueFraction.T() ]
+ [ (I - valueFraction) & gradValue & (I - valueFraction).T() ]

with
Code:

gradValue = R(internalField) - refGradient / dx
with dx being the distance the gradient is calculated over, and of course T() being the transpose and & the inner product.

So, this explains the unexpected results above, but still leaves me wondering if it is possible to achieve the BC I need without writing my own. Any suggestions?

theory37 June 27, 2011 11:53

UPDATE: It turns out that it is not possible (to my knowledge) to achieve the desired BC using mixedDirection. I am now working on "groovifying" this BC to extend its functionality.

Mike


All times are GMT -4. The time now is 19:49.