CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Boundary Function

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2007, 01:12
Default Hi, I've also been struggling
  #1
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi,
I've also been struggling these days in writing my first solver for basic linear acoustic wave propagation problems using OpenFOAM and just now I could make its very preliminary version to work. Since this is an acoustic solver this includes so-called normal incidence acoustic impedance b. c. which is represented in exactly the same form as yours, p = z * Un where z is a scalar constant called normal incidence acoustic impedance and Un is outward normal component of U to the patch.

I post the essential parts of the boundary condition code and boundary condition dictionaries in hope that they might be of some help to your problem and that someone points me out if I'm doing something wrong.

While the code updates U by U = p / z * n and sets p to zeroGradient, you can do the reverse i. e. p = z * (U • n) and setting U to zeroGradient. But actually I can't understand why setting the other variable to zeroGradient works. I'm very interested if someone kindly offer any suggestions.

Thanks,
Takuya

normalIncidenceAcousticImpedanceFvPatchVectorField .C:
<pre>void normalIncidenceAcousticImpedanceFvPatchVectorField ::updateCoeffs()
{
if (updated())
{
return;
}

const fvPatchField<scalar>& pp =
lookupPatchField<volscalarfield,>("p");
const vectorField& n = patch().nf();
operator==(pp / z_ * n);

fixedValueFvPatchVectorField::updateCoeffs();
}</pre>
normalIncidenceAcousticImpedanceFvPatchVectorField .H:
<pre>class normalIncidenceAcousticImpedanceFvPatchVectorField
: public fixedValueFvPatchVectorField
{
// Normal incidence acoustic impedance
scalarField z_;
public:
TypeName("normalIncidenceAcousticImpedance");
......
};</pre>
0/U:
<pre>boundaryField
{
outlet
{
type normalIncidenceAcousticImpedance;
z uniform 414.16;
value uniform (0 0 0);
}
}</pre>
0/p:
<pre>boundaryField
{
outlet
{
type zeroGradient;
}
}</pre>
7islands is offline   Reply With Quote

Old   January 11, 2007, 11:11
Default Hi, thank you very much. Mo
  #2
jan
New Member
 
Jan Marburger
Join Date: Mar 2009
Posts: 2
Rep Power: 0
jan is on a distinguished road
Hi,

thank you very much. More or less exactly what I need
Unfortunately, I get a linking error for the TypeName(".."); command. Do I have to include / define something special? The compling works fine.
Do you have any reference for programming own boundary conditions? I don't really understand the structure for that in OpenFOAM and the implemented boundary codes (fixedValue etc.) are a bit too confusing to me ;)

Thanks,
Jan
jan is offline   Reply With Quote

Old   January 12, 2007, 04:26
Default Hi, It's because I posted onl
  #3
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi,
It's because I posted only essential parts, not all of the code thinking that posting all the code might be too lengthy.

Here's the full code of the b.c. It also includes the reverse updating (p = z * (U & n)). Usage is as I mentioned above (specify "uniform 0" instead of "uniform (0 0 0)" if you want to update p).

normalIncidenceAcousticImpedance-20070112.tar.gz

All and only references I used for the b. c. programming were codes under $FOAM_SRC/finiteVolume/fields/fvPatchFields/derivedFvPatchFields , especially the pressureInletVelocity and the totalPressure codes. So please point me out if anyone notice I'm doing something wrong.

And again, I'll appreciate if anyone have suggestions why setting the other variable to zeroGradient works...

Thanks,
Takuya
7islands is offline   Reply With Quote

Old   January 12, 2007, 05:30
Default Ok, I misunderstood a part of
  #4
jan
New Member
 
Jan Marburger
Join Date: Mar 2009
Posts: 2
Rep Power: 0
jan is on a distinguished road
Ok, I misunderstood a part of the C structure. Now, with your example, it's much clearer to me. Thank you very much.

Too your question regarding the zeroGradient: I'm not sure, but maybe it is a reasonable b.c. since it is the "natural" b.c. for your problem in solving-theory ( -> weak formulation of the equations)

Greetings,
Jan
jan is offline   Reply With Quote

Old   January 15, 2007, 00:00
Default Natural b.c.: thanks - I've mi
  #5
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Natural b.c.: thanks - I've missed that point of view because I've been so occupied in programming. In finite difference discretization I've had good results by coupling U = p / z * n and the momentum equation [1], but in finite volumes (weak formulation) that kind of formulation seems too difficult for me. Anyway the code above is giving "reasonable" results so I'll go this way for the time being.

[1]: C. K. W. Tam et al.: Time-domain impedance boundary conditions for computational aeroacoustics, AIAA Journal 34-5, pp. 917-923, 1996.

Thanks,
Takuya
7islands is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to apply a function as boundary condition coompressor OpenFOAM Running, Solving & CFD 9 February 12, 2009 11:22
How to apply a function as boundary condition coompressor OpenFOAM Running, Solving & CFD 0 January 13, 2009 04:50
Function evaluatiion on boundary in Newton method Winston Main CFD Forum 0 July 18, 2005 01:45
How to set a boundary condition as a function respect to time chnrdu OpenFOAM Running, Solving & CFD 2 June 17, 2005 05:18
Random function UDF for boundary condition Chris FLUENT 4 March 28, 2003 16:38


All times are GMT -4. The time now is 21:55.