
[Sponsors] 
June 23, 2006, 10:35 
I fell some trouble to impleme

#1 
Member
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 11 
I fell some trouble to implement a scalar transport eqn with the following source term:
C1*[grad(Xi)]^2  C2*epsilon/k * rho * Xi C1,C2: constants epsilon: turbulent dissipation k: turbulent kinetic energy Xi: scalar variable How do I have to implement this FOAM? 

June 23, 2006, 12:52 
the main problem is the realis

#2 
Member
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 11 
the main problem is the realistation of the squared gradient [grad(Xi)]^2
I have tried to do this like: volScalarField gradXiVar2 = fvc::grad(XiVar) & ... solve ( ...  fvm::Sp(...,gradXiVar2) ) but the following error occurs: > FOAM FATAL ERROR : incompatible fields for operation [XiVar]  [(grad(XiVar)&grad(XiVar))] How can I realise this squared gradient term? 

June 23, 2006, 12:54 
ups there is type
volScalar

#3 
Member
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 11 
ups there is type
volScalarField gradXiVar2 = fvc::grad(XiVar) & fvc::grad(XiVar) 

June 23, 2006, 13:25 
You've just for the the wrong

#4 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,823
Rep Power: 27 
You've just for the the wrong way around:
In fvm::Sp, first put the multiplier and then the field you're solving for. Also, you seem to be confused by the meaning of things a bit:  first things first: C1*[grad(Xi)]^2 C1*magSqr(grad(Xi)). Done.  C1*[grad(Xi)]^2 is always positive, which makes it a source. Putting it into Sp will just harm your matrix structure. Thus, just leave it as a plain old field in the source  if you want to make C2*epsilon/k * rho * Xi, please tell me which variable you want to make it implicit in. In other words, what equation are you solving where this appears as the source term. I will assume you're solving for Xi: in this case, the Sp term would read: fvc::Sp(C2*epsilon/k*rho, Xi) Note that C2*epsilon/k*rho, is always positive and the minus in front of it makes this a sink term, so there's a point in making this an Sp. As you can see, the multiplier comes first and then the field (Xi) that you're solving for. Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

June 24, 2006, 02:08 
thanks Hrv!
just to make su

#5 
Member
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 11 
thanks Hrv!
just to make sure I get you right: I want to solve a Xieqn and the problem is to implement the following source terms C1*[grad(XXi)]^2  C2*Xi the first term I already know from the XXiEqn so I think I can simply write C1*magSqr(fvc::grad(XXi)) the second term is always a sink (as you already mentioned) so an implicit formulation will advance the diagonal dominance of my matrix so you write fvc::Sp(C2*epsilon/k*rho, Xi) but why not fvm::Sp(C2*epsilon/k*rho, Xi) ??? Am I on the right way? 

June 24, 2006, 04:20 
Sorry, my fault: it should (of

#6 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,823
Rep Power: 27 
Sorry, my fault: it should (of course) be fvm::Sp(C2*epsilon/k*rho, Xi)
Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

August 14, 2007, 07:08 
Hi everybody
When i add a s

#7 
Senior Member
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 11 
Hi everybody
When i add a source term (grad(Fi)) to momentum equation in icoFoam solver i get the below error Where: Gravity defined as Gravity [0 1 2 0 0 0 0] 9.81 and: volScalarField Fi = Gravity.value() * mesh.C().component(1) ; fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U)  fvm::laplacian(nu, U) ); solve(UEqn == fvc::grad(Fi)fvc::grad(p)); .... SOURCE_DIR=. SOURCE=icoFoam.C ; g++ m32 Dlinux DDP Wall W Wnounusedparameter Woldstylecast O3 DNoRepository ftemplatedepth30 I/marhamat/OpenFOAM/OpenFOAM1.3/src/finiteVolume/lnInclude I/marhamat/OpenFOAM/OpenFOAM1.3/src/OpenFOAM/lnInclude IlnInclude I. fPIC pthread c $SOURCE o Make/linuxGcc4DPOpt/icoFoam.o icoFoam.C: In function 'int main(int, char**)': icoFoam.C:66: error: 'Fi' was not declared in this scope make: *** [Make/linuxGcc4DPOpt/icoFoam.o] Error 1 What is the matter? Thanks alot Marhamat 

August 14, 2007, 10:49 
The definition of Fi is inside

#8 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 29 
The definition of Fi is inside braces {}, so it's not accessible when it's used in the solve line.
Check where Fi is defined. Regards, A.
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

August 25, 2007, 04:18 
Hello everybody
After running

#9 
New Member
morteza
Join Date: Mar 2009
Posts: 18
Rep Power: 11 
Hello everybody
After running the new icoFoam solver that changed by adding grad(Fi) as a source term , the vorticity magnitude increased with opposite of my expection . I used inlet and outlet for inlet&outlet boundries and other boundries are symmetryplane You can see the vorticitymag before and after of adding grad(Fi).I explaned Fi in my last message in this page. : : : Do you think i get correct result? An How i can decrease the vorticity magnitude? Have a nice weekend Marhamat 

August 25, 2007, 07:18 
Hi guys
I send the above mes

#10 
Senior Member
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 11 
Hi guys
I send the above message with my friend. So anything is right. sorry for disturbing you Marhamat 

August 27, 2007, 06:04 
Ideas are welcome.(:
Thanks

#11 
Senior Member
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 11 
Ideas are welcome.(:
Thanks alot 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Source term  Jony  FLUENT  3  January 17, 2009 17:44 
Source term  mayur  FLUENT  0  August 10, 2004 13:23 
source term  zwdi  FLUENT  2  May 26, 2004 10:34 
the source term  neil  CFX  10  July 15, 2002 17:10 
source term  fouzi  FLUENT  0  April 13, 2000 11:56 