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/)
-   -   How to calculate liquid volume as the interface moves for interFoam Solver (https://www.cfd-online.com/Forums/openfoam-solving/58044-how-calculate-liquid-volume-interface-moves-interfoam-solver.html)

markc January 27, 2009 05:22

Hello All, New question: do
 
Hello All,

New question: does anyone know a code snippet to perform the following task in interFoam-like solvers:
- consider a basin with water (and air) with a floating body in it. Now I want to calculate the area of the waterline of the floating body. In other words: the area of the hole in the interface which is made by the floating object.
I am considering something like: the still surface is oriented along the X-Y plane. Then sum over all faces of the body patch. If gamma at a face is between 0 and 1, take Y value and multiply with projected cell length in X direction. Repeat for all patch faces.
However I think this won't work because with this formulation the interface is not very sharp.
Any better ideas?

Thanks in advance and best regards,

Mark

ngj January 27, 2009 07:08

Hi Mark This is coming from
 
Hi Mark

This is coming from the top of my head, so it is written in pseudo-code, where all values are referring to the hull-patch:

missingArea = - gammaPatch * (patch.Sf() & vector(0,0,1));

The thing is, that taking the vertical projection of all faces on the patch should do the trick. If you have a bulb, then the direction of Sf() should remove the opposite contributions. Of course this is assuming that your floating body is not leaking, i.e. having a hole below the water line.

Funny little question, it kept bouncing in my head untill I came up with an ideahttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif

Best regards,

Niels

ngj January 27, 2009 07:35

N.B.: As long as the water sur
 
N.B.: As long as the water surface is horizontal this will give something which is correct, but as soon you start getting undulations it will be incorrect, but of course it depends on the physical environment (size of undulations), and to what degree you can accept inaccurate estimates of the area, and the slope of the hull at the interface, as it will not affect the result as long as the hull is vertical.

/Niels

ngj January 27, 2009 12:47

Hi Mark Please read my NB c
 
Hi Mark

Please read my NB carefully, as I write

"As long as the water surface is horizontal this will give something which is correct".

The trouble arises when you are have, say waves along the side of the ship, and you have to define some average horizontal intersection. Then this procedure might not give the correct result. But as long as the water surface is _horizontal_ then the result must be correct.

But it looks reasonable what you are doing, and without giving to too many thoughts your approachs seems to give the average horizontal intersection irrespectively of the sea state.

Best regards,

Niels

markc January 28, 2009 02:53

Niels, you are right: you ment
 
Niels, you are right: you mentioned the issue yourself already.

Brgds,

Mark

chiven October 21, 2009 04:34

Is it too late to ask some questions about interFoam revision?

I am trying to revise the incompressibleTwoPhaseMixture codes for interFoam solver.
I want to put the rho1 (dimensionedScalar) to rho3 (volScalarField), the code is shown in
Code:

    rho3_
    (
        IOobject
        (
            "rho3",
            U_.time().timeName(),
            U_.db(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        U_.mesh(),
        rho1_
    ),
    alpha1_(U_.db().lookupObject<const volScalarField> (alpha1Name)),
    nu_
    (
        IOobject
        (
            "nu",
            U_.time().timeName(),
            U_.db()
        ),
        U_.mesh(),
        dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
        calculatedFvPatchScalarField::typeName
    )                                                                                ------line137
{
    calcNu();
}

However, errors occur when compiling the codes.
HTML Code:

incompressibleTwoPhaseMixture/twoPhaseMixture.C:137: error: member initializer expression list treated as compound expression
incompressibleTwoPhaseMixture/twoPhaseMixture.C:137: error: invalid initialization of reference of type 'const Foam::volScalarField&' from expression of type 'Foam::dimensionedScalar'
make: *** [Make/linuxIA64GccDPOpt/twoPhaseMixture.o] Error 1

When I delete the part of rho3, it is OK.

Thank you very much.
chiven


All times are GMT -4. The time now is 20:23.