
[Sponsors] 
July 11, 2013, 11:43 
How does 'solve' work?

#1 
Senior Member
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 6 
Dear Foamers,
Could anybody explain how the 'solve' work? Is there any difference between the following approaches concerning the Source term for a passive scalar? The first one includes the SourceC in the solve equation as follows: .... solve ( fvm::ddt(C) + fvm::div(phi, C)  fvm::laplacian(turbulence>nut()/0.72, C) == SourceC ); .... The second one excludes the SourceC in the solve equation, but then add this SourceC to C as two subcycles for each time step: ....... solve ( fvm::ddt(C) + fvm::div(phi, C)  fvm::laplacian(turbulence>nut()/0.72, C) == ); // two subcycles C=C+SourceC*0.5*runTime.deltaT(); C=C+SourceC*0.5*runTime.deltaT(); ......... My best regards, Jian 

July 22, 2013, 05:18 

#2 
Member
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 8 
Hi, zxj160.
solve(fvScalarMatrix) just solves system of linear algebraical equations: A_p*C_p = sum over all neighbours (A_nb * C_nb) + source_p. In first case you solve for C being affected by source term. This means that C_p is influenced by C_nb (neighbour) already changed by source. In second case you solve for C without source influence on neighbours, which will be taking into account only on next time step. First, consider explicit equal source, not depending of C variable. My guess is that if you use just diffusive fluxes without upwinding interpolation for your scalar transport, you always will get same results for your C. Because diffusive flux is difference between adjacent values ((c_i + dc)(c_(i+1)+dc) = (c_i  c_(i+1))). In other cases (nonequal source in whole domain, upwinding interpolations, convective fluxes, implicit source, etc.) you will get different results. In nutshell, always put all your sources in one solve() which gives you better coupling between parts of equation and better compatibility of your difference equation with an original differential equation. 

July 26, 2013, 06:19 

#3 
Senior Member
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 6 
Hi Artem,
Many thanks for your reply. I use the second method since the solve() takes more computational cost than the direct assignment. If I use the first method (i.e. put all my sources terms into one solver) with the same deltaT as the subcylce time step of the second method, the computational time is unaffordable for me. So do you think that there is any other way to achieve this with less computational cost? My best regards, Jian 

July 26, 2013, 06:55 

#4 
Member
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 8 
hello, zxj160.
Just out of curiosity, why you use "two subcycles" in second method instead of one with whole deltaT? A process you solve is steadystate or transient? May be you should lower time step with second method if a process is transient? Can you compare results of simulations with second method but with different timesteps? To tell the truth, I've never used to play with source terms. But I met interesting method for stabilisation (it may be useful for you): libOpenSMOKE post #125 by Tobias Holzmann. 

Tags 
solve source term 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Transient postprocessing, Time averaged pressure work  Turbomachine  CFX  1  January 3, 2011 18:01 
Does anyone work with curl in OpenFoam  evgenii  OpenFOAM Running, Solving & CFD  8  October 15, 2010 11:30 
A doubt on solve  srinath  OpenFOAM Running, Solving & CFD  10  April 12, 2009 04:26 
Is there any functionality of OpenFOAM to solve multiblock domain without merging the domain  swlee  OpenFOAM Running, Solving & CFD  4  January 23, 2008 13:18 
msha solve Eqn programming in C using FOAM  msha  OpenFOAM  2  December 30, 2007 03:39 