CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Ramping velocity inlet for ship simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By antoineh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2024, 08:58
Post Ramping velocity inlet for ship simulation
  #1
New Member
 
Antoine Haton
Join Date: Feb 2024
Location: Bordeaux, France
Posts: 4
Rep Power: 2
antoineh is on a distinguished road
Hi Foamers,

I'm facing a problem to use a ramp as a velocity inlet for a simulation based on the tutorial DTCHull that is not using it in the v11 of Openfoam I am working on. This could improve my simulations' time of calculation as for now are working but take quite a long time.

I tried to refer to these two pervious posts before asking:
Trying to apply linearRamp for flow velocity in DTCHull
Unsteady ramp inlet velocity
that were quite recent, but I could not figure out my problem as it is a bit different.

To add the ramping condition, I tried the same way a developper discribed it (here: https://github.com/OpenFOAM/OpenFOAM...b9f829e4ec3ec4) meaning I changed my inlet and outlet BC in 0/U.orig as you will see lower on this post, and added a fvModels file (I think in the 11th version of Openfoam it is called like that instead of fvOptions) in the constant/ directory.

But, when I start my solver I have this error written (with the previous U.orig used I had no problems my simulation was launched directly):

Code:
Pstream initialised with:
    floatTransfer      : false
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Selecting fvMeshMover motionSolver
Selecting motion solver: rigidBodyMotion
[86] --> FOAM FATAL ERROR: 
[86] cannot find file "processor86/0/pointDisplacement"
From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
[86]     in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 539.
[86] 
FOAM parallel run exiting

This is the beginnng of the error message, the end is exactly the same but repeated for all numbers of processors used in parallel.

I think Openfoam does not really understand the BC I want to put and this might be because of a version issue compared to the developper's reference I used, but I have nothing else to compare to or to use as a tutorial to make this work.

If anyone has already faced this kind of problem or would have an idea about it I would be grateful!

Here are the files of interest:

U.orig with ramping velocity inlet:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  11
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

UMean 1.02889; // 2 kt

// UMean 3.08667; // 6 kt

// UMean 5.14444; // 10 kt

duration = 2.0;

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

internalField   uniform (#neg $UMean 0 0);

boundaryField
{
    //- Set patchGroups for constraint patches
    #includeEtc "caseDicts/setConstraintTypes"

    inlet
    {
        type            fixedValue;
        value           $internalField;
    }

    outlet
    {
        type            outletPhaseMeanVelocity;
        alpha           alpha.water;
        value           $internalField;
        UnMean          
		{
			value		$UMean;
			type		scale;
			scale
			{
				type		quarterSineRamp;
				start		0;
				duration	$duration;
			}
		}
    }

    atmosphere
    {
        type            pressureInletOutletVelocity;
        tangentialVelocity $internalField;
        value           uniform (0 0 0);
    }

    hull
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    rudder
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    keel
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    shaft
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }
}


// ************************************************************************* //
Former U.orig that works:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  11
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

UMean 1.02889; // 2 kt

// UMean 3.08667; // 6 kt

// UMean 5.14444; // 10 kt

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

internalField   uniform (#neg $UMean 0 0);

boundaryField
{
    //- Set patchGroups for constraint patches
    #includeEtc "caseDicts/setConstraintTypes"

    inlet
    {
        type            fixedValue;
        value           $internalField;
    }

    outlet
    {
        type            outletPhaseMeanVelocity;
        alpha           alpha.water;
        UnMean          $UMean;
        value           $internalField;
    }

    atmosphere
    {
        type            pressureInletOutletVelocity;
        tangentialVelocity $internalField;
        value           uniform (0 0 0);
    }

    hull
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    rudder
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    keel
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }

    shaft
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }
}


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

pointDisplacement.orig:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  11
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       pointVectorField;
    location    "0";
    object      pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 0 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    //- Set patchGroups for constraint patches
    #includeEtc "caseDicts/setConstraintTypes"

    inlet
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    outlet
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    atmosphere
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    hull
    {
        type            calculated;
    }

    rudder
    {
        type            calculated;
    }

    keel
    {
        type            calculated;
    }

    shaft
    {
        type            calculated;
    }
}


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


fvModels:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include	"../0/U.orig";

