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

Modifying buoyantBoussinesqPimpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2019, 06:28
Default Modifying buoyantBoussinesqPimpleFoam
  #1
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Hello Everyone,

Please forgive me if my question is too simple. I am very new to openFoam.

I want to modify the buoyantBoussinesqPimpleFoam solver, such that it takes into account rho0, mu, cp, k, given by me to calculate nu and Pr.

Now, I do not understand how it calculates Pr, when cp and k is missing.

I want to explicitly declare mu, rho0 and other thermo-physical properties in order to add governing equations of another physics, which I want to add with this solver.

Thank You.

With Thanks,
Pavithra.

Last edited by Pavithra; July 5, 2019 at 03:48.
Pavithra is offline   Reply With Quote

Old   June 24, 2019, 16:13
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick question: Why don't you use the solver buoyantPimpleFoam, which has full thermophysical properties and does account for buoyancy!

As for the solver you asked about, the the Pr and other properties are defined in the "transportProperties" file, e.g.: https://github.com/OpenFOAM/OpenFOAM...portProperties
Pavithra likes this.
__________________
wyldckat is offline   Reply With Quote

Old   June 26, 2019, 03:14
Default
  #3
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick question: Why don't you use the solver buoyantPimpleFoam, which has full thermophysical properties and does account for buoyancy!

As for the solver you asked about, the the Pr and other properties are defined in the "transportProperties" file, e.g.: https://github.com/OpenFOAM/OpenFOAM...portProperties
Respected Sir,

Thank you so much for your reply.

Sir, I want to use buoyantBoussinessqPimpleFoam, because, I want Boussinessq approximation in my momentum equation to account for the gravitational body force term.

Yes Sir, the physical properties are specified in the file transportProperties. But, the properties are specified in terms of nu and Pr. But I individually want to specify density, dynamic viscosity, specific heat and thermal conductivity.

Kindly, please help me in this regard.

Thank You.

With Thanks,
Pavithra.
Pavithra is offline   Reply With Quote

Old   June 26, 2019, 13:37
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
I think all the functionality you want are already implemented in the existing thermophysical model in OF.



See https://cfd.direct/openfoam/user-gui...hermophysical/
Pavithra likes this.
mAlletto is offline   Reply With Quote

Old   June 28, 2019, 00:11
Default
  #5
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
I think all the functionality you want are already implemented in the existing thermophysical model in OF.

See https://cfd.direct/openfoam/user-gui...hermophysical/
Respected Sir,

Thank you so much for your kind reply.

I am new to OpenFoam. I did not know that, I can have Boussinesq approximation in buoyantPimpleFoam. I was thinking that, in order to have Boussinesq approximation, I have to depend only on buoyantBoussinesqPimpleFoam.

Now, I have understood how I can use Boussinesq with buoyantPimpleFoam.

BTW, I am trying to couple equations for electric potential and charge conservation with the N-S equations. I know that there are some solvers already available for this. But, I am just trying to do this on my own, so that, I can have a chance to explore and learn openFoam.

Thank you once again.

With Thanks,
Pavithra.

Last edited by Pavithra; June 28, 2019 at 00:15. Reason: adjust alignment
Pavithra is offline   Reply With Quote

Old   June 30, 2019, 06:18
Default
  #6
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
I think all the functionality you want are already implemented in the existing thermophysical model in OF.



See https://cfd.direct/openfoam/user-gui...hermophysical/

Sir,

As you suggested, I tried to use buoyuantPimpleFoam. I could specify the thermophysical properties as required.

But, I face a new problem here. I get an dimension mismatch when I add the Electric equations. The dimension mismatch is due to the difference in dimensions of the velocity flux (phi) in compressible and incompressible solvers. Could you please give me a direction to overcome this problem?

Thank You.

With Thanks,
Pavithra.
Pavithra is offline   Reply With Quote

Old   June 30, 2019, 13:26
Default
  #7
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Can you post the equations you try to solve
mAlletto is offline   Reply With Quote

Old   July 1, 2019, 12:29
Default
  #8
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Thank u so much sir. I am trying to solve

I am trying to solve equations of EHD as given in

