CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Oscillating inlet BC (https://www.cfd-online.com/Forums/openfoam/98871-oscillating-inlet-bc.html)

November March 21, 2012 02:25

Oscillating inlet BC
 
Hello all:),

I am trying to set up a 3D case for an oscillatory flow past a circular cylinder. I'm wondering how would you specify the inlet and outlet BC for this easy case? It got me stuck here...
For the inlet boundary condition, I want to have Ui=Um*sin(2*pi*frequency*t), so i have set "patch" in /constant/boundary file for the inlet (for the top and bottom boundaries, which are perpendicular to the cylinder span, i have set "cyclic" BC for infinite length cylinder), and in /0/u file i have :
inlet
{
type oscillatingFixedValue;
refValue (0 0 0);
amplitude 1;
frequency 0.5;
}

For 0/p:
inlet
{
type calculated;
value uniform 0;
}

But when I run it, the following error msg appears:

--> FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField
on patch inlet of field p in file "/home/kyang/OpenFOAM/OpenFOAM-2.1.0/icoFoam-t/3DCylinder/0/p"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const
in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 186.

FOAM exiting

Seems like it is complaining that I didnt define p, but as I said, I did subscribe inlet BC for p in 0 folder! :confused::confused::confused:

I'm just wondering if any one has any ideas on what's the problem for this... or any suggestions on the setup for BC and initial condition for oscillatory flow past a circular cylinder would also be great!

Thanks a lot!

olivierG March 21, 2012 05:11

hello,

Why have you set to "cyclic" your boundary ?
oscillatingFixedValue work with patch type.
And for pressure, use outletInlet or zerogradient.

regards,
olivier

calim_cfd March 21, 2012 08:28

hi,

in the boundary fle you can have primitive BCS : cyclic(AMI),symmetryPlane, patch, wall

inlets and outlets are type "patch" in the boudary file

in the variable files you may set specific stuff like the one you did:
Code:

oscillatingFixedValue
when you use cyclic or symmetry you can only assign these types of bc in the variable files.
but the primitive bcs in the boundary file gotta be "patch"

check the user guide.. it has more to it :)

November March 21, 2012 20:27

Hi guys,

First really thank you for your reply!
Second sorry it was a typo,,, I didn't use cyclic in inlet and outlet, I did use patch, I have changed that typo in my post... sorry about the confusing...

then, my problem is, how would you specify the condition for initial p in 0/p after setting 0/u at inlet to be oscillatingfixedvalue? According to NS, once you have u=Um*sin(2*pi*f*t) then at inlet you ought to have partial(p)/partial(x)=-partial(u)/partial(t)=-Um*2*pi*f*cos(2*pi*f*t). Basically p should be calculated according to u... therefore I have set 0/p to be calculated at first, but then the error like I described in my post appeared...

And I tried to use zeroGradient, however i got all values of p and u at all timesteps to be 0 following that specification. Here's what I did:

In my input file for boundary:
inlet type is set to be patch

and then in 0/p,
inlet type is set to be zeroGradient;

in 0/u, if i want to specify U=Um*sin(2*pi*f*t),would the following be correct?
inlet
{
type oscillatingFixedValue;
refValue uniform (0 0 0); //steady current velocity, which is 0 in my case
//offset (0 -1 0);
amplitude constant 1; //Um
frequency constant 0.5; //f
//value uniform (0 0 0); //not sure what this is for?
}

Could you tell me my problem, really appreciated.

November March 21, 2012 20:46

Hello Oliver,

Thank you for your suggestion.
I tried outletInlet for 0/p at inlet as following:
inlet
{
type outletInlet;
outletValue 0;
value 0;
}
And I still got all 0 values for p and u at all timesteps....

I begin to wonder if I should specify inletOutlet at outlet for U and p too? In my current settings I just used zeroGradient for u at outlet and p=0 at outlet. This looks less scientific now... should I change it to inletOutlet then?


All times are GMT -4. The time now is 08:00.