fieldValues integration
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 ydirection. I found this while googling integration in openFoam: HTML Code:
Postprocessing The fieldValues function object has been extended to include: ensemble field averaging (average); areaweighted field averaging and integration in a userdefined direction (areaNormalAverage, areaNormalIntegrate); operation on a userdefined 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 userdefined 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 
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 
Quote:
Thanks, Bruno. The last link is very helpful as it leads to some documentation on postprocessing 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 yaxis 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 
Hi Benjamin,
OK, let's address one issue at a time:
Bruno 
A bit off topic
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()) Sincerely, Benjamin 
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; 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 
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 2D model with changes occurring only in the ydirection. (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*(phiaophiEaEqgCell)/(Rg*T))exp(alphaca*F*(phiaophiEaEqgCell)/(Rg*T))); HTML Code:
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 Here is is: HTML Code:
#include "simpleControl.H" 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 = phiaophiEaEqgCell; 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 
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.cfdonline.com/Forums/ope...tml#post421629  post #7 Best regards, Bruno 
This last link in your post doesn't seem to be working. Can you repost it please?
Benjamin Quote:

Nevermind it works, sorry!

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 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:

Source term
Hi Bruno,
So I'd like to add an implicit source term to my pde. It would look like this: HTML Code:
solve 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 
Hi Benjamin,
Quote:
Quote:
Bruno 
All times are GMT 4. The time now is 03:55. 