CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   problem with gradient as source term in coupled equations (http://www.cfd-online.com/Forums/openfoam-programming-development/79201-problem-gradient-source-term-coupled-equations.html)

Cyp August 16, 2010 13:12

problem with gradient as source term in coupled equations
 
Hi!

I am trying to implement the following equations in OpenFOAM. There are nspecies resolution of these coupled equations according to the number of species in the system.

http://img148.imageshack.us/img148/6...reenshot1v.png


I have a problem with the implementation of the A-species evaporation rate. There is an error when compiling the code because of the gradient terms in the calculation of Sevap[i].


Code:

// Species transport calculation

for (int i=0; i<= nspecies; i++)
{

    volScalarField& Y_beta_i  = Y_beta[i];
    volScalarField& Y_gamma_i = Y_gamma[i];   
   
    Sevap[i]  = U_gamma_beta[i] & fvc::grad(Y_gamma_i) -U_beta_gamma[i] & fvc::grad(Y_beta_i) - alpha[i]*(H[i]*Y_gamma_i-Y_beta_i);

    mass_evap += Sevap[i];

    solve
    (
        fvm::ddt(eps_beta*rho_beta, Y_beta_i)
      + fvm::div(phi_beta, Y_beta_i)
    ==
        fvm::laplacian(eps_beta*rho_beta*D_beta_beta[i] , Y_beta_i)
      + fvm::laplacian(eps_beta*rho_beta*D_beta_gamma[i], Y_gamma_i)
      + Sevap[i]
    );

    solve
    (
        fvm::ddt(eps_gamma*rho_gamma, Y_gamma_i)
      + fvm::div(phi_gamma, Y_gamma_i)
    ==
        fvm::laplacian(eps_gamma*rho_gamma*D_gamma_gamma[i], Y_gamma_i)
      + fvm::laplacian(eps_gamma*rho_gamma*D_gamma_beta[i] , Y_beta_i)
      - Sevap[i]
    );
}

Here the velocity-like coefficients U_beta_gamma and U_gamma_beta are declared as

Code:

    PtrList<dimensionedVector> U_gamma_beta(nspecies);
    PtrList<dimensionedVector> U_beta_gamma(nspecies);

Do you have any suggestion ??


Moreover, I saw that there is a FvCoupledScalarMatrix class existing. Do you think it is useful in my case or the sequential method can be sufficient enough ?


Regards,
Cyp


All times are GMT -4. The time now is 16:30.