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/)
-   -   How to multiply volScalarField and fvScalarMatrix ? (https://www.cfd-online.com/Forums/openfoam-programming-development/232113-how-multiply-volscalarfield-fvscalarmatrix.html)

Fauster November 30, 2020 11:17

How to multiply volScalarField and fvScalarMatrix ?
 
Dear Foamers,

I am interested in multiplying or dividing a fvScalarMatrix by a volScalarField.
In a case of a fvc operator like fvc::div or fvc::laplacian the code compiles.

For example :
Quote:

volScalarField alpha(...);
Quote:

fvc::laplacian(d,T)/alpha
-> ok for compilation

Unfortunately when it comes to implicit operator (fvm) the code doesn't compile :

Quote:

fvm::laplacian(d,T)/alpha
-> ERROR at compilation

How can we solve this issue ? Am I asking something unrealistic ? In a pure mathematical way it makes sense. But OpenFOAM doesn't seem to like it.

All help would absolutely be helpful.

F

Onurb December 1, 2020 13:10

Hello Fauster,

laplacian is misspelled.

Fauster December 2, 2020 04:57

Quote:

Originally Posted by Onurb (Post 789483)
Hello Fauster,

laplacian is misspelled.

Sorry Onurb. I made a mistake when writing the text but in the code this is
Quote:

laplacian
.

I can copy paste the message error at compilation but for me it's like this is not authorized by OpenFOAM.
For example if you try to do something like fvc::interpolate(surfaceScalarField).

CorbinMG December 14, 2022 11:29

Dear Fauster,

I had same problem as you. It seems if you switch the order of multiplication, it works OK. That is volScalarField*fvScalarMatrix IS possible. But, fvScalarMatrix*volScalarField gives compilation error:

Code:

volScalarField rhoCp1 = rho1*alpha1*mixture.thermo1().Cp() + rho2*alpha2*mixture.thermo2().Cp();
fvScalarMatrix eEqn
(
rhoCp1*fvm::ddt(T)        //  compiles OK!
//fvm::ddt(T)*rhoCp1      //  gives compilation error!
==
fvOptions(rhoCp1, T)
);



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