https://www.sciencedirect.com/scienc...04388615000030

I know there are existing solvers for EHD problems.

But,

1) I want to learn myself
2) I want to extend to gas discharge and phase-change problems. Hence, I want to use an incompressible solver.

Thank You so much for ur kind help.
Pavithra is offline   Reply With Quote

Old   July 1, 2019, 13:48
Default
  #9
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Unfortunately I do not have access to the paper
mAlletto is offline   Reply With Quote

Old   July 2, 2019, 00:11
Default
  #10
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
Unfortunately I do not have access to the paper

Respected Sir,


First of all, thank u so much for trying to help me.

As a first step, I want to add the Coulomb force term to the momentum equation. I am beginning with the buoyantBoussinessqPimpleFoam. I want to add the term F = qE as body force to the momentum equation.

where,
q is the charge density which is a volume scalar field of dimension [0 -3 1 0 0 1 0].

and

E is the electric field which is a volume vector field of dimension [1 1 -3 0 0 -1 0].

I have calculated q and E by solving the Poisson equation for electric potential and charge conservation equation.

Then I define
Code:
volVectorField F = q * E
.

and add this to UEqn.H as follows:


Code:
fvVectorMatrix UEqn
     (
        fvm::ddt(U) + fvm::div(phi, U)
      + MRF.DDt(U)
      + turbulence->divDevReff(U)
     ==
        fvOptions(U)
        + F
 );
I am getting a dimension mismatch error.

I am stuck at this point.


Kindly, please give me some direction to move forward.

Thank You.


With Thanks,
Pavithra.
Pavithra is offline   Reply With Quote

Old   July 2, 2019, 02:49
Default
  #11
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Respected Sir,

I just figured out that, I can make the dimension of the body force term consistent with other terms in the equation by dividing by density. Sorry, for the previous silly question.

Now I have defined F = (q*E)/den;
where,

den = 1 kgm-3

By following this approach the solver gets compiled successfully. I have started a simulation for a benchmark case, Will let u know if I am able to validate.

Please, give your comments on my approach. If it is right or should I make any changes.

Thank You.

With Thanks,
Pavithra.

Last edited by Pavithra; July 2, 2019 at 03:50.
Pavithra is offline   Reply With Quote

Old   July 2, 2019, 04:59
Default
  #12
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
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
Hey everybody,

I just want to make a clear statement which is not correct by the Thread-Starter.

Quote:
Sir, I want to use buoyantBoussinessqPimpleFoam, because, I want Boussinessq approximation in my momentum equation to account for the gravitational body force term.
What you want is the buoyancy term which is implemented in all heatTransfer solvers. However, the Boussinesq-Approximation is a simplification because the equations we are solving are incompressible (no density change). However, the approximation takes into account the density change (but only in a small range). If you have non-linear property changes, the boussinesq will give large errors.

To your qustion about adding Maxwell stuff. Start with a simpler solver which has no gravity included. This makes things easier to understand for your and limits mistakes you make. After the implementation into, e.g., pimpleFoam works, you can re-implement it to the buoyancy solver. This is just a hint. Surely, you can direct implement it into your solver.

Good luck.
Pavithra and enthusiast like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 2, 2019, 05:19
Default
  #13
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Quote:
Originally Posted by Pavithra View Post
Respected Sir,

I just figured out that, I can make the dimension of the body force term consistent with other terms in the equation by dividing by density. Sorry, for the previous silly question.

Now I have defined F = (q*E)/den;
where,

den = 1 kgm-3

By following this approach the solver gets compiled successfully. I have started a simulation for a benchmark case, Will let u know if I am able to validate.

Please, give your comments on my approach. If it is right or should I make any changes.

Thank You.

With Thanks,
Pavithra.

The approach is correct. You have to divide your force by the density since in the solver you want to use the equations are divided by the density
Pavithra likes this.
mAlletto is offline   Reply With Quote

Old   July 2, 2019, 21:25
Default
  #14
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
Hey everybody,

I just want to make a clear statement which is not correct by the Thread-Starter.



