CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[waves2Foam] Add user defined gauges in waveFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2016, 23:39
Default Add user defined gauges in waveFoam
  #1
Member
 
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10
Lewis Liang is on a distinguished road
Hi Niels,
Thanks for making this amazing toolbox for generating wave. Currently I' m studying on how to generate wave by OpenFOAM with waves2Foam. My goal is to build a pipeline along the seabed, which both are built in OpenFOAM model. As my first step is to make sure that the wave model is accurate enough before moving the next step. So, I'm working on setting up several wave gauges along the numerical water tank. The waveFlume is given as a good example for me, and 179 wave gauges are linearly distributed along the XZ plane. However, as for the given waveFlume tutorial case, I want to only set up three water gauges along the water tank by using user definition in constant/probeDefinitions file, which is given as below:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.5                                   |
|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      loggingProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceElevationAnyName
{
    type waveGauge;

    pointDistribution userDefinedDistribution;
    N 3;
    xValues nonuniform List 
       (
         2.5 
         5.0 
         9.0
       );
    yValues nonuniform List 
       (-0.3 
        -0.3 
        -0.3
       );
    zValues nonuniform List 
       (0.05 
        0.05 
        0.05 
       );
    add       ( 0 0.45 0);
    axis      y;
}


// ************************************************************************* //
And I kept the input files of blockMesh and waveProperties unchanged, just set three wave gauges in the middle of inlet relation zone, end of the inlet relation zone and the middle of computational domain, respectively. Unluckily, when I executed the ./Allrun script in my terminal, the waveGaugesNProbes folder is empty while the results of each time step is still output correctly, which means that the program was still working except the waveGaugesNProbes utility. So, I look into the log.waveGaugesNProbes file, it reported as below,

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.4.0-f0842aea0e77
Exec   : waveGaugesNProbes
Date   : Aug 12 2016
Time   : 08:19:47
Host   : "zuodong-Vostro-3350"
PID    : 3393
Case   : /home/zuodong/waves2Foam/tutorials/waveFoam/waveFlume_2
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

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

Create mesh for time = 0

// using new solver syntax:
pcorr
{
    solver          GAMG;
    tolerance       1e-07;
    relTol          0;
    smoother        DIC;
    nPreSweeps      0;
    nPostSweeps     2;
    nFinestSweeps   2;
    cacheAgglomeration true;
    nCellsInCoarsestLevel 10;
    agglomerator    faceAreaPair;
    mergeLevels     1;
}

// using new solver syntax:
p_rgh
{
    solver          GAMG;
    tolerance       1e-07;
    relTol          0;
    smoother        DIC;
    nPreSweeps      0;
    nPostSweeps     2;
    nFinestSweeps   2;
    cacheAgglomeration true;
    nCellsInCoarsestLevel 10;
    agglomerator    faceAreaPair;
    mergeLevels     1;
}

// using new solver syntax:
p_rghFinal
{
    solver          GAMG;
    tolerance       1e-08;
    relTol          0;
    smoother        DIC;
    nPreSweeps      0;
    nPostSweeps     2;
    nFinestSweeps   2;
    cacheAgglomeration true;
    nCellsInCoarsestLevel 10;
    agglomerator    faceAreaPair;
    mergeLevels     1;
}

// using new solver syntax:
U
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-09;
    relTol          0;
}

// using new solver syntax:
UFinal
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-09;
    relTol          0;
}

// using new solver syntax:
gamma
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-07;
    relTol          0;
}


Reading g



--> FOAM FATAL IO ERROR: 
incorrect first token, expected <int> or '(', found on line 23 the word 'List'

file: /home/zuodong/waves2Foam/tutorials/waveFoam/waveFlume_2/constant/probeDefinitions.surfaceElevationAnyName.xValues at line 23.

    From function operator>>(Istream&, List<T>&)
    in file lnInclude/ListIO.C at line 149.

FOAM exiting
I wonder that this error whether is caused by the wrong input format in constant/probeDefinitions? or not? Otherwise it does't make sense that there is no result in waveGaugesNProbes folder.

Cheers!

zuodong
Lewis Liang is offline   Reply With Quote

