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

Can you use postProcess functions like "forces" on a faceSet?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 5 Post By ssimmons

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2021, 17:51
Default Can you use postProcess functions like "forces" on a faceSet?
  #1
New Member
 
ssimmons
Join Date: Jan 2018
Posts: 2
Rep Power: 0
ssimmons is on a distinguished road
Hello Everyone,

This is my first post in the forums, so I apologise if I am missing something here or if I make any mistakes!

Basically, I have finished a number of simulations using the following forces function as a run-time function (in my controlDict):

Code:
forcesBlade
    {
        type             forces;
        libs               ("libforces.so");
        patches         (blade);
        pName          p;
        UName          U;
        rhoName        rho;
        rhoInf            1;
        CofR              (0 0.479105931997901 0.6);
        log                 true;
        writeControl    timeStep;
        timeInterval    1;
This worked well for me, I was able to sample out the forces observed on this "blade" during operation.

Now, however, I am looking back on my simulations and realising: it might have been a good idea to split the "blade" into subsections. I have successfully created three subsections of the "blade": "bladeInner", "bladeMid", and "bladeOuter". These subsections are all faceSets (not patches).

I am wondering: is it possible to implement a function like "forces" by calling out a set (faceSet, cellSet, etc.) or even a zone (cellZone, faceZone, etc.) instead of a patch? I have tried something like this:

Code:
forcesBlade_inner
    {
        type             forces;
        libs               ("libforces.so");
        set               (bladeInner);
        pName          p;
        UName          U;
        rhoName        rho;
        rhoInf            1;
        CofR              (0 0.479105931997901 0.6);
        log                 true;
        writeControl    timeStep;
        timeInterval    1;
But that did not seem to work. After digging through how the forces function works, I'm not sure if you are able to use it on anything other than a patch. Would I have to make my own function if that is the case? Or is there another solution anyone can think of?

I would really appreciate any suggestion, comments, or solutions!
ssimmons is offline   Reply With Quote

Old   May 21, 2021, 15:29
Default What I ended up doing...
  #2
New Member
 
ssimmons
Join Date: Jan 2018
Posts: 2
Rep Power: 0
ssimmons is on a distinguished road
Hi Again,

For anyone interested, here is what I ended up doing (although, I get the feeling no one else really has this issue).

Since I am not very confident with C++, I used some post processing function and paraview to accomplish this. My process:

1. I added the following lines to my controlDict to utilise OpenFOAM's wallShearStress function. My control dictionary specified most of the required and optional variables. I effectively only needed "type" and "libs". I left everything else commented for reference.

Code:
wallShearStress_screw
    {
        // Mandatory entries (unmodifiable)
        type            wallShearStress;
        libs ("libfieldFunctionObjects.so");

        //// Optional entries (runtime modifiable)
        //patches         (patch); // (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;

    }
2. I then ran the following in terminal to generate the wallShearStress value for each timestep.

Code:
interDyMFoam -postProcess
3. Then, I opened paraview for the case and specified the boundary patch that I wanted to find the forces on.

4. I used the calculator to create a field for density. Some FOAMers have set up their simulations so that density is a recorded output, so this might not be necessary in all cases. Density is required for my specific simulation since it is two-phase (hence the use of "interDyMFoam").

5. I created another calculator filter that calculated the viscous pressure. The calculator result name was "pViscous" and the entry was "-rho * wallShearStress".

6. I used the filter "generate surface normals" to create the "Normals" vector.

7. I used the calculator filter with the result name "pStatic" to calculate the hydrostatic component of pressure in my simulation with the entry "-p * Normals".

8. I calculated the cartesian distance from each cell to the centre of rotation. For brevity I just named the variable "CoR" in the calculator filter with the entry as "coordsX*iHat + (coordsY - 3.02916953)*jHat + (coordsZ - 3)*kHat". The numbers within the brackets correspont to the offset of the centre of rotation from the origin. I suppose you may be able to skip this step if you have the cell/point locations specified and the centre of rotation is the origin.

9. Next I found the torque values. Everything will eventually be integrated across the area of my domain's "blade" boundary. So, this step actually calculates the moment/torque divided by the area of each cell technically... (If you are concerned with units while you read my explanation here). The first calculator filter was for result name "momentStatic" and the entry was "-cross(forcesPressure, CoR)".

10. The final calculator filter was for result name "momentViscous" with the entry "-cross(forcesViscous, CoR)".

11. Then, I used various "clip" filters in paraview to break the "blade" boundary down to the segments I wanted to analyse. This step is very much geometry dependent, so I won't go into to much detail here. Suffice to say: I used the "clip" filter to get my desired geometries.

12. I used the "integrate variables" filter. Now the "momentStatic" and "momentViscous" terms are actually in units of a torque/moment.

13. Finally, I saved the data for all timesteps with a desired precision. The data is now in a format that you can easily post process with Python or MATLAB.

I hope this helps someone else!
Geon-Hong, granzer, sk11 and 2 others like this.
ssimmons is offline   Reply With Quote

Old   November 4, 2022, 03:19
Default
  #3
Member
 
Geon-Hong Kim
Join Date: Feb 2010
Location: Ulsan, Republic of Korea
Posts: 36
Rep Power: 16
Geon-Hong is on a distinguished road
Wow, what a work!

Quote:
Originally Posted by ssimmons View Post
Hi Again,

For anyone interested, here is what I ended up doing (although, I get the feeling no one else really has this issue).

Since I am not very confident with C++, I used some post processing function and paraview to accomplish this. My process:

1. I added the following lines to my controlDict to utilise OpenFOAM's wallShearStress function. My control dictionary specified most of the required and optional variables. I effectively only needed "type" and "libs". I left everything else commented for reference.

Code:
wallShearStress_screw
    {
        // Mandatory entries (unmodifiable)
        type            wallShearStress;
        libs ("libfieldFunctionObjects.so");

        //// Optional entries (runtime modifiable)
        //patches         (patch); // (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;

    }
2. I then ran the following in terminal to generate the wallShearStress value for each timestep.

Code:
interDyMFoam -postProcess
3. Then, I opened paraview for the case and specified the boundary patch that I wanted to find the forces on.

4. I used the calculator to create a field for density. Some FOAMers have set up their simulations so that density is a recorded output, so this might not be necessary in all cases. Density is required for my specific simulation since it is two-phase (hence the use of "interDyMFoam").

5. I created another calculator filter that calculated the viscous pressure. The calculator result name was "pViscous" and the entry was "-rho * wallShearStress".

6. I used the filter "generate surface normals" to create the "Normals" vector.

7. I used the calculator filter with the result name "pStatic" to calculate the hydrostatic component of pressure in my simulation with the entry "-p * Normals".

8. I calculated the cartesian distance from each cell to the centre of rotation. For brevity I just named the variable "CoR" in the calculator filter with the entry as "coordsX*iHat + (coordsY - 3.02916953)*jHat + (coordsZ - 3)*kHat". The numbers within the brackets correspont to the offset of the centre of rotation from the origin. I suppose you may be able to skip this step if you have the cell/point locations specified and the centre of rotation is the origin.

9. Next I found the torque values. Everything will eventually be integrated across the area of my domain's "blade" boundary. So, this step actually calculates the moment/torque divided by the area of each cell technically... (If you are concerned with units while you read my explanation here). The first calculator filter was for result name "momentStatic" and the entry was "-cross(forcesPressure, CoR)".

10. The final calculator filter was for result name "momentViscous" with the entry "-cross(forcesViscous, CoR)".

11. Then, I used various "clip" filters in paraview to break the "blade" boundary down to the segments I wanted to analyse. This step is very much geometry dependent, so I won't go into to much detail here. Suffice to say: I used the "clip" filter to get my desired geometries.

12. I used the "integrate variables" filter. Now the "momentStatic" and "momentViscous" terms are actually in units of a torque/moment.

13. Finally, I saved the data for all timesteps with a desired precision. The data is now in a format that you can easily post process with Python or MATLAB.

I hope this helps someone else!
Geon-Hong is offline   Reply With Quote

Reply

Tags
faceset, forces, function objects, patches, post process


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
Heat source by cell chtMultiRegionSimpleFoam LidaSa OpenFOAM Running, Solving & CFD 36 August 3, 2024 02:42
How to solve the boundary layer without wall functions? WhiteW OpenFOAM Running, Solving & CFD 4 January 20, 2020 05:55
postProcess functionality in openFOAM 4 bullmut OpenFOAM Post-Processing 23 July 21, 2017 10:11
[Commercial meshers] CCM+ Mesh Conversion Ingenieur OpenFOAM Meshing & Mesh Conversion 17 February 2, 2014 10:34
[swak4Foam] Mass flow rate through faceSet using swak4foam CedricVH OpenFOAM Community Contributions 5 May 4, 2012 08:57


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