volum integral of mag(U)...?
Hi there,
my question is how is possible to get the scalar value of the volume integral of the mag(U) in OpenFoam? To me it will be ok at least to know what is the function/command/whatever that allow to compute the scalar value of the volume integral of mag(U) for a given mesh... thank you very much in advance! |
The fast way (but not necessarily the easy one :D), if you use OpenFOAM 2.1.x, is to add this piece of code to the controlDict of your case:
Code:
functions foamEtcFile controlDict and change allowSystemOperations 1; When you run the code the first time, OpenFOAM will compile the additional code, and print the volume integral at each time step. |
Quote:
Regards |
Quote:
i did what you suggest me, and it works good! :) But how can I do to print the value of run.Time and the mag(U) in a file instead than to screen...without modify the code, that means always in the controlDict...? Thank you in advance... |
You can store the execution log, and process it to extract the values you need (and the corresponding times) with the standard Linux utilities.
As an alternative, you could try to open a text file in the code snippet, but I am not sure it's going to work. |
If I may shamelessly promote my own utility here:
http://code.google.com/p/foamcalcex/ I extended the standard foamCalc tool to support min, max and volumeIntegrate calculations. Code:
foamCalcEx mag U |
Hi Anton,
Seems to be an interesting utility. I would like to check it out, but the hg clone command as described on your page does not work for me. Could you upload a tar-ball to the forum with source ? Thanks! Eelco |
1 Attachment(s)
Eelco, did you use this link: https://code.google.com/p/foamcalcex/ ?
I'm attaching a tarball with the code to this post. Let me know if you have any troubles with it. |
Hi Anton,
Yes, and then I tried hg clone https://code.google.com/p/foamcalcex/ but this hg think does not work properly on our system Anyway, I will try you ultility. Thanks! Eelco |
Hi Anton,
I downloaded and compiled your utility (i put it under OpenFoam/application/utility/postprocessing/miscellaneous/ but now how can i use it? neither ./foamCalcEx nor foamCalcEx works. best andrea |
Andrea, are you sure it compiled correctly, and that you started your foam environment? At the end of the compilation, you will see the location of the executable (highlighted in red here):
Code:
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter \ - Anton |
Hi Anton,
i used ./Allwmake and this is what i got Code:
+ wmake libo postCalc i'm using OF 2.1.0 as you can see. best andrea |
You just compiled the post-processing libraries postCalc and foamCalcFunctionsEx, but not the application. I think you are in the wrong directory.
The directory tree should look like this: Code:
foamcalcex |
Hi Alberto,
I tried you piece of code to do the volume averaging. It works, so this is very useful. Thanks for that! Only one thing: it seems that it does not work if I run the code in parallel. Any quick example how to deal with that ? Thanks! Regards Eelco |
Hi,
you area right Anton, i was copiling from second level.:D Thanks andrea |
Quote:
Ok after searching for a day I find the solution right after posting this :) Very typical Quote:
|
I reported it as a bug at Mantis. The error can be avoided by the following suggestion
'As a workaround switch off the 'masterOnly' file reading (set fileModificationChecking to timeStamp instead of timeStampMaster) in the etc/controlDict (or your personal one). ' So copy the $FOAM_INST_DIR/etc/bashrc to the directory (create is if you dont have it yet, with the appropriate OF version of course) $HOME/.OpenFOAM/2.1.0/ and change line with timeStampMaster Eelco |
I found it minutes earlier in another posts of yours.
Bedankt :) |
I just saw your remark on the fvc::domainIntegrate. Thanks for that hint! I did not know this function. I just worked out the parallelisation of the routine for manually integrating over the cell. In case of a parallel run, this requires that information from the slave is explicitely communicated to the master. The makes the scripting error prone and more complex. I just tried you domainIntegrate function, and now live gets much more easy. I reprogrammed the script and checked it: the results are identical.
In case anybody is interested for an example of code funtions of both example: I try to obain the average position of a single gas bubble in a grid by calculating int_(gasfraction*position)/int_(gasfraction). My first version uses the explicite integration Code:
bubblePosition Code:
bubblePosition Regards Eelco |
Quote:
Quote:
Best, |
Bug in coded function in parallel mode resolved
I just got a message that the bug has been resolved in OF 2.1.x.
http://www.openfoam.org/mantisbt/view.php?id=480 Regards Eelco |
Quote:
|
Quote:
Hi! I am Neetu. I have also downloaded the tar file foamCalcEx. I have compiled it correctly according to your instruction, but still it is not working. When I am running this function from my case directory then it showing that "foamClacEx command is not found". What should I do now? Give me the solution for this problem. Thanks |
Quote:
|
Quote:
please make sure that you correct each 'files' file in each of the three 'Make' directories. If you use a local user environment for compiling additional stuff for OpenFOAM they should be Code:
foamCalc.C Code:
calcType/calcType.C Code:
postCalc.C FOAM_USER_APPBIN FOAM_USER_LIBBIN. Usually the structure in WM_PROJECT_USER_DIR should be like WM_PROJECT_USER_DIR/run WM_PROJECT_USER_DIR/lib WM_PROJECT_USER_DIR/platforms/...your_system.../bin. You can find out the assigned directory by typing Code:
echo $FOAM_USER_APPBIN Cheers, Michael |
The changes that Michael mentioned are already incorporated in the code repository (the tarball is not up to date). You can follow Michael's instructions, or get a copy using 'hg clone' (see previous posts or https://code.google.com/p/foamcalcex/source/checkout). Also do the same if you want to use foamCalcEx with OF-1.6-ext.
- Anton |
Thank you for the reply. Now I am able to compile the file correctly.
Thanks |
please help me?
1 Attachment(s)
Hi dear Foamers.
I want to calculate one equation(pics of it attachmented), im my case. please help me ,and tell me how to do it??? thanks for your attention. |
Quote:
Thanks for the great tool. Is it possible to average/integrate a certain parameter over a specific area, say num1<x<num2 & num3<y<num4? |
Quote:
|
Hi Anton, I am trying to compile your utility under OpefFoam 2.4. I'm following the details on the wiki installation but I am getting the following error:
~/OpenFOAM/theodore-2.4.0/foamcalcex/postProcessing ~/OpenFOAM/theodore-2.4.0/foamcalcex + wmake libo postCalc '/home/theodore/OpenFOAM/root-2.4.0/platforms/linux64GccDPOpt/lib/postCalc.o' is up to date. + wmake libso foamCalcFunctionsEx make: *** No rule to make target `/opt/openfoam240/src/finiteVolume/lnInclude/cyclicAMILduInterface.H', needed by `calcType/calcType.dep'. Stop. root@node3:~/OpenFOAM/theodore-2.4.0/foamcalcex# ./Allwmake ~/OpenFOAM/theodore-2.4.0/foamcalcex/postProcessing ~/OpenFOAM/theodore-2.4.0/foamcalcex + wmake libo postCalc '/home/theodore/OpenFOAM/root-2.4.0/platforms/linux64GccDPOpt/lib/postCalc.o' is up to date. + wmake libso foamCalcFunctionsEx SOURCE=calcType/calcType.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam240/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam240/src/OpenFOAM/lnInclude -I/opt/openfoam240/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calcType.o In file included from /opt/openfoam240/src/finiteVolume/lnInclude/ddtScheme.C:30:0, from /opt/openfoam240/src/finiteVolume/lnInclude/ddtScheme.H:325, from /opt/openfoam240/src/finiteVolume/lnInclude/fvcDdt.C:28, from /opt/openfoam240/src/finiteVolume/lnInclude/fvcDdt.H:199, from /opt/openfoam240/src/finiteVolume/lnInclude/fvc.H:44, from /opt/openfoam240/src/finiteVolume/lnInclude/fvCFD.H:8, from calcType/calcType.H:48, from calcType/calcType.C:26: /opt/openfoam240/src/finiteVolume/lnInclude/cyclicAMIFvPatch.H:39:35: fatal error: cyclicAMILduInterface.H: No such file or directory #include "cyclicAMILduInterface.H" I tried looking around in the site for changes in the Make files but nothing worked so far. Any idea what it could be? Thanks in advance! Theodore. |
Sorry, I just noticed your post now. If you haven't solved it already, the solution is to modify Make/options for foamCalcFunctionsEx as follows (adding include and library references to meshTools):
Code:
ifdef FOAM_DEV |
Hi Anton
I am trying to compile the FoamCalcEx library on OpenFOAM v1606+ and I have added the meshtools in the options files, but I'm getting this error message: Quote:
|
For my future reference: Change headerOk to typeHeaderOK
|
Hello Anton, firstly, thank you for sharing your utility.
I would like to know if it's possible to use volIntegrate field across a line (one point to another) instead of the entire domain? |
Quote:
I tried to use your uility on OF 7, but unfortunately i have this error. Kindly assist please Code:
~/foamcalcex/postProcessing ~/foamcalcex regards, Kabir |
All times are GMT -4. The time now is 03:13. |