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

Different ways to treat source terms of an additional transport equation in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   December 23, 2021, 19:48
Default Different ways to treat source terms of an additional transport equation in OpenFOAM
  #1
New Member
 
Join Date: Jan 2015
Posts: 22
Rep Power: 11
adib_mohammad is on a distinguished road
I have created a modified solver based on simpleFoam and called it twosimpleFoam. I added one scalar tranport equation to track number density of particles (N_{agg}) in a laminar flow.
Below is the transport equation I am trying to solve.

\frac{\partial N_{agg}}{\partial t}+\frac{\partial}{\partial x_i} (u_i. N_{agg}-D.\frac{ \partial N_{agg}}{\partial x_i\ })=-\frac{1}{2}\beta. N_p^2\ .Av.\rho_{gas}

I have created "NEqn.H" file similar and included it in twosimpleFoam.C. I have two versions of "NEqn.H". The only difference how I solve the source source term.
The first one ends up with "core dump", but second one converges. I don't understand which one is the correct way to solve this equation and how these two implementations are different.

First Implementation (DIVERGES!):

Code:
{
    fvScalarMatrix NEqn
    (
        fvm::ddt(N_agg)
        + fvm::div(phi, N_agg)
        - fvm::laplacian(diff_prefactor*diff_p, N_agg)
    ==
        -fvm::Sp(0.5 * beta * N_agg * Av * rho, N_agg))

    );

    NEqn.relax();
    fvOptions.constrain(NEqn);
    NEqn.solve();
    fvOptions.correct(N_agg);
}
Second Implementation (CONVERGES!):

Code:
{
    fvScalarMatrix NEqn
    (
        fvm::ddt(N_agg)
        + fvm::div(phi, N_agg)
        - fvm::laplacian(diff_prefactor*diff_p, N_agg)
    ==
        fvOptions(N_agg)

    );

    NEqn.relax();
    fvOptions.constrain(NEqn);
    solve(NEqn == -fvm::Sp(0.5 * beta * N_agg * Av * rho, N_agg));
    fvOptions.correct(N_agg);
}
adib_mohammad is offline   Reply With Quote

 

Tags
scalar transport, 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
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 18:13
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 06:42
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18
emag beta feature: charge density charlotte CFX 4 March 22, 2011 09:14


All times are GMT -4. The time now is 13:25.