# Source term

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 23, 2006, 10:35 I fell some trouble to impleme #1 Member   chris book Join Date: Mar 2009 Posts: 85 Rep Power: 8 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: 8 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: 8 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,753 Rep Power: 21 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: 8 thanks Hrv! just to make sure I get you right: I want to solve a Xi-eqn and the problem is to implement the following source terms C1*[grad(XXi)]^2 - C2*Xi the first term I already know from the XXi-Eqn 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,753 Rep Power: 21 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: 8 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 -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/marhamat/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/marhamat/OpenFOAM/OpenFOAM-1.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,894 Rep Power: 26 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 live DVD/USB, hard drive image and virtual image. OpenQBMM - An open-source implementation of quadrature-based moment methods

 August 25, 2007, 04:18 Hello everybody After running #9 New Member   morteza Join Date: Mar 2009 Posts: 18 Rep Power: 8 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: 8 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: 8 Ideas are welcome.(-: Thanks alot

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

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

All times are GMT -4. The time now is 13:39.