What you want is the buoyancy term which is implemented in all heatTransfer solvers. However, the Boussinesq-Approximation is a simplification because the equations we are solving are incompressible (no density change). However, the approximation takes into account the density change (but only in a small range). If you have non-linear property changes, the boussinesq will give large errors.

To your qustion about adding Maxwell stuff. Start with a simpler solver which has no gravity included. This makes things easier to understand for your and limits mistakes you make. After the implementation into, e.g., pimpleFoam works, you can re-implement it to the buoyancy solver. This is just a hint. Surely, you can direct implement it into your solver.

Good luck.
Respected Sir,
Thank you so much for pointing out. Now, I understand it clearly.
Yes Sir, as you have suggested I will start with simple solvers, then move to solvers with complex physics.
Thank You.
Pavithra is offline   Reply With Quote

Old   July 2, 2019, 21:27
Default
  #15
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
The approach is correct. You have to divide your force by the density since in the solver you want to use the equations are divided by the density

Thank you so much sir. Your inputs gave me a good direction. I am able to validate with the paper which I have posted in the previous comments.



Thank you once again.
Pavithra is offline   Reply With Quote

Old   July 4, 2019, 22:13
Default
  #16
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Respected Sir,

Based on your directions and inputs, I was able to solve the charge transport equation coupled with buoyantBoussinessqPimpleFoam. I was also able to validate my results.

As a next step, I am trying to solve a scalar transport equation coupled with buoyantPimpleFoam, which is a compressible solver.

Code:
     fvScalarMatrix rhoEEqn
     (
         fvm::ddt(rhoE)              
       + fvm::div(phi, rhoE)       
       - fvm::laplacian(a, rhoE)   
     );
     rhoEEqn.solve();
I am basically trying to add a scalar transport equation to buoyantPimpleFoam.

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).

Unfortunately, I could not find much tutorials 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, 01:31
Default
  #17
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
In the compressible solvers the equations are not divided by the density where in the incompressible they are. Probably your error comes from this. Phi in the compressible equations has an other dimension compared to the incompressible
Pavithra likes this.
mAlletto is offline   Reply With Quote

Old   July 5, 2019, 03:47
Default
  #18
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
In the compressible solvers the equations are not divided by the density where in the incompressible they are. Probably your error comes from this. Phi in the compressible equations has an other dimension compared to the incompressible

Respected Sir,

Thank you so much for your kind help. I followed your suggestion and advice of Dr. Tobias Holzmann (from my another thread) 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 6, 2019, 05:10
Default
  #19
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
I'm not sure the equation above makes much sense.



Since rhoE (at least in rhoCentralFaonm) has already the dimension of an energy [kg/m^3 * m/s^2]. I have never seen an density weighted energy equation. That is what your solving: the evolution of the density weighted energy equation.




Is this what you want to do?
mAlletto is offline   Reply With Quote

Old   July 8, 2019, 04:39
Default
  #20
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
I'm not sure the equation above makes much sense.



Since rhoE (at least in rhoCentralFaonm) has already the dimension of an energy [kg/m^3 * m/s^2]. I have never seen an density weighted energy equation. That is what your solving: the evolution of the density weighted energy equation.

Is this what you want to do?

Respected Sir,

Thank you so much for your reply.

I am solving the electrical charge conservation equation. Here, rhoE is the charge density which is a scalar of dimension [0 -3 1 0 0 1 0].

Thank You.

With Thanks,
Pavithra.
Pavithra is offline   Reply With Quote

Reply

Tags
buoyantboussinesqpimple, modify solver, openfoam v6


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
Modifying the laplacian operator mlawson OpenFOAM Running, Solving & CFD 22 July 16, 2018 04:56
Error while modifyinG reactingFoam!! sonGoku OpenFOAM Pre-Processing 0 May 27, 2018 13:57
Modifying the convection term in IcoFOAM code fluidflowsteel OpenFOAM Programming & Development 0 November 28, 2017 05:51
Modifying sonicFoam to add EM terms Alexee OpenFOAM Programming & Development 0 February 11, 2015 10:55
modifying radial distribution function ravindra FLUENT 2 September 2, 2014 14:03


All times are GMT -4. The time now is 20:55.