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

coded functions (for runtime post-processing) fails with parallel run

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2016, 12:22
Default coded functions (for runtime post-processing) fails with parallel run
  #1
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Dear Foam experts',

here is a coded function to calculate a derived variable using a existiong variable IO object variable sMS1:alpha1. The following quoted text was added in the controlDict,

Quote:
TIntegral
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
redirectType integral;
outputControl timeStep;
code
#{
const volScalarField& fl = mesh().lookupObject<volScalarField>("sMS1:alpha1") ;
// volScalarField magU(mag(U));

scalar volIntegral = 0;
scalar volIntegralV = 0;

forAll (fl, cellI)
{
volIntegral += fl[cellI]*mesh().V()[cellI];
volIntegralV += 1.0*mesh().V()[cellI];
}
volIntegral=volIntegral/volIntegralV;
Info<<"ANSWER: " << volIntegral << endl;
//foo.write();

#};
}

In serial running of the solver it performs and does the job. But when executed in parallel the output is always zero.

Somebody kindly help.

Thanks and regards,
cfd@kgp
cfd@kgp is offline   Reply With Quote

Old   December 6, 2016, 03:28
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear cfd@kgp,

I am not 100% sure about the error but you can check (output) the size of your lookedUp field in serial and parallel. If both are identical, the lookUp command might be different. However, I think you should also use gSum instead of your primitive summing because gSum is the summation function for parallel stuff.

Good luck
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 8, 2016, 09:47
Default problem for sMS1:alpha1 in swakExpression due to colon
  #3
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Thanks Tobi!

can you please instuct me further on "check (output) the size of your lookedUp field in serial and parallel"

gsum do not work.

Quote:
Using dynamicCode for functionObject TIntegral at line 104 in ".TIntegral"
Creating new library in "dynamicCode/integral/platforms/linuxGccDPInt32Opt/lib/libintegral_622d34218b4809de0bc1877891d4b79ccf99a3 25.so"
Invoking "wmake -s libso /home/ojas/MY_works_VLP/OpenFoam_learning/practice/beta_-1/dynamicCode/integral"
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file FilterFunctionObjectTemplate.C
Making dependency list for source file functionObjectTemplate.C
.TIntegral: In member function ‘virtual void Foam::integralFunctionObject::write()’:
.TIntegral:126:30: error: ‘gsum’ was not declared in this scope
make: *** [Make/linuxGccDPInt32Opt/functionObjectTemplate.o] Error 1


--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/integral/platforms/linuxGccDPInt32Opt/lib/libintegral_622d34218b4809de0bc1877891d4b79ccf99a3 25.so"


file: .TIntegral from line 104 to line 109.

From function codedBase::createLibrary(..)
in file db/dynamicLibrary/codedBase/codedBase.C at line 213.

FOAM exiting

but simple "sum" operation does the job.

But problem is partially solved.

If the expresion could be written in Swak4Foam then we get a clean output file, with the method of coded function one has to extract the output from LOG file.

I found some important hint for using the varibles with colen is to define a alias. refer #13 https://www.cfd-online.com/Forums/op...variables.html

please have a look

Quote:
GFlAvg
{
aliases {
sMS1:alpha1 myfl;
// thermo:cp myCp;
}
type swakExpression;
valueType cellZone;
zoneName solid; // or whatever is your zoneName
accumulations (
average
);

expression "myfl";
verbose true;
// outputControlMode timeStep;
// outputInterval 1;
}
but " aliases { sMS1:alpha1 myfl; }" is not recognised with OF3.X and the corresponding version of Swak4Foam

Regards,
cfd@kgp is offline   Reply With Quote

Old   December 10, 2016, 19:35
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

if sum is working, gSum should work too because this is the function for parallel stuff. If you use sum, it should be not possible to run the stuff in parallel.

Sent from my HTC One mini using CFD Online Forum mobile app
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 11, 2016, 00:51
Default
  #5
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Hi Tobi,

Your argument seem logical Tobi...

But sum gives correct answer in parallel too....... I think sum is the compiler based function and thus mpi is already tuned for compiler functions, it should implicitly applies the reduce command.

Regards.
cfd@kgp is offline   Reply With Quote

Old   December 18, 2016, 05:58
Default coded function which runs in OF3.0.1 fails in OF4.0---no compiling error
  #6
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hi,

if sum is working, gSum should work too because this is the function for parallel stuff. If you use sum, it should be not possible to run the stuff in parallel.

Sent from my HTC One mini using CFD Online Forum mobile app
Hi Tobi!

I need your suggestion on this unique problem

the coded function which runs in OF3.01 and prints the value of "ANSWER" fails to do so in OF4.0. Here is the extract from the controlDict from one of the above directory

