CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   BC waveTransmissive in sonicLiquidFoam (https://www.cfd-online.com/Forums/openfoam-solving/176397-bc-wavetransmissive-sonicliquidfoam.html)

philferdinand August 17, 2016 10:58

BC waveTransmissive in sonicLiquidFoam
 
1 Attachment(s)
Dear FOAMers,

My goal is to simulate a pressure wave (water hammer) on a guide vane in a stream channel (to eventually calculate the lift and drag forces on that guide vane). I have little to no experience with compressible solvers but sonicLiquidFoam (OF V3.0.0) seemed like the right choice given that the tutorial deals with a water hammer and that it is actually suitable for water as a fluid.

So my idea is to simulate the flow around the guide vane with a given velocity (to know the lift and drag in normal operation) and then at one point to increase the inlet pressure at the inlet to simulate the arriving pressure wave.

The problem is that I can not get a steady state flow around the turbine blade since the initial pressure field that builds up around the blade creates a pressure wave which oscillates in the channel and can't exit on any of the boundaries (neither inletOutlet nor zeroGradient for the outlet let the pressure exit).

I would like the pressure waves to exit through In- and Outlet without reflecting and found the waveTransmissive boundary condition. Anyhow this BC does not seem applicable in sonicLiquidFoam, since there is no psi field written.

This here (http://www.cfd-online.com/Forums/ope...oam-crash.html) gave me the idea that I could add a psi field to the setFields.C, since psi is actually set in the thermodynamicProperties, but it doesn't seem to be that easy.

Does one of you have an idea how to:

a) how to implement the waveTransmissive BC in sonicLiquidFoam OR
b) what other BC would let the pressure waves pass OR
c) which other solver would be better suited for the problem

I thank you very much for your help and hope that I have formulated my question adequately :)

Attachment 49929

fjimenez June 7, 2018 19:48

Hi Philipp,

I know this thread is a little bit old but I was wondering if you managed to find a solution to your problem since I am facing a similiar one.

Cheers

anil.istanbullu September 25, 2018 08:33

Quote:

Originally Posted by fjimenez (Post 695138)
Hi Philipp,

I know this thread is a little bit old but I was wondering if you managed to find a solution to your problem since I am facing a similiar one.

Cheers

Is there any suggestion for such case (water hammer)?

J.H.59 October 26, 2018 03:07

You could try to use "acousticDampingSource" to damp everything outside of your physical domain. The problem is that you need fvOption to do that which isn't considered in "sonicLiqidFoam".

What I did was to compare a solver which has fvOption (e.g. rhoPimpleFoam) and the sonicLiquidFoam code and to change the code so that I can use fvOption.
After that I'm able to use "acousticDampingSource" and it works fine as far as I can tell.


Another option is to change the code of "sonicLiquidFoam" so that you can use the "waveTransmissive" BC. I was able to do that but the reflected part is still higher than in other solvers (again e.g. rhoPimpleFoam), so I'm not sure if this is enough for you or even right.
The problem in "sonicLiquidFoam" is that it can't use psi in the BC even though it is read in. I just created a new field in "createFields.H" like


Code:

volScalarField psi0
(
    IOobject
    (
        "psi0",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);

You then have to include "psi0" as a file in the "0" folder like


Code:

dimensions      [0 -2 2 0 0 0 0];

internalField  uniform 7.345441265e-06;

boundaryField
{
    ".*"
    {
        type            zeroGradient;
    }

}

so that psi is constant everywhere. Then you can use this value in "waveTransmissive" with psi0.
Like I said I'm not 100% sure that this works like it should but I can simulate my case with this.


I hope this helps somehow


Best regards
Johannes

xevious December 2, 2018 09:50

Hey J.H.59,


Can you please elaborate more on the "acousticDampeningSource" method? I am currently trying to use waveTransmissive Bc in rhoPimpleFoam, and i keep getting reflections that destroy my solutions. I would like to try the fvOptions method you used, if you could share that with me.


Thanks

J.H.59 December 3, 2018 04:51

Hi Sam,


it depends on your problem which one you should use. If you have a simple periodic inlet wave and a big enough domain you should have no problems with waveTransmissive. But the reflection strongly depends on the chose of lInf! This value needs to be far enough from the boundary. In my experience this can be some wavelength. You should also considerthat this results in non physical solutions near the boundary.

If you have a domain which is only some wavelength big this can be more complicated. There you could choose a combination of both methods.
The fvOptions file can look like:

Code:

acousticDampingSource
{
    type            acousticDampingSource;
    active          yes;
 
    acousticDampingSourceCoeffs
    {
        timeStart        1e-10;
        duration        1000.0;
        selectionMode    all;
        centre          (-2.5e-4 0 0);
        radius1          3e-4;
        radius2          4e-4;
        frequency        1e+07;
        w                3;
        URef            UMean;
    }
}

This creates two spheres around the centre with the radius radius1 and radius2 where till the first one nothing is damped, from the first to the second one the damping is increasing and after the second one the damping is reaching his maximum which is chosen by "w". What is nice is that the two spheres doesn't have to be completely in the domain.
Another thing you need is to calculate UMean every timestep. To do this you need to add the lines in controlDict:
Code:

    fieldAverage
    {
        type            fieldAverage;
        libs            ("libfieldFunctionObjects.so");
        writeControl    writeTime;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }


        );
    }

My problem with this method is that you need to activate it after one timestep (that is why timeStart is not zero) because this method needs a UMean value to work. And in the 0 folder you don't have this. If you want to start the solver after some time again you need to update the timeStart to latestTime + deltaT.
At least I did not find a better solution.
Another thing to have in mind is that by a too strong damping you also get reflections. So you have to damp the flow slowly over some way like you can see in the documentation
https://www.openfoam.com/documentati...c-damping.html
where it is damped over some periods.
I hope this helps you to solve your problem. If you have some more questions feel free to ask.

Best regards
Johannes


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