
[Sponsors] 
January 10, 2007, 01:12 
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: 11 
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 socalled 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> 

January 11, 2007, 11:11 
Hi,
thank you very much. Mo

#2 
New Member
Jan Marburger
Join Date: Mar 2009
Posts: 2
Rep Power: 0 
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 

January 12, 2007, 04:26 
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: 11 
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). normalIncidenceAcousticImpedance20070112.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 

January 12, 2007, 05:30 
Ok, I misunderstood a part of

#4 
New Member
Jan Marburger
Join Date: Mar 2009
Posts: 2
Rep Power: 0 
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 solvingtheory ( > weak formulation of the equations) Greetings, Jan 

January 15, 2007, 00:00 
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: 11 
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.: Timedomain impedance boundary conditions for computational aeroacoustics, AIAA Journal 345, pp. 917923, 1996. Thanks, Takuya 

Thread Tools  
Display Modes  


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 00:45 
How to set a boundary condition as a function respect to time  chnrdu  OpenFOAM Running, Solving & CFD  2  June 17, 2005 04:18 
Random function UDF for boundary condition  Chris  FLUENT  4  March 28, 2003 16:38 