- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Problem simulating wave propagation in a tube**
(*https://www.cfd-online.com/Forums/openfoam-solving/91206-problem-simulating-wave-propagation-tube.html*)

Problem simulating wave propagation in a tubeHi everyone,
I’m facing a problem solving the case of propagating sound waves in a tube using rhoPisoFoam (OF 1.7.0). The case is laminar, the BC's for U and p are as follows: U: internalField uniform (0 0 0); boundaryField { inlet { type groovyBC; value uniform (0 0 0); valueExpression "(20*sin(125640*time()))*vector(1,0,0)"; } channel { type fixedValue; value uniform (0 0 0); } frontAndBack { type empty; } outlet { type groovyBC; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "(phi > 0) ? 0 : 1"; value uniform (0 0 0); } } p: dimensions [1 -1 -2 0 0 0 0]; internalField uniform 101325; boundaryField { inlet { type waveTransmissive; value uniform 101325; field p; phi phi; rho rho; psi psi; gamma 1.4; fieldInf 101325; lInf 0; } channel { type zeroGradient; } frontAndBack { type empty; } outlet { type waveTransmissive; value uniform 101325; field p; phi phi; rho rho; psi psi; gamma 1.4; fieldInf 101325; lInf 0; } } I managed to get a converging solution and the results (frequency, amplitude) initially agree with the analytic solution. However, as the wave reaches the outlet (after 0.1 ms) the pressure level decreases considerably. While the pressure oscillates at ambient pressure in the beginning, it oscillates at 76.000 Pa after 1 ms and at 20.500 Pa after 5 ms. Besides that, the damping of the wave seems to be higher than it should. I've been struggling with this for a while now, so any help is much appreciated. Regards |

hi,
I'm not sure but I think trying this may help: U:inlet:groovy outlet: zeroGradient P:inlet:zeroGradient outlet:wavetransmitive and as a comment, with the frequency you used in groovy, very small timesteps should be used to run! and about wavetransmitive: I think linf=0 is somewhat equivalent to fixedvalue. linf is the distant from boundary faces to a virtual point having pressure specified as "value". so set outlet linf a large enough length depending scale of the case. I hope it helps, |

Hi Mohammad,
thank you for your reply. You are right about the time step. I'm running with a step size of 0.1e-6 s, so we're fine here. Regarding linf I can tell you that I’ve varied this length between 0 and 1000 and couldn’t determine any influence of linf on the solution at all. I also ran the BC-setup you suggested but unfortunately the result is (qualitatively) the same as observed before. In fact, I tried various combinations of BC's with no success and I begin to question the solver choice. Does anyone know if there is a more appropriate solver for my problem? Regards Claas |

hi claas,
I dont know the exact problem but I think changing schemes of grads, divergences and laplacians may help. limitedlinear is mostly more stable than other schemes in my experiences. yours... |

hey Mohammad,
sorry for the late reply, have been quite busy lately..... So, here’s my fvSchemes-file: ddtSchemes { default Euler; } gradSchemes { default Gauss linear; grad(p) Gauss linear; } divSchemes { default none; div(phi,U) Gauss limitedLinear 1; div(phid,p) Gauss limitedLinear 1; div(phiU,p) Gauss limitedLinear 1; div(phi,h) Gauss limitedLinear 1; div(phi,k) Gauss limitedLinear 1; div(phi,epsilon) Gauss limitedLinear 1; div(phi,R) Gauss limitedLinear 1; div(phi,omega) Gauss limitedLinear 1; div((rho*R)) Gauss limitedLinear 1; div(R) Gauss limitedLinear 1; div(U) Gauss limitedLinear 1; div((muEff*dev2(grad(U).T()))) Gauss linear; } laplacianSchemes { default none; laplacian(muEff,U) Gauss linear corrected; laplacian(mut,U) Gauss limitedLinear 1; laplacian(DkEff,k) Gauss limitedLinear 1; laplacian(DepsilonEff,epsilon) Gauss limitedLinear 1; laplacian(DREff,R) Gauss limitedLinear 1; laplacian(DomegaEff,omega) limitedLinear 1; laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian(alphaEff,h) Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } fluxRequired { default no; p ; } I played with the schemes as you advised, trying also upwind and OUICK schemes but it didn’t change much. regards Claas |

Hi Foamers,
after trying different BC configurations I found that the change in direction of flow seems to cause the above described pressure loss. When changing the applied wave from "(20*sin(125640*time()))*vector(1,0,0)" to "(1+1*sin(125640*time()))*vector(1,0,0)"; meaning a pulsating flow without changing flow direction, the results appear to be correct. Unfortunately I couldn’t find a BC configuration which works for my setup. So, if you have any ideas/knowledge about that, feel free to share… |

hi claas,
I have a basic question: if you want to model sound waves or something like that, why do you set wavy BC for U? not for p? sound waves and similar waves are pressure waves not velocity waves. I had solved incompressible flow in a pipe with fluctuating pressure gradient and the flow is some time in positive direction and in some time in negative direction. the answer of flow velocity profile in space and time was really good compared to analytical solution. so if setting wavy U inlet is not really your problem, change it to pressure. you can set pressure inlet as groovy and outlet as fixed value=0 . and U inlet and outlet both as zerogradient. yours, mohammad |

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