how to impose averaged field equal to 0 at a point during calculation ?
Hi!
In my subject, I need to solve equations with a condition of average-field-equal-to-zero. I defined the average of the T field as : Code:
T_moy=fvc::domainIntegrate(T) / V how can I impose T_moy=0 during the calculation ? Thank you for your precious help. |
Hi Cyp,
Do you went to impose a value on certain points or do you search for a condition which will make sure that after solving the transport equation your field T is in accordance with your implied condition. Kathrin |
I want to be sure that after my calculation, the implied condition is satisfied.
In Comsol I imposed a constraint ( moy(T)=0) on one point (it is sufficient). what is the equivalent on OpenFOAM ? |
Quote:
http://foam.sourceforge.net/doc/Doxy...bc49953b884184 |
thank you for your answer !
The setValues definition precises that the imposed values are field value. In my case, I need to imposed a value for the average of a field over the domain. Do you think setValue is a good hint for my problem ? |
Hi Cyp,
I think it would be easier for us to help you, if you would show us your equation and boundary conditions in detail. Regards, Stefan |
Here is the problem I want to solve with OpenFOAM :
http://img5.imageshack.us/i/problemaaj.jpg/ It is the last condition ( <s_{gamma}>^{gamma}=0) I was talking about.. https://docs.google.com/leaf?id=0B3b...YWRlODRk&hl=en |
I am a bit lost...
Such a condition (to impose averaged field on a region equal to 0) is fundamental in my calculation. Can anyone give me a hint ?? |
Hi Cyp,
I'm still waiting for your equation and BC's. It would really help me to help you. Regards, Stefan |
|
No I can't. Sorry. But now I can take a look.
Thanks. |
Hi Herbert (and all of you of course!)
I still looking for a solution to my problem (it is a very fundamental point in my developpment). Do you think I can use the setValue (or setReference) utility in my case ? Thank you, Cyprien |
Hi Cyprien,
I did not come up to a solution as well. But I think you aren't able to use setValues or setReference. Can you solve the equation without boundaries fixing values (only gradient bc's)? In that case you could solve the field using setReference and subtract the average field value afterwards. I don't think there is a solution for your problem already existing in OpenFOAM. Regards, Stefan |
Hi!
In fact it is exactly what I do for the moment (subtract the average field value afterwards). But it only works with simple source terms. When I try this a more complicated source term, this method doesn't converge to a solution.. |
Someone told me that I should directly insert my problem into the matrix I want to solve. If I understand what it is suggested, I declare my problem as
Code:
fvScalarMatrix TEqn Code:
T_moy=domainIntegrate(phase_gamma*T)/V_gamma The next step is to enlarge my TEqn matrix by adding T_moy in the last position of the diagonal and zeros elsewhere. Finally I should get the result solving Code:
solve(TEqn == f) What do you think of this method ?? How can I enlarge my matrix ?? |
In fact, I found a very easiest way to proceed!!
I just have to fix a value at a point (with setReference) which assure the convergence of my problem. Then I find out my real fields by subtracting the average value of the calculated field! I post the code if someone is interested by such a problem : Code:
while(runtime.loop()) How can I fix the value of my vector B at a point ? |
Hi Cyp,
the you can use setValues. Even if you want to fix only one point, setValues needs a list of points to be fixed. The following should work: Code:
label refCell = 12345; Stefan |
Hi Stefan!
It perfectly works !! Thank you very much! |
accessing cells from a patch
Does anyone know how can I access the cells from a patch with name patchname ? I want to run a procedure (particle injection) for each of the cells. I have the code, but I need the cell index.
|
Hi everyone.
First of all, I would like to answer to this: Quote:
Also, I have a question: I want to impose a fixed value of a temperature in a certain volume of my domain. How can I do this? Should I use the fvMatrix::setValues() method? Thanks a lot, Samuele |
All times are GMT -4. The time now is 15:18. |