CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Adding a scalar transport equation to buoyantPimpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By Tobi
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2019, 23:44
Default Adding a scalar transport equation to buoyantPimpleFoam
  #1
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
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.
Pavithra is offline   Reply With Quote

Old   July 5, 2019, 04:15
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 5, 2019, 04:43
Default
  #3
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by Tobi View Post
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.
Pavithra is offline   Reply With Quote

Old   July 16, 2019, 06:52
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Pavithra View Post
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 likes this.
olesen is offline   Reply With Quote

Old   July 16, 2019, 06:57
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 18, 2019, 04:25
Default
  #6
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
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 is offline   Reply With Quote

Old   July 22, 2019, 23:20
Default
  #7
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
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.
Pavithra is offline   Reply With Quote

Reply

Tags
buoyantpimplefoam, compressible flow, dimension, scalar transport


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding 1D scalar transport equation phani45 OpenFOAM Running, Solving & CFD 0 September 3, 2017 21:56
adding a constant volumetric source term to transport equation in a particular region cfdonline2mohsen OpenFOAM Programming & Development 15 February 16, 2017 10:55
using a Fortran library of thermodynamics inside sutherland transport model Mehdi3031 OpenFOAM Programming & Development 0 April 7, 2016 10:34
Issue symmetryPlane 2.5d extruded airfoil simulation 281419 OpenFOAM Running, Solving & CFD 5 November 28, 2015 14:09
Problem diverges: Scalar transport equation, variable: Species transport, material shahrbanoo AVL FIRE 0 July 24, 2014 09:52


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