CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   An implicit source term which is a function of several cell values. (https://www.cfd-online.com/Forums/openfoam-programming-development/224778-implicit-source-term-function-several-cell-values.html)

foamnoob11 March 3, 2020 18:53

An implicit source term which is a function of several cell values.
 
Hello Foamers,

I'm trying to implement an implicit source term along the lines of fvm::Sp(coeff, f(U) ) for an

fvVectorMatrix quantity (namely U in this case) :

Code:

fvVectorMatrix UEqn (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
          ==  fvm::Sp(coeff, f(U))
);

where 'coeff' is an already defined volScalarField, f(U) --> is a vector quantity which is calculated as a weighted average (like a filter) of U from 'surrounding cells'
(this weighting calculation is done.)


Any ideas on how to implement such a source term implicitly ? (or any pointers where such a thing has been done? )

Thank you very much.
Kipri.

qi.yang@polimi.it March 4, 2020 04:45

Hi Kipri,

I am now facing the similar problem like yours.

Now I need to implement the wall shear stress for solid phase (twophaseeulerfoam) through a source term in the momentum equation. The wall shear stress can be obtained via the following formular:

Sp=Tauw=alpha1*rho1*st*(U1.component(2).boundaryFi eld ()[patchi].patchInternalField())
*(U1.boundaryField()[patchi].patchInternalField() - U1.boundaryField()[patchi])

where "st" is the friction factor which should be calculated ieratively through
for (int i=0; i<10; i++)
{
st = sqr(kappa)/Log(E*Res*sqrt(st));
}
where "Res" is the Reynolds number of solid which calculated by Res=rho1*U1.component(2).boundaryField()[patchi].patchInternalField()*y[facei]/mus

However, now I wrote the codes in the Uequation but cannot be compiled. If you have some ideas, please tell me. Thanks.


All times are GMT -4. The time now is 00:08.