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

Modified volFieldValue

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By olesen
  • 1 Post By olesen

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 1, 2020, 07:55
Default Modified volFieldValue
  #1
New Member
 
Giovanni Farina
Join Date: Nov 2019
Location: Trieste, Italy
Posts: 11
Rep Power: 6
the_ichthyologist is on a distinguished road
Hi all,
I'm new to OpenFOAM and have very limited knowledge of C++, I'm trying to modify the volFieldValue postProcess function in order to calculate 'weighted' percentiles (weighted with alpha.water - I'm using a modified interFoam - and cells volume). I'm using openfoam6.



I think I managed to compile a modified version of volFieldValue called "myvolFieldValue" without changing anything but adding a new operation (which doesn't do anything).


Now I'm trying to implement my function: basically I want to sort "values" of concentration field in a certain region of my mesh from lowest to highest, at the same time sort corresponding cell volumes and alphas with the same order; then sum over indices (dividing by the total \sum_{i=0}^ {N} V_{i} c_{i} \alpha{i} ) until I tick the various percentiles (0.05 , 0.15 etc.).


I modified a quicksort algorithm in c++ but I can't define the right variable type for the arrays. It would be useful to reshape the arrays to simple vectors, I don't know if this is already done by volFieldValue when 'values', 'weightField' and 'V' are passed.


I attach all relevant files, this is the main error (for now):


fieldValues/myvolFieldValue/myvolFieldValueTemplates.C:230:14: error: cannot convert ‘const Foam::Field<double>’ to ‘const Foam::Field<double>*’ for argument ‘1’ to ‘void quickSort(const Foam::Field<double>*, const Foam::Field<double>*, const Foam::Field<double>*, int, int)’
quickSort(values, weightField, V, 0, n-1);



I also don't know if quicksort function definition is at the right place in the code and if I loop correctly over the fields once they are sorted.



I apologise for my poor knowledge, any help would be much appreciated


Giovanni
Attached Files
File Type: txt compilationerror.txt (17.8 KB, 1 views)
File Type: c myvolFieldValueTemplates.C (8.5 KB, 6 views)
File Type: h myvolFieldValue.H (7.2 KB, 5 views)
File Type: c myvolFieldValue.C (5.0 KB, 3 views)
the_ichthyologist is offline   Reply With Quote

 

Tags
coding, modified code, modified function, openfoam, postprocess function


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
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 21:00
Problem while compiling modified simpleFoam solver mattiafc OpenFOAM Programming & Development 0 May 26, 2020 20:01
Modified simpleFOAM using given Reynolds stress field K62 OpenFOAM Running, Solving & CFD 2 March 24, 2017 03:41
Modified rhoCentralFoam slip boundary fails in parallel ChrisA OpenFOAM Programming & Development 0 June 25, 2014 20:28
Modified Equation for CFX algorithm Craig Johansen CFX 0 August 27, 2004 23:02


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