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

[waves2Foam] Fixes and extensions for waves2Foam with OpenFOAM-v2412

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Jost K

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2025, 08:51
Default Fixes and extensions for waves2Foam with OpenFOAM-v2412
  #1
Member
 
Jost Kemper
Join Date: Apr 2018
Location: Kiel, Germany
Posts: 42
Rep Power: 9
Jost K is on a distinguished road
Hi all,

I am using waves2Foam with OpenFOAM-v2412.
I just wanted to share some tweaks I found here.
Maybe they can find their way into future releases of this wonderful toolbox.

I encountered a compilation error in the sampling utility:
Code:
surfaceElevation/sampledSurfaceElevation.C: In member function 'voidFoam::sampledSurfaceElevation::gatherAllSets()':
surfaceElevation/sampledSurfaceElevation.C:169:35: error: no matching function for call to 'Foam::globalIndex::reset(Foam::label, Foam::globalIndex::gatherOnly)'
  169 |         globalIndices_[seti].reset(coords.size(), globalIndex::gatherOnly{});
Apparently line 169 in the file src/waves2FoamSampling2206/surfaceElevation/sampledSurfaceElevation.C needs to be:
Code:
globalIndices_[seti].reset(globalIndex::gatherOnly{}, coords.size());

...instead of:
Code:
globalIndices_[seti].reset(coords.size(), globalIndex::gatherOnly{});

...for newer FOAM versions.
I have not checked since what version exactly.
This fixes the error for me.

Hope this helps others with the same problem.

Cheers,
Jost
Jost K is offline   Reply With Quote

Old   March 26, 2025, 10:04
Default autoMap and rmap in gabcPressureRobin
  #2
Member
 
Jost Kemper
Join Date: Apr 2018
Location: Kiel, Germany
Posts: 42
Rep Power: 9
Jost K is on a distinguished road
I have implemented the autoMap and rmap functions in the GABCs.
Those are needed when the GABCs are used with adaptive mesh refinement.
(I guess also with overset?)


My suggestion would be to put the following code in src/waves2FoamGABC/fvPatchFields/basic/robinV/robinVFvPatchField.C


Code:
template<class Type>
void Foam::robinVFvPatchField<Type>::autoMap
(
    const fvPatchFieldMapper& m
)
{
    fvPatchField<Type>::autoMap(m);
    
    sourceValue_.autoMap(m);
    fixedCoeffs_.autoMap(m);
    gradCoeffs_.autoMap(m);
}

template<class Type>
void Foam::robinVFvPatchField<Type>::rmap
(
    const fvPatchField<Type>& ptf,
    const labelList& addr
)
{
    fvPatchField<Type>::rmap(ptf, addr);
    
    const robinVFvPatchField<Type>& mptf =
        refCast<const robinVFvPatchField<Type>>(ptf);

    sourceValue_.rmap(mptf.sourceValue_, addr);
    fixedCoeffs_.rmap(mptf.fixedCoeffs_, addr);
    gradCoeffs_.rmap(mptf.gradCoeffs_, addr);
}
...and in src/waves2FoamGABC/fvPatchFields/basic/robinV/robinVFvPatchField.H:
Code:
        // Mapping functions

            //- Map (and resize as needed) from self given a mapping object
            virtual void autoMap
            (
                const fvPatchFieldMapper&
            );

            //- Reverse map the given fvPatchField onto this fvPatchField
            virtual void rmap
            (
                const fvPatchField<Type>&,
                const labelList&
            );
... and change the definitions in src/waves2FoamGABC/fvPatchFields/derived/gabcPressureRobinV/gabcPressureRobinVFvPatchScalarField.C to:
Code:
void gabcPressureRobinVFvPatchScalarField::autoMap
(
    const fvPatchFieldMapper& m
)
{
   robinVFvPatchField<scalar>::autoMap(m);
}


void gabcPressureRobinVFvPatchScalarField::rmap
(
    const fvPatchField<scalar>& ptf,
    const labelList& addr
)
{
   robinVFvPatchField<scalar>::rmap(ptf, addr);
}
I have only tested this with OpenFOAM-v2412.
Hope it will be useful.

Cheers,
Jost
wlzr likes this.
Jost K is offline   Reply With Quote

Old   March 29, 2025, 23:13
Default
  #3
New Member
 
wlzr
Join Date: Nov 2023
Posts: 1
Rep Power: 0
wlzr is on a distinguished road
Hi Jost K,

