CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Does sampleDict have limitation in number of fields? (https://www.cfd-online.com/Forums/openfoam-post-processing/203112-does-sampledict-have-limitation-number-fields.html)

reza2031 June 18, 2018 12:45

Does sampleDict have limitation in number of fields?
 
Hi,


I have 32 fields which I would like to monitor using sampleDict.

The issue is that I get error when I have 32 fields added in sampleDict but when I remove any of them (it does not matter which one) it works fine.

To me it is really strange. Is there any limitation on the number of fields which can be added to sampleDict?



sampleDict:
Code:

sets
(
    nearTop
    {
        type    uniform;
        axis    xyz;
        start  ( 10 20 0.5 );
        end    ( 20 20 0.5 );
        nPoints 5;
    }

    nearBottom
    {
        type    uniform;
        axis    xyz;
        start  ( 10 90 0.5 );
        end    ( 20 90 0.5 );
        nPoints 5;
    }
);

fields          (C_S_su C_S_aa C_S_fa C_S_va C_S_bu C_S_pro C_S_ac C_S_h2 C_S_ch4 C_S_ic C_S_in C_S_i C_X_c C_X_ch C_X_pr C_X_li C_X_su C_X_aa C_X_fa C_X_c4 C_X_pro C_X_ac C_X_h2 C_X_i C_S_cat C_S_an C_S_va_ion C_S_bu_ion C_S_pro_ion C_S_ac_ion C_S_hco3_ion C_S_nh3);

Error:
Code:

Time = 10

Reading fields:
    volScalarFields: C_S_i C_S_aa C_S_hco3_ion C_S_cat C_S_pro C_S_fa C_S_ac_ion C_S_nh3 C_S_pro_ion C_X_su C_X_h2 C_S_an C_X_c C_S_bu_ion C_X_aa C_X_i C_S_ic C_S_bu C_X_c4 C_X_pro C_S_va C_X_ch C_S_in C_S_su C_S_ac C_X_li C_S_ch4 C_X_pr C_X_ac C_S_h2 C_S_va_ion C_X_fa

Executing functionObjects
--> FOAM Warning :
    From function void Foam::sampledSets::writeSampleFile(const Foam::coordSet&, const Foam::PtrList<Foam::sampledSets::volFieldSampler<T> >&, Foam::label, const Foam::fileName&, const Foam::writer<Type>&) [with Type = double; Foam::label = int]
    in file sampledSet/sampledSets/sampledSetsTemplates.C at line 161
    File "/home/rigel/openFOAM/runJune/New/Cases/CASE/postProcessing/sampleDict/10/nearTop_C_S_su_C_S_aa_C_S_fa_C_S_va_C_S_bu_C_S_pro_C_S_ac_C_S_h2_C_S_ch4_C_S_ic_C_S_in_C_S_i_C_X_c_C_X_ch_C_X_pr_C_X_li_C_X_su_C_X_aa_C_X_fa_C_X_c4_C_X_pro_C_X_ac_C_X_h2_C_X_i_C_S_cat_C_S_an_C_S_va_ion_C_S_bu_ion_C_S_pro_ion_C_S_ac_ion_C_S_hco3_ion_C_S_nh3.xy" could not be opened. No data will be written
--> FOAM Warning :
    From function void Foam::sampledSets::writeSampleFile(const Foam::coordSet&, const Foam::PtrList<Foam::sampledSets::volFieldSampler<T> >&, Foam::label, const Foam::fileName&, const Foam::writer<Type>&) [with Type = double; Foam::label = int]
    in file sampledSet/sampledSets/sampledSetsTemplates.C at line 161
    File "/home/rigel/openFOAM/runJune/New/Cases/CASE/postProcessing/sampleDict/10/nearBottom_C_S_su_C_S_aa_C_S_fa_C_S_va_C_S_bu_C_S_pro_C_S_ac_C_S_h2_C_S_ch4_C_S_ic_C_S_in_C_S_i_C_X_c_C_X_ch_C_X_pr_C_X_li_C_X_su_C_X_aa_C_X_fa_C_X_c4_C_X_pro_C_X_ac_C_X_h2_C_X_i_C_S_cat_C_S_an_C_S_va_ion_C_S_bu_ion_C_S_pro_ion_C_S_ac_ion_C_S_hco3_ion_C_S_nh3.xy" could not be opened. No data will be written

End


alexeym June 19, 2018 08:46

Hi,

I think, it is limitation of a file system (file name length, ex. https://serverfault.com/questions/95...imits-on-linux). sample utility object reads all field names normally, but when it tries to create output file, it fails.

reza2031 June 20, 2018 05:20

Quote:

Originally Posted by alexeym (Post 696468)
Hi,

I think, it is limitation of a file system (file name length, ex. https://serverfault.com/questions/95...imits-on-linux). sample utility object reads all field names normally, but when it tries to create output file, it fails.

Hi Alexey,
Thank you for your reply. You are right. I reduced the fields' names and now it works fine.


Bests,
Reza

raumpolizei April 22, 2020 13:24

1 Attachment(s)
Hey there,

I don't know if this is still relevant but maybe someone will someday face the same problem that I did. I wanted to output a very high number (~1000) of fields in sets to postprocess them in a second step. Due to the maximum file name limit and the naming convention of OF output files when sets are created, it is impossible to write everything in one file. So I wrote a small script that basically ensures that all fields are divided in various (sub) sets functionObjects so that the maximum file name length is kept smaller than 255. The script must of course be modified to consider your personal field names and set data. It writes an outputfile "manyFieldsFO" (manyFields-FunctionObject) in the system folder of your case. This file can then be included in the controlDict file in the functions subdict.
Code:

functions
{
    #include "${FOAM_CASE}/system/manyFieldsFO"
}

The names are rather generic and I hope it is not too difficult to understand. You can contact me if you have problems using it. Or maybe it can inspire you, if you want to output hundreds or thousands of fields to output files like I wanted to. Good luck!
RP

PS 1: it's a python script >> python3 createManyFieldSets.py
PS 2: Somehow, It is not possible to attach python scripts. I had to zip it.
PS 3: If any OF-dev reads this - I know it is a niche but it would be nice to be able to specify an alternative output file name to bypass this problem.


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