CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [waves2Foam] A rectangular box heaving in calm water (https://www.cfd-online.com/Forums/openfoam-community-contributions/205421-rectangular-box-heaving-calm-water.html)

zhxter July 18, 2018 00:51

A rectangular box heaving in calm water
 
Dear waves2Foamers,

I am trying to run a case where a rectangular box is forced to heave (with a single frequency) in calm water.

I use openfoam 2.4.0. The forced motion of the box is realized by using the inherent boundary condition in openfoam - oscillatingDisplacement. The solver for dynamics mesh - "interDyMFoam" is adopted to perform the simulation.

In order to calculate the free surface elevation, I add the libarary "libwaves2FoamSampling.so" in the system/controlDict file.

Now the problem is described as follows,
(1) when I use one core to perform the simulation, I get the correct results for the radiated wave elevation whether or not adding the "libwaves2FoamSampling.so" in system/controlDict.

(2) when I use two or more than two cores to run the simulation in parallel, I get the correct results for radiated wave elevation if I did not add the "libwaves2FoamSampling.so" in system/controlDict.

(3) when I use two or more than two cores to run the simulation in parallel, I get the wrong results for radiated wave elevation if I add the "libwaves2FoamSampling.so" in system/controlDict.

It seems that when using interDyMFoam to run dynamic mesh cases in parallel (using more than one cores), adding the library from waves2Foam - i.e. libwaves2FoamSampling.so will affect the computation and lead to a wrong result. For the specific case, the boundary oscillatingDisplacement is used.

Did anyone have similar problems? or Could anyone give some suggestions on this problem?

The files for this case is attached.

Many thanks
Xiantao
The University of Western Australia

zhxter July 18, 2018 00:57

a rectangular box heaving in calm water- case files
 
The case files are listed as follows:

0/alpha.water
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;

/* type waveAlpha;
refValue uniform 0;
refGrad uniform 0;
valueFraction uniform 1;
value uniform 0;*/
}
bottom
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
vessel
{
type zeroGradient;
}
frontBack
{
type empty;
}
}


// ************************************************** *********************** //


0/P_rgh

FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
atmosphere
{
type totalPressure;
U U;
phi phi;
rho none;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
vessel
{
type zeroGradient;
}
frontBack
{
type empty;
}
}


// ************************************************** *********************** //

0/pointDisplacement

FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
location "0";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 0 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type uniformFixedValue;
uniformValue (0 0 0);
}

bottom
{
type uniformFixedValue;
uniformValue (0 0 0);
}

outlet
{
type uniformFixedValue;
uniformValue (0 0 0);
}

atmosphere
{
type uniformFixedValue;
uniformValue (0 0 0);
}

vessel
{
type oscillatingDisplacement;
amplitude (0 0.04 0);
omega 9.90448;
value uniform (0 0 0);
}

frontBack
{
type empty;
}
}


0/ U

FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform ( 0.0 0.0 0.0);

boundaryField
{
inlet
{
type fixedValue;
value uniform ( 0 0 0 );
/* type waveVelocity;
refValue uniform ( 0 0 0 );
refGradient uniform ( 0 0 0 );
valueFraction uniform 1;
value uniform ( 0 0 0 ); */
}
bottom
{
type fixedValue;
value uniform ( 0 0 0 );
}
outlet
{
type fixedValue;
value uniform ( 0 0 0 );
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform ( 0 0 0 );
}
vessel
{
type movingWallVelocity;
value uniform ( 0 0 0 );
}
frontBack
{
type empty;
}
}


// ************************************************** *********************** //


system/controlDict

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application interDyMFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 2;

deltaT 0.001;

writeControl adjustableRunTime;

writeInterval 0.04;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

adjustTimeStep yes;

maxCo 0.25;

maxAlphaCo 0.25;

maxDeltaT 1;

libs
(
"libwaves2FoamSampling.so"
);

functions
{
#includeIfPresent "../waveGaugesNProbes/surfaceElevationAnyName1_controlDict";
#includeIfPresent "../waveGaugesNProbes/surfaceElevationAnyName2_controlDict";
}
// ************************************************** *********************** //

ngj July 23, 2018 05:51

Hi Xiantao,

How do you define right and wrong results? I recall correcting something for moving meshes and surface elevation tool in earlier versions, but I cannot immediately see why results should be affected.

You could try to redo the simulations in a more recent version, e.g. 1712 or 1806. OpenFoam 2.4 is getting pretty old by now and many bugs are likely resolved and the functionObject library is completely reimplemented. Also, I am not cross-compiling waves2Foam on such old versions, so compatibility may be compromised in the future.

Kind regards

Niels

zhxter July 30, 2018 22:21

Hi Niels,

When I said wrong or correct results, I compared the CFD simulated radiated wave elevation with that calculated by linear potential flow method. For using one core, the results of wave elevation calculated using cfd and potential flow agreed with each other quite well. However, for using two or more cores, it was obvious that cfd gave a wrong result, both the amplitude and phase of the radiated wave being wrong (inconsistent with that by potential flow theory or cfd using one core).

I am trying to install the version 1712 to see if the problem has been solved.

Regards
Xiantao
The University of Western Australia

sharkilwo5 December 16, 2021 12:16

Did you also analyze the added mass and damping coefficients?

ngj December 17, 2021 14:49

Hi,


This reference might be interesting for you, when it comes to modelling of free decay and the avoidance of contamination from partially reflective boundaries:


https://www.researchgate.net/publica...ed_heave_decay


Kind regards


Niels


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