View Issue Details

IDProjectCategoryView StatusLast Update
0002499OpenFOAM[All Projects] Bugpublic2017-03-16 12:00
ReporterchriskAssigned Tohenry 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0002499: FunctionObject dsmcFields has no acess to Mean-Fields
DescriptionHi,
I am using dsmcFoam and I am averaging the fields with the option restartOnOutput set to on. When this option is set the order in which the functionObject are called is crucial. If the fields are first averaged like in the tutorial wedge15Ma5 and then the dsmcFields functionObject is called the calulation "fails" (the non-averaged fields are used), because of the option restartOnOutput the Mean-Fields are reseted/cleared in memory the moment before the calculation.

Solution to that problem is change the order in which the functions are called in the controlDict, but doing this if I understand it right, the final timestep isn't used for the dsmcField-FunctionObject calculation, becauses it is not used in the averaging process, meaning the result is not what one would expect.

Also there is that problem that when you try to calculate the dsmcField in postProcess, that the Mean-Fields are not loaded into the ObjectRegistry for the dsmcFoam solver.

1) So trying something like this:
dsmcFoam -time 0.001 -postProcess

1) Results in:
--> FOAM FATAL ERROR:

    request for volScalarField rhoNMean from objectRegistry region0 failed
    available objects of type volScalarField are

2) Trying:
dsmcFoam -time 0.001 -postProcess -fields '(rhoNMean rhoMMean momentumMean linearKEMean internalEMean iDofMean fDMean)'

2) Results in the same error.

3) Trying:
postProcess -fields '(rhoNMean rhoMMean momentumMean linearKEMean internalEMean iDofMean fDMean)' -time 0.001 -func dsmcFields

3) Results in:
--> FOAM Warning :
    From function static bool Foam::functionObjectList::readFunctionObject(const Foam::string&, Foam::dictionary&, Foam::HashSet<>&, const Foam::word&)
    in file db/functionObjects/functionObjectList/functionObjectList.C at line 245
    Cannot find functionObject file dsmcFields
Time = 0.001

Reading fields:
    volScalarFields: iDofMean rhoMMean internalEMean rhoNMean linearKEMean
    volVectorFields: momentumMean fDMean



So fields are loaded, but after that nothing happens.

I hope my explenations are understandable and that it can be fixed.

Chears,
Christoph
Steps To Reproduce-Use the wedge15Ma5 tutorial
-Add the option restartOnOutput on; in the fieldAverage function
-Set the nEquivalentParticles to 5e11 in constant/dsmcProperties (Or else dsmcField can not be calculated, because some rhoNMean values are 0; See /src/functionObjects/lagrangian/dsmcFields/dsmcFields.C Line 146)
-Take a look in paraview and compare the UMean field, with one calculated in paraview (momentumMean/rhoMMean)
-Change the order of the function calls in the controlDict and compare again
TagsNo tags attached.

Activities

henry

2017-03-13 19:39

manager   ~0007924

Can you provide a patch to fix this problem?

chrisk

2017-03-13 21:51

reporter   ~0007926

Not really. Only a very very bad workaround, that doesn't fix the problem with the crucial order of functions and memory clearing when restartOnOutput is set to on.

With this "workaround" I am using the fieldAverage function during simulation and a motified dsmcField function (src/functionObjects/lagrangian/dsmcFields/dsmcFields.C), that loads the mean fields to the objectRegistry.

Also this problem only exists, because with OF 4.x it's possible to calculate the dsmcFields during the simulation. In previous versions this was done after the simulation with the executable dsmcFieldsCalc.

dsmcFields.C (11,382 bytes)

chrisk

2017-03-13 21:51

reporter  

dsmcFields-2.C (11,382 bytes)

chrisk

2017-03-13 21:57

reporter   ~0007927

* I use the motified dsmcField function after the simulation with:
dsmcFoam -postProcess

henry

2017-03-13 22:05

manager   ~0007928

When you have had time to complete a more consistent fix for the problem please submit it for inclusion on OpenFOAM.

chrisk

2017-03-14 12:55

reporter   ~0007929

Small fix to the workarond, MUST_READ prints a lot of warnings.

I can look into it more when I finish my master thesis, but for now I don't have much time on my hand.

dsmcFields-WorkAround.C (11,626 bytes)

henry

2017-03-14 15:35

manager   ~0007930

Rather than add a lot of mean field reading clutter to dsmcFields it is better that these are read by the postProcess utility in the same way as is done for the other post-processing functionObjects. This simply requires the creation of a postProcess configuration file in OpenFOAM-???/etc/caseDicts/postProcessing. I have added this file in OpenFOAM-dev and OpenFOAM-4.x so now

postProcess -time 0.001 -func dsmcFields

works on the wedge15Ma5 case.

chrisk

2017-03-16 11:54

reporter   ~0007932

Yeah that's a great solution, now you can at least use the functionObject in postProcess.

My workaround did not even work, it always read the same timestep.

Issue History

Date Modified Username Field Change
2017-03-13 19:07 chrisk New Issue
2017-03-13 19:39 henry Note Added: 0007924
2017-03-13 21:51 chrisk File Added: dsmcFields.C
2017-03-13 21:51 chrisk Note Added: 0007926
2017-03-13 21:51 chrisk File Added: dsmcFields-2.C
2017-03-13 21:57 chrisk Note Added: 0007927
2017-03-13 22:05 henry Note Added: 0007928
2017-03-14 12:55 chrisk File Added: dsmcFields-WorkAround.C
2017-03-14 12:55 chrisk Note Added: 0007929
2017-03-14 15:35 henry Note Added: 0007930
2017-03-16 11:54 chrisk Note Added: 0007932
2017-03-16 12:00 henry Assigned To => henry
2017-03-16 12:00 henry Status new => resolved
2017-03-16 12:00 henry Resolution open => fixed
2017-03-16 12:00 henry Fixed in Version => 4.x