CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Source term

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 23, 2006, 10:35
Default I fell some trouble to impleme
  #1
Member
 
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 7
chris1980 is on a distinguished road
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?
chris1980 is offline   Reply With Quote

Old   June 23, 2006, 12:52
Default the main problem is the realis
  #2
Member
 
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 7
chris1980 is on a distinguished road
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?
chris1980 is offline   Reply With Quote

Old   June 23, 2006, 12:54
Default ups there is type volScalar
  #3
Member
 
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 7
chris1980 is on a distinguished road
ups there is type

volScalarField gradXiVar2 = fvc::grad(XiVar) & fvc::grad(XiVar)
chris1980 is offline   Reply With Quote

Old   June 23, 2006, 13:25
Default You've just for the the wrong
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,728
Rep Power: 20
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   June 24, 2006, 02:08
Default thanks Hrv! just to make su
  #5
Member
 
chris book
Join Date: Mar 2009
Posts: 85
Rep Power: 7
chris1980 is on a distinguished road
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?
chris1980 is offline   Reply With Quote

Old   June 24, 2006, 04:20
Default Sorry, my fault: it should (of
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,728
Rep Power: 20
hjasak will become famous soon enough
Sorry, my fault: it should (of course) be fvm::Sp(C2*epsilon/k*rho, Xi)

Hrv
__________________
Hrvoje Jasak
hjasak is offline   Reply With Quote

Old   August 14, 2007, 07:08
Default Hi everybody When i add a s
  #7
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 7
marhamat is on a distinguished road
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
marhamat is offline   Reply With Quote

Old   August 14, 2007, 10:49
Default The definition of Fi is inside
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
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

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.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   August 25, 2007, 04:18
Default Hello everybody After running
  #9
New Member
 
morteza
Join Date: Mar 2009
Posts: 18
Rep Power: 7
morteza is on a distinguished road
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
morteza is offline   Reply With Quote

Old   August 25, 2007, 07:18
Default Hi guys I send the above mes
  #10
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 7
marhamat is on a distinguished road
Hi guys
I send the above message with my friend.
So anything is right.
sorry for disturbing you

Marhamat
marhamat is offline   Reply With Quote

Old   August 27, 2007, 06:04
Default Ideas are welcome.(-: Thanks
  #11
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 7
marhamat is on a distinguished road
Ideas are welcome.(-:
Thanks alot
marhamat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 01:08.