Source Term on Scalar Transport Equation
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*(1C), considering that I have to respect the dimensions in the solving, how can I set this ? thanks in advance alex 
Hi,
You can just include your source term as 'C*(1C)' 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 
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

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 
thanks a lot! I will try to fix it.
cheers, alex 
re: Source Term on Scalar Transport Equation
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 [0010000] 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*(1C)) ); Making dependency list for source file SourceFanzySimple.C SOURCE=SourceFanzySimple.C ; g++ m64 Dlinux64 DWM_DP Wall Wextra Wnounusedparameter Woldstylecast Wnonvirtualdtor O3 DNoRepository ftemplatedepth40 I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/turbulenceModels I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/turbulenceModels/incompressible/RAS/RASModel I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/transportModels I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/transportModels/incompressible/singlePhaseTransportModel I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/finiteVolume/lnInclude IlnInclude I. I/cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/OpenFOAM/lnInclude I/cvos/shared/apps/OpenFOAM/OpenFOAM1.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/OpenFOAM1.7.1/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable âmomentumPredictorâ /cvos/shared/apps/OpenFOAM/OpenFOAM1.7.1/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable âtransonicâ make: *** [Make/linux64GccDPOpt/SourceFanzySimple.o] Error 1 
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*(1C))/dt, then try: solve ( fvm::ddt(C) +fvm::div(phi, C) fvm::laplacian(nu, C)== fvm::Sp(1C,C)/runTime.deltaT() ); The source term is not fully implicit, as 1C is defined explicitly. Maybe someone else knows how to define the whole term implicit. Regards, Jose 
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*(1C)) 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 
Actually I have used in the past a 'quick and dirty' trick that allows you to do just that:
sourceTerm = (1C)*C*runTime.deltaT().value()/runTime.deltaT(); Therefore, you get the correct dimension, without needing to care about the deltat value. Regards, Jose 
thanks again for the reply! :)
regards, Alex 
All times are GMT 4. The time now is 20:51. 