Old   August 12, 2016, 11:01
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
@Zuodong: You are missing some subtleties in the formatting. Please compare with probeDefinitions in the bejiBattjes tutorial.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.

Last edited by wyldckat; August 25, 2018 at 09:23. Reason: removed reference to announcement for other users
ngj is offline   Reply With Quote

Old   August 14, 2016, 22:01
Default
  #3
Member
 
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10
Lewis Liang is on a distinguished road
Hi Niels! Thanks for your quick reply. And my case now can run by setting user-defined wave gauge along the water tank. Now, I also try to learn new thing from the bejiBattjes tutorial case. There are must some other things I want to figure out.

Best regard,

zuodong
Lewis Liang is offline   Reply With Quote

Old   October 18, 2020, 11:32
Default Wave gauge sampling on multiple processors
  #4
New Member
 
Arun Kumar
Join Date: Sep 2019
Location: Dundee, Scotland
Posts: 15
Rep Power: 7
AR91 is on a distinguished road
Dear Dr. Jacobsen,

Thank you very much for creating the very useful waves2Foam toolbox. I have been using the modified waveDyMFoam solver on OpenFOAM 4.0 in order to simulate a 2D freely floating rectangular box interacting with incoming waves. I am facing some trouble when it comes to sampling the surface elevation data using the wave gauges. The run-time sampling through controlDict works when I run the simulation on a single processor but as soon as I try to run the exact same case on multiple processors (64 to be exact), the simulation crashes. The solution is stable and doesn't seem to diverge. The log file is shown below:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 4.0
Exec   : waveDyMFoam -parallel
Date   : Oct 18 2020
Time   : 15:22:47
Host   : "node7"
PID    : 107318
Case   : /home/askumar/floating
nProcs : 64
Slaves : 
63
(
"node7.107319"
"node7.107320"
"node7.107321"
"node7.107322"
"node7.107323"
"node7.107324"
"node7.107325"
"node7.107326"
"node7.107328"
"node7.107330"
"node7.107331"
"node7.107332"
"node7.107341"
"node7.107346"
"node7.107347"
"node7.107350"
"node7.107353"
"node7.107354"
"node7.107355"
"node7.107356"
"node7.107359"
"node7.107361"
"node7.107363"
"node7.107364"
"node7.107420"
"node7.107436"
"node7.107438"
"node7.107441"
"node7.107442"
"node7.107443"
"node7.107444"
"node7.107445"
"node7.107446"
"node7.107447"
"node7.107448"
"node7.107449"
"node7.107450"
"node7.107451"
"node7.107452"
"node7.107453"
"node7.107454"
"node7.107455"
"node7.107460"
"node7.107463"
"node7.107469"
"node7.107470"
"node7.107487"
"node7.107492"
"node7.107506"
"node7.107519"
"node7.107526"
"node7.107529"
"node7.107530"
"node7.107533"
"node7.107536"
"node7.107622"
"node7.107647"
"node7.107648"
"node7.107649"
"node7.107650"
"node7.107651"
"node7.107652"
"node7.107653"
)

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

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

Create mesh for time = 0

Using #calcEntry at line 44 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Using #codeStream with "/home/askumar/floating/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5895c40af5a81535022b65a826705c9e73ce8870.so"
Creating new library in "dynamicCode/_5895c40af5a81535022b65a826705c9e73ce8870/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5895c40af5a81535022b65a826705c9e73ce8870.so"
Invoking "wmake -s libso /home/askumar/floating/dynamicCode/_5895c40af5a81535022b65a826705c9e73ce8870"
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file codeStreamTemplate.C
'/home/askumar/floating/dynamicCode/_5895c40af5a81535022b65a826705c9e73ce8870/../platforms/linux64GccDPInt32Opt/lib/libcodeStream_5895c40af5a81535022b65a826705c9e73ce8870.so' is up to date.
Using #codeStream at line 47 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Using #codeStream with "/home/askumar/floating/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5f7f13598df37434101cf7b38c8a2f9788cd3f1a.so"
Creating new library in "dynamicCode/_5f7f13598df37434101cf7b38c8a2f9788cd3f1a/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5f7f13598df37434101cf7b38c8a2f9788cd3f1a.so"
Invoking "wmake -s libso /home/askumar/floating/dynamicCode/_5f7f13598df37434101cf7b38c8a2f9788cd3f1a"
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file codeStreamTemplate.C
'/home/askumar/floating/dynamicCode/_5f7f13598df37434101cf7b38c8a2f9788cd3f1a/../platforms/linux64GccDPInt32Opt/lib/libcodeStream_5f7f13598df37434101cf7b38c8a2f9788cd3f1a.so' is up to date.
Selecting dynamicFvMesh dynamicMotionSolverFvMesh
Using #calcEntry at line 44 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Using #codeStream at line 47 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Selecting motion solver: sixDoFRigidBodyMotion
Using #calcEntry at line 44 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Using #codeStream at line 47 in file "/home/askumar/floating/constant/dynamicMeshDict.sixDoFRigidBodyMotionCoeffs"
Selecting sixDoFSolver Newmark
Translational constraint tensor (1 -0 -0 -0 0 -0 -0 -0 1)
Rotational constraint tensor (0 0 0 0 1 0 0 0 0)

