how to activate WallShearStress

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

how to activate WallShearStress

Post by haegar »

Hello,
I am using FreeCAD for about 3 years mainly for the design of r/c sailboats. Last year I started to have a closer look on OpenFOAM. After some help by @thschrader who put me on the right track I was able to produce nice pictures and I got first results which helped for my construction work. Last week I got some experimental data and I could verify a set of simulations for the first time. Now I am pretty sure that I am making not too much nonsense. Thanks to @thschrader for his help.

So far so good. Now I have a problem with the user interface. To calculate the friction I need access to the wall shear stress. I found several tutorials how to use this function, I found the right dictionary where to activate it, but I have no clue what parameters or other modifications are needed. I tried also the pisoFoam solver. The result is always the same. The simulation runs well, but no wallShearStress array is accessible. Something is wrong and I have no clue where to look for a mistake. The documentation I found is poor (or I am missing too much background information to understand it). I also found no possibility to activate the wallShearStress from CDoF.

I have installed the blueCFD-Core-2020-1-win64 package on the FreeCad 0.21.0.31625. OS is an up-to-date WINDOWS 11 (not 10 as shown by the FC Info below. But it was the same with Win10). The modified controlDict File is included below.

I would be very happy if somebody could help.

Code: Select all

/*--------------------------------*- C++ -*----------------------------------*\
|                                                                             |
|                Generated by the CfdOF workbench for FreeCAD                 |
|                  https://gitlab.com/opensimproject/CfdOF                    |
|                                                                             |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

deltaT          1;

endTime         2000;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  8;

runTimeModifiable true;

libs
(
    // Needed for availability of porous baffle boundary in potentialFoam
    #include "turbulenceLib"
);

wallShearStress1
{
    // Mandatory entries (unmodifiable)
    type            wallShearStress;
    libs            (fieldFunctionObjects);

    // Optional entries (runtime modifiable)
    // patches         (<patch1> ... <patchN>); // (wall1 "(wall2|wall3)");

    // Optional (inherited) entries
    writePrecision  8;
    writeToFile     true;
    useUserTime     true;
    region          region0;
    enabled         true;
    log             true;
    timeStart       0;
    timeEnd         1000;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    timeStep;
    writeInterval   1;
}


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

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.31625 (Git)
Build type: Release
Branch: master
Hash: 72df7997700062b6a02f2f208e6291f64073fb88
Python 3.10.8, Qt 5.15.6, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: German/Germany (de_DE)
Installed mods: 
  * A2plus 0.4.60i
  * AirPlaneDesign 0.4.0
  * Assembly4 0.11.8
  * Behave-Dark-Colors 0.1.1
  * CfdOF 1.21.3
  * CurvedShapes 1.0.0
  * Curves 0.3.0
  * fasteners
  * Manipulator 1.5.0
  * MeshRemodel 1.8919.0
  * nurbs
  * Plot 2022.4.17
  * POV-Ray-Rendering
  * Render 2022.1.0
  * Ship 2022.4.11
  * Silk -1387159344.0.0
Regards from Teltow, Germany
Achim
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: how to activate WallShearStress

Post by oliveroxtoby »

haegar wrote: Mon Feb 06, 2023 10:14 am So far so good. Now I have a problem with the user interface. To calculate the friction I need access to the wall shear stress. I found several tutorials how to use this function, I found the right dictionary where to activate it, but I have no clue what parameters or other modifications are needed. I tried also the pisoFoam solver. The result is always the same. The simulation runs well, but no wallShearStress array is accessible. Something is wrong and I have no clue where to look for a mistake. The documentation I found is poor (or I am missing too much background information to understand it). I also found no possibility to activate the wallShearStress from CDoF.
It's not accessible from CfdOF at the moment, but what you've done is almost correct. You just need to enclose the wallShearStress1 sub-dictionary in a functions { } subdictionary, i.e.

Code: Select all

functions
{
wallShearStress1
{
    // Mandatory entries (unmodifiable)
    type            wallShearStress;
    libs            (fieldFunctionObjects);

    // Optional entries (runtime modifiable)
    // patches         (<patch1> ... <patchN>); // (wall1 "(wall2|wall3)");

    // Optional (inherited) entries
    writePrecision  8;
    writeToFile     true;
    useUserTime     true;
    region          region0;
    enabled         true;
    log             true;
    timeStart       0;
    timeEnd         1000;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    timeStep;
    writeInterval   1;
}
}
haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

Re: how to activate WallShearStress

Post by haegar »

Thanks @oliveroxtoby ,
I had tried this in the beginning, but I must have made another mistake.
I will try again tomorrow and report.
Regards from Teltow, Germany
Achim
haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

Re: how to activate WallShearStress

Post by haegar »

Hi, Oliver
bad news - I did like you suggested and now I am getting a bunch of error messages ...

This is the present state:

The basic simulation works well in both, laminar and turbulence mode
Screenshot 2023-02-07 085652.jpg
Screenshot 2023-02-07 085652.jpg (36.03 KiB) Viewed 1838 times
I edited the controlDict file.
- inserting the wallShearStress Function in the functions block
- commenting out the patches line and the 3 dots

Code: Select all

/*--------------------------------*- C++ -*----------------------------------*\
|                                                                             |
|                Generated by the CfdOF workbench for FreeCAD                 |
|                  https://gitlab.com/opensimproject/CfdOF                    |
|                                                                             |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

deltaT          1;

endTime         2000;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  8;

runTimeModifiable true;

libs
(
    // Needed for availability of porous baffle boundary in potentialFoam
    #include "turbulenceLib"
);

functions
{wallShearStress1
{
    // Mandatory entries (unmodifiable)
    type        wallShearStress;
    libs        (fieldFunctionObjects);

    // Optional entries (runtime modifiable)
    //patches     (<patch1> ... <patchN>); // (wall1 "(wall2|wall3)");

    // Optional (inherited) entries
    //...
}
}

// ************************************************************************* //
With that, all the preparation work went fine, but when the solver entered the time loop, it crashed. See error messages below.

Code: Select all


Starting time loop

11:13:59  [0] 
[1] 
[2] 
[3] 




[0] 
[1] 
[2] 
[3] 




[0] 
[1] 
[2] 
[3] 
--> FOAM FATAL IO ERROR: 
--> FOAM FATAL IO ERROR: 
--> FOAM FATAL IO ERROR: 
--> FOAM FATAL IO ERROR: 




[0] 
[1] 
[2] 
[3] 
wrong token type - expected string, found on line 51 the word 'fieldFunctionObjects'
wrong token type - expected string, found on line 0 the word 'fieldFunctionObjects'
wrong token type - expected string, found on line 0 the word 'fieldFunctionObjects'
wrong token type - expected string, found on line 0 the word 'fieldFunctionObjects'




[0] 
[1] 
[2] 
[3] 




[0] 
[1] 
[2] 
[3] 
file: 
file: 
file: 
file: 
C:/Users/joach/AppData/Local/Temp/case/system/controlDict/functions/wallShearStress1/libs
IOstream/functions/wallShearStress1/libs
IOstream/functions/wallShearStress1/libs
IOstream/functions/wallShearStress1/libs
 at line 
 at line 
 at line 
 at line 
51
0
0
0
.
.
.
.




[0] 
[1] 
[2] 
[3] 




[0] 
[1] 
[2] 
[3] 
    From function 
    From function 
    From function 
    From function 
Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)




[0] 
[1] 
[2] 
[3] 
    in file 
    in file 
    in file 
    in file 
primitives/strings/fileName/fileNameIO.C
primitives/strings/fileName/fileNameIO.C
primitives/strings/fileName/fileNameIO.C
primitives/strings/fileName/fileNameIO.C
 at line 
 at line 
 at line 
 at line 
56
56
56
56
.
.
.
.




[0] 
[1] 
[2] 
[3] 

FOAM parallel run exiting

FOAM parallel run exiting

FOAM parallel run exiting

FOAM parallel run exiting
[0] 
[1] 
[2] 
[3] 




11:13:59  
job aborted:
[ranks] message

[0] application aborted
aborting  (comm=0x84000000), error 1, comm rank 0

[1] application aborted
aborting  (comm=0x84000000), error 1, comm rank 1

[2] application aborted
aborting  (comm=0x84000000), error 1, comm rank 2

[3] application aborted
aborting  (comm=0x84000000), error 1, comm rank 3

---- error analysis -----

[0-3] on DESKTOP-2AJ8STV
C:/PROGRA~1/BLUECF~1/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/simpleFoam aborted the job. abort code 1

---- error analysis -----

Regards from Teltow, Germany
Achim
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: how to activate WallShearStress

Post by oliveroxtoby »

haegar wrote: Tue Feb 07, 2023 10:22 am With that, all the preparation work went fine, but when the solver entered the time loop, it crashed. See error messages below.

Code: Select all

wrong token type - expected string, found on line 51 the word 'fieldFunctionObjects'
You probably need to change the line

Code: Select all

libs        (fieldFunctionObjects);
to

Code: Select all

libs        ("libfieldFunctionObjects.so");
since you're using BlueCFD. Different OpenFOAM versions...
haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

Re: how to activate WallShearStress

Post by haegar »

That’s it. Many thanks, Oliver.
Now I can access the wallShearStress array

Is the blueCFD version an outdated one?
If yes, how to update it? It is quite annoying having software and a non matching documentation …
Regards from Teltow, Germany
Achim
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: how to activate WallShearStress

Post by thschrader »

haegar wrote: Wed Feb 08, 2023 9:25 pm ...
Is the blueCFD version an outdated one?
...
Maybe. They look for funding:
http://bluecfd.github.io/Core/News/

There is an other cool program, bluecfd-AIR:
https://joomla.bluecape.com.pt/index.ph ... 0#Features

It is time to have a talk with the software-department of Vinci, the company I work for.
At a total sales volume of over 60 Billion EUR in 2022 there should be a possibility to
boost cool software. FreeCAD, bluecfd, ....
https://www.vinci.com/vinci.nsf/de/item ... zahlen.htm

Thomas
haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

Re: how to activate WallShearStress

Post by haegar »

Thanks to @oliveroxtoby and @thschrader for your support. Now it runs smoothly (although I do not yet fully understand the results - but this might be another story)
Regards from Teltow, Germany
Achim
haegar
Posts: 77
Joined: Tue Jul 26, 2022 10:11 pm

Re: how to activate WallShearStress

Post by haegar »

Hello,
it's me once again

WallShearStress works fine for me now in steady mode. When I try to use it in transient mode, the WallShearStress array appears, and the results seem to be reasonable, but all the other arrays (pressure, velocity, etc.) have vanished. Is this a bug? Do I need to switch something more? Or is OpenFoam not yet able to handle this? Or is my case simply too complex?

What I am going to simulate, is shown in the picture. The FreeCAD file itself is too big to post it here. If it will help, I will try to prepare something smaller. The software configuration is still the same as above.
Screenshot Wellenbild Foils 2.4s 2023-02-27 164540.jpg
Screenshot Wellenbild Foils 2.4s 2023-02-27 164540.jpg (128.85 KiB) Viewed 1255 times
(Yes, I know, it is a bit crazy what I am trying to do ...)
Regards from Teltow, Germany
Achim
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: how to activate WallShearStress

Post by thschrader »

haegar wrote: Tue Feb 28, 2023 7:38 am ...
If it will help, I will try to prepare something smaller.
...
(Yes, I know, it is a bit crazy what I am trying to do ...)
Maybe you can export the hull as a step file an post it here.
In addition post the FC-file with the cfdof-analysis alone,
and the controlDict with the wallshear settings.
With multiple posts.

Cool project, Sir!
Post Reply