I'm implementing overset functionality into waveFoam by referencing overInterDyMFoam's approach. After incorporating the differences between interFoam and waveFoam, the solver compiled successfully and worked with some test cases. However, I recently encountered a runtime error when running a specific case:
```
--> FOAM FATAL ERROR: (openfoam-2206)
unallocated autoPtr of type N4Foam22celerityShapeFunctionsE

From T* Foam::autoPtr<T>:perator->() [with T = Foam::celerityShapeFunctions]
in file /home/foam/OpenFOAM/OpenFOAM-v2206/src/OpenFOAM/lnInclude/autoPtrI.H at line 178.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::simpleExit(int, bool) at ??:?
#2 Foam::error::exiting(int, bool) at ??:?
#3 Foam::gabcPressureRobinVFvPatchScalarField::update Coeffs() at ??:?
#4 Foam::fvMatrix<double>::fvMatrix(Foam::GeometricFi eld<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) in ~/OpenFOAM/foam-v2206/platforms/linux64GccDPInt32Opt/bin/overWaveDyM2Foam
#5 Foam::fv::gaussLaplacianScheme<double, double>::fvmLaplacianUncorrected(Foam::GeometricFi eld<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#6 Foam::fv::gaussLaplacianScheme<double, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#7 Foam::tmp<Foam::fvMatrix<double> > Foam::fvm::laplacian<double, double>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in ~/OpenFOAM/foam-v2206/platforms/linux64GccDPInt32Opt/bin/overWaveDyM2Foam
#8 main in ~/OpenFOAM/foam-v2206/platforms/linux64GccDPInt32Opt/bin/overWaveDyM2Foam
#9 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#10 ? in ~/OpenFOAM/foam-v2206/platforms/linux64GccDPInt32Opt/bin/overWaveDyM2Foam
*** Process received signal ***
Signal: Aborted (6)
Signal code: (-6)
[ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7ff3c4a78420]
[ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7ff3c48b300b]
[ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7ff3c4892859]
[ 3] /home/foam/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5error10simpleExitEib+0x17a )[0x7ff3c51e2baa]
[ 4] /home/foam/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5error7exitingEib+0x4a)[0x7ff3c51e617a]
[ 5] /home/foam/OpenFOAM/foam-v2206/platforms/linux64GccDPInt32Opt/lib/libwaves2FoamGABC.so(_ZN4Foam36gabcPressureRobinVF vPatchScalarField12updateCoeffsEv+0x1367)[0x7ff3c5e442c7]
[ 6] overWaveDyM2Foam(_ZN4Foam8fvMatrixIdEC1ERKNS_14Geo metricFieldIdNS_12fvPatchFieldENS_7volMeshEEERKNS_ 12dimensionSetE+0x3d1)[0x55f0de50bfe1]
[ 7] /home/foam/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam2fv20gaussLaplacianSche meIddE23fvmLaplacianUncorrectedERKNS_14GeometricFi eldIdNS_13fvsPatchFieldENS_11surfaceMeshEEES8_RKNS 3_IdNS_12fvPatchFieldENS_7volMeshEEE+0x98)[0x7ff3c91b5ba8]
[ 8] /home/foam/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam2fv20gaussLaplacianSche meIddE12fvmLaplacianERKNS_14GeometricFieldIdNS_13f vsPatchFieldENS_11surfaceMeshEEERKNS3_IdNS_12fvPat chFieldENS_7volMeshEEE+0xa7)[0x7ff3c91abbc7]
[ 9] overWaveDyM2Foam(_ZN4Foam3fvm9laplacianIddEENS_3tm pINS_8fvMatrixIT_EEEERKNS_14GeometricFieldIT0_NS_1 3fvsPatchFieldENS_11surfaceMeshEEERKNS7_IS4_NS_12f vPatchFieldENS_7volMeshEEE+0x24e)[0x55f0de522ffe]
[10] overWaveDyM2Foam(main+0x9c5c)[0x55f0de4c155c]
[11] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7ff3c4894083]
[12] overWaveDyM2Foam(+0x6642e)[0x55f0de4cb42e]
*** End of error message ***
```
The error seems GABC-related - when replacing GABC boundaries with relaxation zones, the case runs normally.The error persists even after recompiling with proper overset code integration.Do you have any thoughts on this phenomenon?Thank you for any insights!
wlzr is offline   Reply With Quote

Old   March 31, 2025, 02:24
Default
  #4
Member
 
Jost Kemper
Join Date: Apr 2018
Location: Kiel, Germany
Posts: 42
Rep Power: 9
Jost K is on a distinguished road
Hi wlzr,

I do not see a direct link between your error message and the autoMap and rmap functions but I guess it could still very well be related.
You can check your log file for the lines "AUTOMAP NOT CODED!" or "RMAP NOT CODED!". If you find one of them, you should probably try implementing the functions.
Please let us know if you see any progress.

Cheers,
Jost
Jost K is offline   Reply With Quote

Reply

Tags
waves2foam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
The OpenFOAM extensions project mbeaudoin OpenFOAM 16 October 9, 2007 09:33


All times are GMT -4. The time now is 05:42.