PIMPLE: no residual control data found. Calculations will employ 3 corrector loops


Reading g

Reading waveProperties

Reading waveProperties
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading hRef
Calculating field g.h

No MRF models present

No finite volume options present

GAMGPCG:  Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Reading/calculating face velocity Uf

Courant Number mean: 0 max: 0

Starting time loop

Reading set description:
    gauge_0
    gauge_1
    gauge_2
    gauge_3
    gauge_4
    gauge_5
    gauge_6
    gauge_7
    gauge_8
    gauge_9
    gauge_10
    gauge_11
    gauge_12
    gauge_13
    gauge_14
    gauge_15
    gauge_16
    gauge_17
    gauge_18
    gauge_19
    gauge_20
    gauge_21
    gauge_22
    gauge_23

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.01
Time = 0.01

PIMPLE: iteration 1
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (7.5 0.05 0.399519910862)
    Centre of mass: (7.5 0.05 0.399519910862)
    Orientation: (1 0 -1.5057679996e-17 0 1 0 1.5057679996e-17 0 1)
    Linear velocity: (-5.80276567537e-18 0 -0.0960178275)
    Angular velocity: (0 -3.01153599921e-15 0)
smoothSolver:  Solving for alpha.water, Initial residual = 0, Final residual = 0, No Iterations 0
Phase-1 volume fraction = 0.499947728988  Min(alpha.water) = 0  Max(alpha.water) = 1
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.499947728988  Min(alpha.water) = 0  Max(alpha.water) = 1
Relaxing time: 0 s
GAMG:  Solving for p_rgh, Initial residual = 1, Final residual = 0.000321143732686, No Iterations 1
time step continuity errors : sum local = 0.00615193819787, global = -0.00360714334326, cumulative = -0.00360714334326
PIMPLE: iteration 2
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (7.50000000833 0.05 0.399841822489)
    Centre of mass: (7.50000000833 0.05 0.399841822489)
    Orientation: (1 0 4.41798255857e-07 0 1 0 -4.41798255857e-07 0 1)
    Linear velocity: (1.66507566073e-06 0 -0.0316355021125)
    Angular velocity: (0 8.83596511714e-05 0)
smoothSolver:  Solving for alpha.water, Initial residual = 0.000260167651944, Final residual = 1.66584027425e-11, No Iterations 2
Phase-1 volume fraction = 0.499978644217  Min(alpha.water) = 0  Max(alpha.water) = 1.00278670499
Applying the previous iteration compression flux
MULES: Correcting alpha.water
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.499978644217  Min(alpha.water) = -2.82654754931e-11  Max(alpha.water) = 1.00278670499
Relaxing time: 0 s
GAMG:  Solving for p_rgh, Initial residual = 0.00118923319052, Final residual = 5.47269695676e-06, No Iterations 4
time step continuity errors : sum local = 0.000295411575559, global = -0.000214989460502, cumulative = -0.00382213280376
PIMPLE: iteration 3
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (7.50000000764 0.05 0.399952430977)
    Centre of mass: (7.50000000764 0.05 0.399952430977)
    Orientation: (1 0 1.60534776481e-07 0 1 0 -1.60534776481e-07 0 1)
    Linear velocity: (1.52838121688e-06 0 -0.00951380453019)
    Angular velocity: (0 3.21069552961e-05 0)