elocityRamping
    {
        type        velocityRamping;
        active      on;
        selectionMode all;
        U           U;
        velocity    (#neg $UMean 0 0);
        ramp
        {
            type        quarterSineRamp;
            start       0;
            duration    $duration;
        }
    }
antoineh is offline   Reply With Quote

Old   April 4, 2024, 04:50
Default
  #2
New Member
 
Antoine Haton
Join Date: Feb 2024
Location: Bordeaux, France
Posts: 4
Rep Power: 2
antoineh is on a distinguished road
Hello there,

I have made progress with my issues. The main problem was unclear declaration of ramping inlet and outlet in 0/0.orig and fvModels in constant/. The error appeared in log.decomposePar at the end, not in log.foamRun. I should have checked all my logs thoroughly.

I have attached corrected versions of U.orig and fvModels files to this message.

However, I am still encountering an issue. Despite using the same expressions to describe a ramp as another thread using OF V7 (Inconsistent behaviour of function object "scale"), I'm on V11 and believe there are no differences in declaring ramping conditions.

My simulation initiates, but after one iteration, I encounter the following error:

Code:
Pstream initialised with:
    floatTransfer      : false
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Selecting fvMeshMover motionSolver
Selecting motion solver: rigidBodyMotion
Selecting rigidBodySolver Newmark
Selecting solver incompressibleVoF
Selecting viscosity model constant
Selecting viscosity model constant
No MRF models present

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
RAS
{
    model           kOmegaSST;
    turbulence      on;
    printCoeffs     on;
    alphaK1         0.85;
    alphaK2         1;
    alphaOmega1     0.5;
    alphaOmega2     0.856;
    gamma1          0.555556;
    gamma2          0.44;
    beta1           0.075;
    beta2           0.0828;
    betaStar        0.09;
    a1              0.31;
    b1              1;
    c1              10;
    F3              false;
}

GAMG:  Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
Creating fvModels from "constant/fvModels"

Selecting finite volume model type accelerationSource
    Name: accelerationSource1
    - selecting all cells
    - selected 3521430 cell(s) with volume 15096.6

PIMPLE: No convergence criteria found


PIMPLE: No corrector convergence criteria found
        Calculations will do 3 corrections


PIMPLE: Operating solver in transient mode with 3 outer correctors


forces forces_total:
    Not including porosity effects
forces forces_rudder:
    Not including porosity effects
forces forces_keel:
    Not including porosity effects

Starting time loop

forces forces_total write:
    sum of forces:
        pressure : (-0.0136678 4046.13 5846.9)
        viscous  : (0 0 0)
        porous   : (0 0 0)
    sum of moments:
        pressure : (-694.144 -131.242 821.948)
        viscous  : (0 0 0)
        porous   : (0 0 0)

forces forces_rudder write:
    sum of forces:
        pressure : (0.397721 493.921 18.9689)
        viscous  : (0 0 0)
        porous   : (0 0 0)
    sum of moments:
        pressure : (169.498 52.1376 -1354.77)
        viscous  : (0 0 0)
        porous   : (0 0 0)

forces forces_keel write:
    sum of forces:
        pressure : (1.05095 13.3691 173.197)
        viscous  : (0 0 0)
        porous   : (0 0 0)
    sum of moments:
        pressure : (-41.7689 -23.4386 3.75107)
        viscous  : (0 0 0)
        porous   : (0 0 0)

Constructing face momentum Uf
[83] #0  [84] #0  [85] #0  [86] #0  [87] #0  [88] #0  [89] #0  Foam::error::printStack(Foam::Ostream&)[92] #0  [5] #0  [17] #0  [19] [24] #0  Foam::error::printStack(Foam::Ostream&)[25] #0  [36] #0  [37] #0  Foam::error::printStack(Foam::Ostream&)[38] #0  [44] #0  [46] #0  [49] #0  Foam::error::printStack(Foam::Ostream&)[50] #0  Foam::error::printStack(Foam::Ostream&)[52] #0  [58] #0  [60] #0  Foam::error::printStack(Foam::Ostream&)[62] #0  Foam::error::printStack(Foam::Ostream&)[63] #0  [65] #0  [66] #0  [67] #0  [68] #0  Foam::error::printStack(Foam::Ostream&)[71] #0  [72] #0  [73] #0  Foam::error::printStack(Foam::Ostream&)[74] #0  [75] #0  Foam::error::printStack(Foam::Ostream&)[78] #0  Foam::error::printStack(Foam::Ostream&)[79] #0  Foam::error::printStack(Foam::Ostream&)[80] #0  Foam::error::printStack(Foam::Ostream&)[6] #0  Foam::error::printStack(Foam::Ostream&)[7] #0  Foam::error::printStack(Foam::Ostream&)[8] #0  Foam::error::printStack(Foam::Ostream&)[9] #0  Foam::error::printStack(Foam::Ostream&)[10] #0  Foam::error::printStack(Foam::Ostream&)[11] #0  Foam::error::printStack(Foam::Ostream&)[12] #0  Foam::error::printStack(Foam::Ostream&)[14] #0  Foam::error::printStack(Foam::Ostream&)[15] #0  Foam::error::printStack(Foam::Ostream&)[16] #0  Foam::error::printStack(Foam::Ostream&)[18] #0  Foam::error::printStack(Foam::Ostream&)[20] #0  Foam::error::printStack(Foam::Ostream&)[21] #0  Foam::error::printStack(Foam::Ostream&)[22] #0  Foam::error::printStack(Foam::Ostream&)[23] #0  Foam::error::printStack(Foam::Ostream&)[26] #0  Foam::error::printStack(Foam::Ostream&)[27] #0  [28] #0  Foam::error::printStack(Foam::Ostream&)[29] #0  Foam::error::printStack(Foam::Ostream&)[30] #0  Foam::error::printStack(Foam::Ostream&)[31] #0  Foam::error::printStack(Foam::Ostream&)[32] #0  Foam::error::printStack(Foam::Ostream&)[33] #0  Foam::error::printStack(Foam::Ostream&)[34] #0  Foam::error::printStack(Foam::Ostream&)[35] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[40] #0  Foam::error::printStack(Foam::Ostream&)[41] #0  Foam::error::printStack(Foam::Ostream&)[42] #0  Foam::error::printStack(Foam::Ostream&)[43] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[45] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[47] #0  Foam::error::printStack(Foam::Ostream&)[48] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[51] #0  Foam::error::printStack(Foam::Ostream&)[53] #0  Foam::error::printStack(Foam::Ostream&)[54] #0  Foam::error::printStack(Foam::Ostream&)[55] #0  Foam::error::printStack(Foam::Ostream&)[56] #0  Foam::error::printStack(Foam::Ostream&)[57] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[59] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[61] #0  Foam::error::printStack(Foam::Ostream&)[64] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[69] #0  Foam::error::printStack(Foam::Ostream&)[70] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[76] #0  Foam::error::printStack(Foam::Ostream&)[77] #0  Foam::error::printStack(Foam::Ostream&)[81] #0  Foam::error::printStack(Foam::Ostream&)[82] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[90] #0  Foam::error::printStack(Foam::Ostream&)[91] #0  Foam::error::printStack(Foam::Ostream&)[93] #0  Foam::error::printStack(Foam::Ostream&)[0] #0  Foam::error::printStack(Foam::Ostream&)[1] #0  Foam::error::printStack(Foam::Ostream&)[2] #0  Foam::error::printStack(Foam::Ostream&)[3] #0  Foam::error::printStack(Foam::Ostream&)[4] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[39] #0  Foam::error::printStack(Foam::Ostream&)[13] #0  Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)#0  Foam::error::printStack(Foam::Ostream&) at ??:?
[33] #1  Foam::sigFpe::sigHandler(int) at ??:?
[0] #1  Foam::sigFpe::sigHandler(int) at ??:?
[26] #1  Foam::sigFpe::sigHandler(int) at ??:?
 at ??:?
 at ??:?
[73] #1  Foam::sigFpe::sigHandler(int)[89] #1  Foam::sigFpe::sigHandler(int) at ??:?
[69] #1  Foam::sigFpe::sigHandler(int) at ??:?
[82] #1  Foam::sigFpe::sigHandler(int)[14] #1  Foam::sigFpe::sigHandler(int) at ??:?
[4] #1  Foam::sigFpe::sigHandler(int) at ??:?
 at ??:?
[15] #1  Foam::sigFpe::sigHandler(int) at ??:?
[90] #1  Foam::sigFpe::sigHandler(int)[80] #1  Foam::sigFpe::sigHandler(int) at ??:?
 at ??:?
 at ??:?
 at ??:?
 at ??:?
[48] #1  Foam::sigFpe::sigHandler(int) at ??:?
[44] #1  Foam::sigFpe::sigHandler(int)[91] #1  Foam::sigFpe::sigHandler(int)[66] #1  Foam::sigFpe::sigHandler(int) at ??:?
[93] #1  Foam::sigFpe::sigHandler(int)[20] #1  Foam::sigFpe::sigHandler(int)[51] #1  Foam::sigFpe::sigHandler(int) at ??:?
 at ??:?
 at ??:?
 at ??:?
 at ??:?
 at ??:?
[34] #1  Foam::sigFpe::sigHandler(int)[75] #1  Foam::sigFpe::sigHandler(int)[8] #1  Foam::sigFpe::sigHandler(int)[54] #1  Foam::sigFpe::sigHandler(int)[37] #1  Foam::sigFpe::sigHandler(int)[49] #1  Foam::sigFpe::sigHandler(int) at ??:?
[13] #1  Foam::sigFpe::sigHandler(int) at ??:?
[32] #1  Foam::sigFpe::sigHandler(int) at ??:?
Any help would be greatly appreciated.

Thank you,
Antoine

P.S. I apologize for the previous lengthy post, it was my first one. I'll aim to keep my messages concise in the future.



U.orig_fvModels.zip
antoineh is offline   Reply With Quote

Old   April 8, 2024, 10:33
Default
  #3
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Hi Antoine,


try with a very small neg. start value for your ramp, e.g. -0.00001, so you have a small velocity at time=0 s. Not sure, but I think the error you get is due to some division by zero due to zero velocity.



Best, Jan
JNSN is offline   Reply With Quote

Old   April 9, 2024, 10:49
Default
  #4
New Member
 
Antoine Haton
Join Date: Feb 2024
Location: Bordeaux, France
Posts: 4
Rep Power: 2
antoineh is on a distinguished road
Hello Jan,

Thanks a lot for your advice, it worked! I set a very low value as internalfield for time=0 and then it started well. The simulation now converges very smoothly with the ramping inlet compared to the case without it.

Regards,
Antoine
antoineh is offline   Reply With Quote

Old   April 9, 2024, 12:00
Default
  #5
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Good to hear that your simulation runs fine now. Yes, the ramping is quite beneficial in most cases.
JNSN is offline   Reply With Quote

Old   June 26, 2024, 15:21
Default
  #6
jbo
New Member
 
Join Date: Jun 2024
Posts: 5
Rep Power: 2
jbo is on a distinguished road
Hi Antoine
I was exploring the possibility of implementing velocity ramping for DTCHull too when I came across your thread. Nice to see it is doable.
Would it be possible for you to post a .zip or your last working setup?
This would be a great resource for many foamers!
Looking forward to hearing from you.
jbo is offline   Reply With Quote

Old   July 5, 2024, 05:44
Default
  #7
New Member
 
Antoine Haton
Join Date: Feb 2024
Location: Bordeaux, France
Posts: 4
Rep Power: 2
antoineh is on a distinguished road
Hi jbo,

Sorry for the late reply, I should have specified this at the end of the thread I posted, but I struggled quite a lot at the end with the ramping thing.

I thought it was working but it was generating little waves as you can see on the video in the .zip I am sending this message with, and so it brought instabilities to my simulations. In the end, it was not that benefical for the study I was doing, which was on a displacement hull (low speeds).

Now I am studying planning hulls and a good ramping inlet velocity would really help me as it is harder to make it converge due to the high speeds and refined mesh required.

If you or anyone else knows how to get rid of these little waves generated with the ramping velocity I would be delighted.

You will find in the .zip:
- fvModels : to generate ramping velocity
- U.orig : used with fvModels to generate ramping velocity
- screencaptures of the small waves generated in the inlet (the video was too heavy)
- a picture of non-convergence for the values of interest (hull behaviour and drag forces).

Cheers,
Antoine

PS : I am using OF11.

Capture1.jpg

Capture2.jpg

ramping.zip
jbo likes this.
antoineh is offline   Reply With Quote

Reply

Tags
ramping inlet ship


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specifying a prescribed velocity inlet SadBoySquad OpenFOAM 20 February 9, 2022 07:40
Pressure Inlet VS velocity Inlet difference Mohsin FLUENT 9 January 4, 2021 11:34
Simulation of radial gas turbine, Inlet velocity components dmaz CFX 17 May 19, 2019 10:45
How to set unsteady turbulent inlet velocity using the result of another simulation? John-Lee FLUENT 2 December 27, 2016 18:36
Velocity inlet boundary condition for porous medium Chander CFX 3 March 11, 2012 22:18


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