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 a scalar transport equation to buoyantPimpleFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/218817-adding-scalar-transport-equation-buoyantpimplefoam.html)

Pavithra July 4, 2019 22:44

Adding a scalar transport equation to buoyantPimpleFoam
 
Hello Everyone,

I am trying to add a scalar transport equation to buoyantPimpleFoam, which is a compressible solver.
Code:

    fvScalarMatrix rhoEEqn
    (
        fvm::ddt(rhoE)             
      + fvm::div(phi, rhoE)     
      - fvm::laplacian(a, rhoE) 
    );
    rhoEEqn.solve();

I get the following dimension mismatch error.
Code:

  --> FOAM FATAL ERROR:
incompatible dimensions for operation
    [rhoE[0 -3 0 0 0 1 0] ] + [rhoE[1 -6 0 0 0 1 0] ]

    From function void Foam::checkMethod(const  Foam::fvMatrix<Type>&, const Foam::fvMatrix<Type>&,  const char*) [with Type = double]
    in file /home/user/OpenFOAM/OpenFOAM-6/src/finiteVolume/lnInclude/fvMatrix.C at line 1283.

In order find out the source of error, I ran the simulation by neglecting the terms in scalar transport equation, one by one.

The error pops up when the divergence term is included.

I was able to successfully add this scalar equation to buoyantBoussinesqPimpleFoam (incompressible solver).

The dimension of rhoE is [0 -3 1 0 0 1 0]

Does adding a scalar transport equation to a compressible solver, need any special modification?

Is the dimension of phi different in a compressible sovler?

Unfortunately, I could not find any tutorial on adding a scalar transport equation to a compressible solver.

Kindly, please give me a direction in solving this.

Thank You.

With Thanks,
Pavithra.

Tobi July 5, 2019 03:15

Hi,

if you have a passive scalar transport equation the general equation is:

\frac{\partial \rho \phi}{\partial t} + \nabla \bullet (\rho \textbf{U} \phi) = S_\phi

Thus, the time derivative in FOAM should have the following:
Code:

fvm::ddt(rho, rhoE)
The unit mismatch is based on the missing density.

Pavithra July 5, 2019 03:43

Quote:

Originally Posted by Tobi (Post 738047)
Hi,

if you have a passive scalar transport equation the general equation is:

\frac{\partial \rho \phi}{\partial t} + \nabla \bullet (\rho \textbf{U} \phi) = S_\phi

Thus, the time derivative in FOAM should have the following:
Code:

fvm::ddt(rho, rhoE)
The unit mismatch is based on the missing density.


Respected Sir,


Thank you so much for your kind help. I followed your advice and defined the scalar transport equation as below

Code:

    fvScalarMatrix rhoEEqn
    (
        fvm::ddt(rho, rhoE)                //Time derivative
      + fvm::div(phi, rhoE)        //Convective term
      - fvm::laplacian(a*rho, rhoE)    //Diffusive Term
    );
      rhoEEqn.solve();

Now, I am able to successfully run the simulation and validate the solver.


Thank You.

With Thanks,
Pavithra.

olesen July 16, 2019 05:52

Quote:

Originally Posted by Pavithra (Post 738031)
Hello Everyone,

I am trying to add a scalar transport equation to buoyantPimpleFoam, which is a compressible solver.


What about using the scalarTransport functionObject instead?

Tobi July 16, 2019 05:57

Hi Mark,


the function object is a possible and very easy option, I agree. Also the fields should be available during run-time while you can lookup the quantity and re-use it whereever you want.


Crazy how powerful the function objects are.

Pavithra July 18, 2019 03:25

Respected Prof. Mark Olesen,

Thank you so much for your suggestion. I am very new to OpenFoam. Could you please give me some direction for me to learn about functionObjects. I am interested in learning about that and solve a scalar transport equation using fucntionObject.

Thank You.

With Thanks,
Pavithra.

Pavithra July 22, 2019 22:20

Hello Everyone,

I tried to use functionObject to solve a scalar transport equation as suggested by Dr. Mark Olesen. I was able to do it successfully.

Now I have a transport equation, which has two convective fluxes. I am puzzled, if I can solve this using functionObject. My base solver is buoyantPimpleFoam and I use OF v6.

My transport equation is

\frac{\partial \phi}{\partial t} + \nabla \bullet (\textbf{U} \phi)   + \nabla \bullet (\textbf{A} \phi) - \alpha \nabla^2 \phi = 0

Here,

\phi - Electric charge density
\textbf{U} - velocity
\textbf{A} - flux field defined by user
\alpha - Diffusion coefficient

Kindly, please give me a direction to solve this.

I want to define a source term which is dependent on this scalar (\phi).

Thank You.


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