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

How does 'solve' work?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2013, 11:43
Default How does 'solve' work?
  #1
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
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 sub-cycles for each time step:
.......
solve
(
fvm::ddt(C)
+ fvm::div(phi, C)
- fvm::laplacian(turbulence->nut()/0.72, C)
==
);
// two sub-cycles
C=C+SourceC*0.5*runTime.deltaT();
C=C+SourceC*0.5*runTime.deltaT();
.........


My best regards,
Jian
zxj160 is offline   Reply With Quote

Old   July 22, 2013, 05:18
Default
  #2
Member
 
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 16
ARTem is on a distinguished road
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 (non-equal 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.
ARTem is offline   Reply With Quote

Old   July 26, 2013, 06:19
Default
  #3
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
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
zxj160 is offline   Reply With Quote

Old   July 26, 2013, 06:55
Default
  #4
Member
 
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 16
ARTem is on a distinguished road
hello, zxj160.
Just out of curiosity, why you use "two sub-cycles" in second method instead of one with whole deltaT?
A process you solve is steady-state 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):
http://www.cfd-online.com/Forums/ope...ensmoke-7.html post #125 by Tobias Holzmann.
ARTem is offline   Reply With Quote

Reply

Tags
solve source term


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
Does anyone work with curl in OpenFoam evgenii OpenFOAM Running, Solving & CFD 10 January 23, 2020 04:14
Transient post-processing, Time averaged pressure work Turbomachine CFX 1 January 3, 2011 17:01
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 12:18
msha solve Eqn programming in C using FOAM msha OpenFOAM 2 December 30, 2007 02:39


All times are GMT -4. The time now is 05:09.