smoothSolver:  Solving for alpha.water, Initial residual = 0.000149115994096, Final residual = 1.67613651637e-12, No Iterations 2
Phase-1 volume fraction = 0.499990496759  Min(alpha.water) = 0  Max(alpha.water) = 1.00045854237
Applying the previous iteration compression flux
MULES: Correcting alpha.water
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.499990496759  Min(alpha.water) = -1.87628466342e-05  Max(alpha.water) = 1.00045854237
Relaxing time: 0 s
GAMGPCG:  Solving for p_rgh, Initial residual = 0.0014670833164, Final residual = 5.65115202429e-10, No Iterations 5
time step continuity errors : sum local = 4.02403301845e-08, global = -9.65506178122e-09, cumulative = -0.00382214245882
ExecutionTime = 1.37 s  ClockTime = 6 s

[node7:107492] *** An error occurred in MPI_Waitall
[node7:107492] *** reported by process [1524367361,48]
[node7:107492] *** on communicator MPI_COMM_WORLD
[node7:107492] *** MPI_ERR_TRUNCATE: message truncated
[node7:107492] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
[node7:107492] ***    and potentially your MPI job)
[node7:107313] 2 more processes have sent help message help-mpi-errors.txt / mpi_errors_are_fatal
[node7:107313] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
The crash seems to happen exactly at the moment I try to get the surface elevation values. In fact, if I delay reading the values at 0.01 s to 0.1 s, the crash time changes from 0.01 s to 0.1 s.

Here is my controlDict and the probeDefinitions file.
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     waveDyMFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         2;

deltaT          0.01;

writeControl    adjustableRunTime;

writeInterval   0.5;

purgeWrite      0;

writeFormat     ascii;

writePrecision  12;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           1;
maxAlphaCo      1;
maxDeltaT       1;


libs
(
 //    "libudfIncompressibleRASModels.so"
 //    "libgroovyBC.so"
     "libudfFunctionObjects.so"
);

functions
{
    surfaceElevationAnyName
    {
        type               surfaceElevation;

        functionObjectLibs ( "libwaves2Foam.so" );
        writeControl      adjustableRunTime; // Alternative: outputTime
        writeInterval      0.01;

        //Additional output controls in waves2Foam
        //samplingStartTime  -1;
        //surfaceSampleDeltaT 0.025;

        setFormat          raw;
        interpolationScheme cellPointFace;
        fields (alpha.water);

        #includeIfPresent "../waveGaugesNProbes/surfaceElevationAnyName_sets";

    }

   // #includeIfPresent "../waveGaugesNProbes/surfaceElevationAnyName_controlDict";
}
// ************************************************************************* //
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.5                                   |
|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      loggingProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

surfaceElevationAnyName
{
    type waveGauge;
    pointDistribution userDefinedDistribution;
    N 24;
    xValues nonuniform List<scalar> 24(2.6 2.8 3.2 3.4 3.94 4.14 5.06 5.26 6.19 6.39 6.95 7.15 7.85 8.05 8.61 8.81 9.74 9.94 10.86 11.06 11.6 11.8 12.2 12.4);
    yValues uniform 0.05;
    zValues uniform 0.2;
    add	    (0 0.0 0.4);
    axis    z;



    // REQURIED ONLY FOR NEW FUNCTIONOBJECT IMPLEMENTATION
    //writeControl adjustableRunTime;
    //writeInterval 0.01;
}


// ************************************************************************* //
Hope you find some time to respond to this message.
Thank you very much.
Regards,
Arun.
AR91 is offline   Reply With Quote

Reply


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
User defined time step - Possible to put variable time stepping in it? maccheese Fluent UDF and Scheme Programming 19 June 4, 2018 10:49
How to use User defined database to add material sangeeta FLUENT 1 February 25, 2009 14:02
UDF - Derivatives for User Defined Memory Variable Sandilya Garimella FLUENT 0 January 14, 2008 11:39
Usage of user defined functions Gowrish FLUENT 1 October 26, 2005 08:44
add user scalar in one phase zhu CFX 0 April 27, 2002 04:45


All times are GMT -4. The time now is 02:01.