|
[Sponsors] |
how to impose fixed value at a point (or region) during calculation ? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 5, 2010, 06:34 |
how to impose averaged field equal to 0 at a point during calculation ?
|
#1 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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. Last edited by Cyp; July 7, 2010 at 11:31. |
|
July 5, 2010, 08:23 |
|
#2 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
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 |
|
July 5, 2010, 09:57 |
|
#3 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 ? |
|
July 6, 2010, 03:40 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
http://foam.sourceforge.net/doc/Doxy...bc49953b884184 |
||
July 6, 2010, 04:59 |
|
#5 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 ? |
|
July 6, 2010, 07:40 |
|
#6 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17 |
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 |
|
July 6, 2010, 09:52 |
|
#7 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 Last edited by wyldckat; September 3, 2015 at 19:03. Reason: disabled embedded images |
|
July 8, 2010, 10:31 |
|
#8 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 ?? |
|
July 8, 2010, 12:47 |
|
#9 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17 |
Hi Cyp,
I'm still waiting for your equation and BC's. It would really help me to help you. Regards, Stefan |
|
July 8, 2010, 12:49 |
|
#10 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
||
July 8, 2010, 12:54 |
|
#11 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17 |
No I can't. Sorry. But now I can take a look.
Thanks. |
|
July 15, 2010, 13:21 |
|
#12 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 |
|
July 16, 2010, 04:01 |
|
#13 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17 |
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 |
|
July 16, 2010, 06:44 |
|
#14 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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.. |
|
July 19, 2010, 09:30 |
|
#15 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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 ( fvm::ddt(rho,T) +fvm::div(phi,T) -fvm::laplacian(rho*DT,T) ) 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 ?? |
|
July 20, 2010, 11:06 |
|
#16 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
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()) { # include "readSIMPLEControls.H" for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix TEqn ( fvm::ddt(rho,T) +fvm::div(phi,T) -fvm::laplacian(rho*DT,T) == f ) TEqn.setReference(TRefCell,TRefValue) TEqn.solve() } } T= phase_gamma*(T-fvc:domainIntegrate(phase_gamma*T)/V_gamma) +phase_beta *(T-fvc:domainIntegrate(phase_gamma*T)/V_gamma) How can I fix the value of my vector B at a point ? |
|
July 20, 2010, 12:15 |
|
#17 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17 |
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; labelList refCells (1,refCell); vectorField refValues (1, vector(0,0,0)); TEqn.setValues(refCells, refValues); Stefan |
|
July 21, 2010, 04:18 |
|
#18 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
Hi Stefan!
It perfectly works !! Thank you very much! |
|
August 3, 2010, 10:19 |
accessing cells from a patch
|
#19 |
Member
George Pichurov
Join Date: Jul 2010
Posts: 52
Rep Power: 16 |
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.
|
|
February 24, 2012, 06:41 |
|
#20 | |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Torque Calculation at Arbitrary Point | Mojtaba | Main CFD Forum | 0 | February 14, 2009 01:58 |
Calculation torque on arbitrary point | Mojtaba | Main CFD Forum | 0 | February 9, 2009 01:08 |
CFX4.3 -build analysis form | Chie Min | CFX | 5 | July 13, 2001 00:19 |
Grid refinement with wall functions | Mark Render | Main CFD Forum | 8 | May 2, 2000 08:09 |
Non-uniform grid calculation | Aspens | Main CFD Forum | 1 | February 23, 2000 15:15 |