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/)
-   -   Adding Equations in custom solver (https://www.cfd-online.com/Forums/openfoam-programming-development/153090-adding-equations-custom-solver.html)

R_21 May 17, 2015 14:18

Adding Equations in custom solver
 
Hi Foamers,

I know this is a silly question but I would like to know how to write the following equation in Openfoam custom solver.

http://ars.els-cdn.com/content/image...01558-si16.gif

I have wrote the following line.

tmp<fvScalar> rhoCEqn
(
fvm::laplacian(epsilonR, rhoC)
== rhoC / (sqr(lamdaD) ;
);

where, epsilonR and lamdaD are constants

Regards,
Rafath

T.D. May 18, 2015 09:27

Hi,

You can do directly:

solve
(
fvm::laplacian(epsilonR, rhoC) - (rhoC / Foam::sqr(lamdaD))
);


and you must read your "lamdaD" value by defining it in your createFields.H file as the following:

dimensionedScalar lambaD
(
transportProperties.lookup("lamdaD")
);


then before lunching the simulation, you must provide the value of lamdaD in the case_Folder/constant/transportProperties
like : lamdaD lamdaD [ 0 ---- dimensions---- 0 ] its_value;

Have Fun !

T.D.

Quote:

Originally Posted by R_21 (Post 546594)
Hi Foamers,

I know this is a silly question but I would like to know how to write the following equation in Openfoam custom solver.

http://ars.els-cdn.com/content/image...01558-si16.gif

I have wrote the following line.

tmp<fvScalar> rhoCEqn
(
fvm::laplacian(epsilonR, rhoC)
== rhoC / (sqr(lamdaD) ;
);

where, epsilonR and lamdaD are constants

Regards,
Rafath


R_21 May 19, 2015 05:59

thanks a lot T.D .:)


All times are GMT -4. The time now is 07:40.