|
[Sponsors] |
January 27, 2011, 12:59 |
Source Term on Scalar Transport Equation
|
#1 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
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 |
|
January 28, 2011, 06:20 |
|
#2 |
Senior Member
|
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 |
|
January 28, 2011, 06:32 |
|
#3 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
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
|
|
January 28, 2011, 06:56 |
|
#4 |
Senior Member
|
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 |
|
January 28, 2011, 08:01 |
|
#5 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
thanks a lot! I will try to fix it.
cheers, alex |
|
January 31, 2011, 04:49 |
re: Source Term on Scalar Transport Equation
|
#6 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
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 |
|
January 31, 2011, 05:52 |
|
#7 |
Senior Member
|
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 |
|
January 31, 2011, 06:04 |
|
#8 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
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 |
|
January 31, 2011, 06:19 |
|
#9 |
Senior Member
|
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 |
|
January 31, 2011, 08:56 |
|
#10 |
Member
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 16 |
thanks again for the reply!
regards, Alex |
|
|
|
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 |