CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Source Term on Scalar Transport Equation

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

Like Tree4Likes
  • 1 Post By santos
  • 1 Post By santos
  • 2 Post By santos

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2011, 12:59
Default Source Term on Scalar Transport Equation
  #1
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
Hi,

I have to add a transport scalar equation on the variable "C" but the problem is how to add the source term.

Using for instance SimpleFoam and modifying the solver I obtain the following equation for C "Ceqn.H":

solve
(
fvm::ddt(C)
+fvm::div(phi, C)
-fvm::laplacian(nu, C)
);

This is without source term and it works after I tested, including all the changes I have to do in the NewSimpleFoam.C and in createFields.H

Suppose that I want to add the sorce term with the following expression ST=C*(1-C), considering that I have to respect the dimensions in the solving, how can I set this ?

thanks in advance

alex
alessio.nz is offline   Reply With Quote

Old   January 28, 2011, 06:20
Default
  #2
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi,

You can just include your source term as 'C*(1-C)' in the Ceqn.H equation. In this way it will be defined explicitly. I am not sure if you can work out the dimensions of this source term so it is consistent with the other terms.

Probably you want the source term to be implicit for better convergence stability, so you need to include it as: 'fvm::Sp(k,C)', where k is a constant that is to be multiplied by C.

Regards,
Jose
rarnaunot likes this.
santos is offline   Reply With Quote

Old   January 28, 2011, 06:32
Default
  #3
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
Hi, thanks for the reply. If I consider the second option, implicit ST, and I write the fvm::Sp(k,C) to the Ceqn.H, do you think I should also declare the k in the createFields.H? regards alex
alessio.nz is offline   Reply With Quote

Old   January 28, 2011, 06:56
Default
  #4
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Alex,

k is a placeholder for the constants that are multiplied by C in your source term.

Hence, if your source term is 2*C, it is defined implicitly as: fvm::Sp(2,C). The Programmers Guide that comes with OpenFOAM has more information on this.

Regards,
Jose
santos is offline   Reply With Quote

Old   January 28, 2011, 08:01
Default
  #5
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
thanks a lot! I will try to fix it.

cheers,

alex
alessio.nz is offline   Reply With Quote

Old   January 31, 2011, 04:49
Default re: Source Term on Scalar Transport Equation
  #6
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
Hi I setted the equation as follows, but everytime there is an error. Do you know how can I solve it?

Actually, considering I need a source term dimensioned as [00-10000] I wrote the equation in this was, but I still don't get the error. Regards. alex


-----------------------------------

/*{CEqn.H}*\

solve
(
fvm::ddt(C)
+fvm::div(phi, C)
-fvm::laplacian(nu, C)==
fvm::ddt(C*(1-C))
);



Making dependency list for source file SourceFanzySimple.C
SOURCE=SourceFanzySimple.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/incompressible/RAS/RASModel -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/transportModels -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/transportModels/incompressible/singlePhaseTransportModel -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude -I/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/SourceFanzySimple.o
In file included from SourceFanzySimple.C:63:
Ceqn.H: In function âint main(int, char**)â:
Ceqn.H:6: error: no matching function for call to âddt(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)â
/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable âmomentumPredictorâ
/cvos/shared/apps/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable âtransonicâ
make: *** [Make/linux64GccDPOpt/SourceFanzySimple.o] Error 1
alessio.nz is offline   Reply With Quote

Old   January 31, 2011, 05:52
Default
  #7
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi,

I am not sure you can include your source term like that, ddt should be in the form ddt(C) or ddt(rho,C).

If you need: (C*(1-C))/dt, then try:

solve
(
fvm::ddt(C)
+fvm::div(phi, C)
-fvm::laplacian(nu, C)==
fvm::Sp(1-C,C)/runTime.deltaT()
);

The source term is not fully implicit, as 1-C is defined explicitly. Maybe someone else knows how to define the whole term implicit.

Regards,
Jose
solefire likes this.
santos is offline   Reply With Quote

Old   January 31, 2011, 06:04
Default
  #8
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
Thanks José!

I have also another way, just I want you to give me an opinion about it:

if I write explicitly the ST as (C*a*(1-C)) where "a" has the dimension of [1/time] to keep the dimension in the parabolic equation, setted in the transportproperties, do you think is it reasonable?
cheers,alex
alessio.nz is offline   Reply With Quote

Old   January 31, 2011, 06:19
Default
  #9
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Actually I have used in the past a 'quick and dirty' trick that allows you to do just that:
sourceTerm = (1-C)*C*runTime.deltaT().value()/runTime.deltaT();

Therefore, you get the correct dimension, without needing to care about the deltat value.

Regards,
Jose
sharonyue and rarnaunot like this.
santos is offline   Reply With Quote

Old   January 31, 2011, 08:56
Default
  #10
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 15
alessio.nz is on a distinguished road
thanks again for the reply!

regards,

Alex
alessio.nz is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solve poisson equation just add a source term nandiganavishal OpenFOAM Running, Solving & CFD 18 November 14, 2022 10:12
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
Transport Equation for a scalar - Compressible Solver alessio.nz OpenFOAM Programming & Development 5 April 11, 2013 10:04
How to deal with this energy equation source term? H.S.Fang FLUENT 2 December 27, 2001 07:42


All times are GMT -4. The time now is 23:00.