Also, please note that there are no errors during comiling the dynamic code in OF4.0 .
Code:
Dummy
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
redirectType dummy;
outputControl timeStep;
code
#{
const volScalarField& fl = mesh().lookupObject<volScalarField>("T") ;
// volScalarField magU(mag(U));

scalar volIntegral = 0;
scalar volIntegralV = 0;

forAll (fl, cellI)
{
volIntegral += fl[cellI]*mesh().V()[cellI];
volIntegralV += 1.0*mesh().V()[cellI];
}
volIntegral=volIntegral/volIntegralV;
Info<<"ANSWER: " << volIntegral << endl;
//foo.write();

#};
This is the output during dynamic compiling of the coded function,

Quote:
Reading "/home/ojas/OPENFOAM_4.0_18_november/withGMSH/Ra10e8/L1000/system/controlDict.functions.Dummy" from line 135 to line 140
Using deprecated 'outputControl'
Please use 'writeControl' with 'writeInterval'
Using dynamicCode for functionObject Dummy at line 135 in "/home/ojas/OPENFOAM_4.0_18_november/withGMSH/Ra10e8/L1000/system/controlDict.functions.Dummy"
Creating new library in "dynamicCode/dummy/platforms/linux64GccDPInt32Opt/lib/libdummy_a2d2bd98ff2a92c53bf305564b91683acd9e80aa. so"
Invoking "wmake -s libso /home/ojas/OPENFOAM_4.0_18_november/withGMSH/Ra10e8/L1000/dynamicCode/dummy"
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file functionObjectTemplate.C
'/home/ojas/OPENFOAM_4.0_18_november/withGMSH/Ra10e8/L1000/dynamicCode/dummy/../platforms/linux64GccDPInt32Opt/lib/libdummy_a2d2bd98ff2a92c53bf305564b91683acd9e80aa. so' is up to date.
--> FOAM Warning :
From function void Foam::timeControl::read(const Foam::dictionary&)
in file db/functionObjects/timeControl/timeControl.C at line 89
Reading "/home/ojas/OPENFOAM_4.0_18_november/withGMSH/Ra10e8/L1000/system/controlDict.functions.sh" from line 160 to line 170
Using deprecated 'outputControl'
Please use 'writeControl' with 'writeInterval'
cfd@kgp is offline   Reply With Quote

Old   December 18, 2016, 07:11
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Most of the warnings you got are related to the functions dictionary in controlDict and are not related to your coded boundary condition (if I got it right)

Sent from my HTC One mini using CFD Online Forum mobile app
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 18, 2016, 07:23
Unhappy coded function which runs in OF3.0.1 fails in OF4.0---no compiling error
  #8
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Most of the warnings you got are related to the functions dictionary in controlDict and are not related to your coded boundary condition (if I got it right)

Sent from my HTC One mini using CFD Online Forum mobile app
Thanks, but do you have any suggestion regarding how to make it run in OF4?
cfd@kgp is offline   Reply With Quote

Old   June 12, 2017, 22:54
Default
  #9
New Member
 
Kevin Cole
Join Date: Jun 2016
Location: Durham, NH
Posts: 11
Rep Power: 9
kodexys is on a distinguished road
cfd@kgp, have you discovered a fix for the function dictionary warnings? I'm not sure how to be rid of them.
kodexys is offline   Reply With Quote

Old   June 13, 2017, 03:27
Default
  #10
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Quote:
Originally Posted by kodexys View Post
cfd@kgp, have you discovered a fix for the function dictionary warnings? I'm not sure how to be rid of them.
Hi kodexys,

the fix is very simple just replace "( blah blah " by "{ blah blah }"

Hope this will help you. All the best!

Thanks
cfd@kgp is offline   Reply With Quote

Old   November 14, 2017, 04:57
Default
  #11
New Member
 
Join Date: Nov 2017
Location: Germany
Posts: 11
Rep Power: 8
elomri is on a distinguished road
Quote:
Originally Posted by cfd@kgp View Post

the fix is very simple just replace "( blah blah " by "{ blah blah }"

could you please specify what do you mean here ? i'm facing the same warning problem
elomri is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Error running simpleFoam in parallel Yuby OpenFOAM Running, Solving & CFD 14 October 7, 2021 04:38
Some questions about a multi region case run in parallel zfaraday OpenFOAM Running, Solving & CFD 5 February 23, 2017 10:25
Run time post processing vs Post run post processing pruthvi1991 OpenFOAM Post-Processing 1 February 19, 2015 14:15
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel JR22 OpenFOAM Running, Solving & CFD 2 April 19, 2013 16:49
Parallel computation and simultaneous post processing Armin OpenFOAM 9 December 27, 2010 19:18


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