|
[Sponsors] |
September 1, 2020, 07:55 |
Modified volFieldValue
|
#1 |
New Member
Giovanni Farina
Join Date: Nov 2019
Location: Trieste, Italy
Posts: 11
Rep Power: 6 |
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 ) 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 |
|
Tags |
coding, modified code, modified function, openfoam, postprocess function |
|
|
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 |