|
[Sponsors] |
March 28, 2013, 15:21 |
fieldValues integration
|
#1 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Dear openFoamers,Spring is right around the corner! Hope you all are feeling the warmth!
Anyway, I am trying to integrate a scalarfield jbv over my length in the y-direction. I found this while googling integration in openFoam: HTML Code:
Post-processing The fieldValues function object has been extended to include: ensemble field averaging (average); area-weighted field averaging and integration in a user-defined direction (areaNormalAverage, areaNormalIntegrate); operation on a user-defined surface (sampledSurface) instead of mesh faces. The Mach, Pe, wallHeatFlux and yPlusRASutilities have been extended to use any basicThermo thermodynamics packages. Apparently, the fieldValue function object can "integrate in a user-defined direction". That is exactly what I'd like to do. The only problem: I'm not sure how to use it. Can anyone help? Sincerely, Benjamin |
|
April 1, 2013, 09:28 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Greetings Benjamin,
I'm guessing you haven't read the release notes for OpenFOAM 2.2: http://www.openfoam.org/version2.2.0/index.php In particular: http://www.openfoam.org/version2.2.0/documentation.php Which leads us to: http://foam.sourceforge.net/docs/cpp/modules.html Best regards, Bruno
__________________
|
|
April 12, 2013, 13:40 |
|
#3 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Quote:
Thanks, Bruno. The last link is very helpful as it leads to some documentation on post-processing functions within openfoam. There is a list of field functions that I look at with this link: http://foam.sourceforge.net/docs/cpp/a09432.html And under that there is a faceSource function I found with this link: http://foam.sourceforge.net/docs/cpp...5.html#details Now apparently to use this function I need to copy and paste the code, with some modification, into my controlDict file. Is this correct? Now, to my problem. I would like to use the fieldValue function and integrate my field along the y-axis of my geometry as in my simulation things are only changing along that one dimension. It is found with this link: http://foam.sourceforge.net/docs/cpp...1.html#details However, unlike faceSource there is no example code for fieldValue, even though faceSource is a "class" of fieldValue. I am not sure what "class" means and if I can use the same code from faceSource for fieldValue. So, my problem is I do not have an example code from fieldValue to insert into my controlDict file and I do not understand the documentation enough to create my own code. Any help you can provide would be a life saver. Sincerely, Benjamin |
||
April 14, 2013, 12:21 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Benjamin,
OK, let's address one issue at a time:
Bruno
__________________
|
|
April 16, 2013, 17:05 |
A bit off topic
|
#5 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Hey Bruno,
Thanks for the help with the volIntegration. I haven't gotten it to work yet but I was able to make some zones and am about to try it out. I'll post if I get it to work. I had a question you may or may not be able to answer. It is about the time loops. In my code I have: HTML Code:
while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; while (simple.correctNonOrthogonal()) { Dum = phi; solve ( fvm::laplacian(sigmaeff, phi) + phiao - phi - EaEqgCell ); Check = phi; } #include "mapToCell.H" #include "write.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Sincerely, Benjamin |
|
April 17, 2013, 17:12 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Benjamin,
I'm not sure understand your questions... or at least, I'm not understanding very well your logic. The "Dum" and "Check" variables are giving you copies of the "phi" field, as it was before and after the solve code. For example, it's the same as: Code:
Dum = 1; Check = 2; At first, I thought you were asking why both "Dum" and "Check" had the same "phi" value for after the solve variable... Perhaps it's easier for me to understand if you describe what you're trying to do. Best regards, Bruno
__________________
|
|
April 21, 2013, 12:56 |
|
#7 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Hi Bruno,
Thank you for your reply. So, what I'd really like to do is basically the same just looks more complex. I'll try and explain it first. I have a variable, the charge density or jbvagcell, that needs as an input the phi variable. The phi variable, meanwhile, I have as an initial condition as zeros on the internal field with two boundary conditions in a 2-D model with changes occurring only in the y-direction. (A simple rectangular geometry with sides as zeroGradient and the two ends as a fixedValue boundary condition). Here is my equation for jbvagcell: HTML Code:
jbvagCell == iagCell*exp((alphaaa*F*(phiao-phi-EaEqgCell)/(Rg*T))-exp(-alphaca*F*(phiao-phi-EaEqgCell)/(Rg*T))); HTML Code:
solve ( fvm::ddt(H2O) - fvm::laplacian(DH2Oeff, H2O) - sa*H2OMM/(n5*F) ); Then I take the jbvagCell and place it into a pde, which becomes an implicitly differentiated pde, because I am solving for phi and it is also contained in jbvagCell. It looks as follows: HTML Code:
solve ( fvm::laplacian(sigmaeff, phi) + jbvagCell ); Here is is: HTML Code:
#include "simpleControl.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating concentration distribution\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; //**Add laplacians to all four species: O2, N2, H2O, H2 while (simple.correctNonOrthogonal()) { ***************equations******************* } ****mapping function from local to global meshes****** #include "mapToCell.H" #include "write.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } First question: When I look at phi before the implicit pde for phi, I get a linear curve which happens immediately, right after the first time step and held constant thereafter, between its two initial boundary conditions. I would at least expect an ever changing curve until it hits a steady state. Also, when I look at the actual phi I get a bell shaped curve whose max is huge, way above realistic capability. But this is changing up until steady state. Why do two different phi's show up? Why is it linear and constant before the solve and then look different after the solve? Does it have to do with the time loop? Second question: I would like to look at the overpotential, or etta, which is calculated as: HTML Code:
etta = phiao-phi-EaEqgCell; Third question: Is it good openFoam coding to put all of these equations and pdes in succession, one after the other, and within pdes? Maybe I am getting these incorrect results because of poor sequencing or coding? Anything you can think of, even the smallest inkling of a doubt, please let me know. I am utterly confused and stumped on why my results are showing up this way. When I created my simulation I had the utmost confidence that it would work meticulously, robustly, and accurately. Now, I am humbled beyond compare. Sincerely, Benjamin |
|
April 21, 2013, 16:27 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Benjamin,
Mmm... well, this is a bit over my head... Nonetheless, there are two things that leave me a bit suspicious:
As for having so many equations solved so closely, there shouldn't be any problems... as long as it makes mathematical sense . I've seen something similarly complex just the other day... here we go: http://www.cfd-online.com/Forums/ope...tml#post421629 - post #7 Best regards, Bruno
__________________
|
|
April 21, 2013, 17:00 |
|
#9 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
This last link in your post doesn't seem to be working. Can you repost it please?
Benjamin Quote:
|
||
April 21, 2013, 17:01 |
|
#10 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Nevermind it works, sorry!
|
|
April 24, 2013, 18:14 |
|
#11 | |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Hi Bruno,
So as it turns out there was an incorrect equation in my file, which was giving me incorrect results. They look pretty good now. Thanks for the help with that . I am still trying to figure out the integration. I placed the following code in my controlDict file: HTML Code:
cellSource1 { type cellSource; functionObjectLibs ("libfieldFunctionObjects.so"); log true; valueOutput true; source cellZone; sourceName anode; operation volIntegrate; fields ( jbvagCell ); } where jbvagCell is the scalarfield I'd like to integrate. I created a cellZone named anode. I then run my simulation and there are no errors. But I do not know how to access the volIntegrate results. They are not in paraView. Where can I find them? Sincerely, Benjamin Quote:
|
||
April 26, 2013, 17:42 |
Source term
|
#12 |
Member
Ronald McDonald
Join Date: Jul 2012
Posts: 38
Rep Power: 13 |
Hi Bruno,
So I'd like to add an implicit source term to my pde. It would look like this: HTML Code:
solve ( Foam::fvm::laplacian(sigmaeff, phi) == iagCell*((Foam::exp(alphaaa*F*(phiao-phi-EaEqgCell)/(Rg*T)))-(Foam::exp(-alphaca*F*(phiao-phi-EaEqgCell)/(Rg*T)))) ); Where phi is my volscalarfield. Other variables are independent or constant. I looked at OpenFoam documentation, specifically from this site: http://www.foamcfd.org/Nabla/guides/...sGuidese9.html And it talks about using Su, Sp, and SuSp. I would like to use those things but I'm not sure how to. In the documentation it talks about a rho and phi, where rho can either be a dimensioned scalar or a volscalarField, and phi is the volscalarfield. Now in my pde I do not know what rho would be. Also, I found another link talking about this: http://openfoamwiki.net/index.php/Ho...sport_equation Any help you could provide would be great! Sincerely, Benjamin |
|
April 26, 2013, 20:01 |
|
#13 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Benjamin,
Quote:
Quote:
Bruno
__________________
|
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How are the integration constants for the JANAFthermo class derived? | tomf | OpenFOAM Running, Solving & CFD | 2 | May 15, 2015 08:47 |
CFD-Post: Polyline Export at Integration Points | minger | ANSYS | 4 | February 22, 2014 10:23 |
Fluent Integration Numerics | RodriguezFatz | FLUENT | 11 | February 21, 2013 07:35 |
About Aspen and Fluent Integration! | xfish | FLUENT | 0 | March 24, 2005 22:51 |
Any numerical triple integration program is available in Fortran? | Radhakrishnan | Main CFD Forum | 3 | March 4, 1999 02:03 |