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

Simplifying equation help

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Tobermory
  • 2 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 17, 2021, 12:51
Default Simplifying equation help
  #1
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Hello.

I need some guidance with writing equations in my header file.

I am working on electrohydrodynamic (EHD) solver that uses interFoam+electrostatics elements (http://openfoamwiki.net/index.php/Co...ectromagnetics)

As you can see from the above link, the third equation that is the charge conservation equation is written as (the two equations are the same where 1st one is used in the link above and the other one is the same but written using different variables).
Screenshot 2021-02-17 174400.png

In my header file, I have written
Code:
        tmp<fvScalarMatrix> ECDEqn
        (
            fvm::ddt(rhoE) 
          - fvc::laplacian(sgm, Ue)
          + fvm::div(phi, rhoE)
        );

        solve(ECDEqn);
However, I have read an article [1] that simplifies this equation into:Screenshot 2021-02-17 173711.png
where K is equivalent to the previous equation's sigma.

I have tried rewriting my header file equation but only this seems to be working. Is it correct?
Code:
        tmp<fvScalarMatrix> ECDEqn
        (
          fvm::laplacian(sgm, Ue)

        );

        solve(ECDEqn);
I tried many ways including solve(ECDEqn == 0) but was unsuccessful.

Can someone guide me on how to write the simplified equation?

Many thanks


[1] https://iopscience.iop.org/article/1...17/23/1/015004
Attached Images
File Type: png 321859f6e5e148c268a9ea71eff9e8e4.png (1.4 KB, 7 views)

Last edited by mcfdma; February 18, 2021 at 02:45.
mcfdma is offline   Reply With Quote

Old   February 18, 2021, 16:43
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Umm ... I am struggling to relate your coding to your equations. Just for clarity:
Code:
        tmp<fvScalarMatrix> ECDEqn
        (
            fvm::ddt(rhoE) 
          - fvc::laplacian(sgm, Ue)
          + fvm::div(phi, rhoE)
        );

        solve(ECDEqn);
translates into the following:
\frac{\partial \rho_E}{\partial t} - \nabla \cdot (\sigma \nabla U_e) + \nabla 
\cdot (\rho U \rho_E)

or perhaps the following if the code takes an incompressible flow approach (\rho=1):
\frac{\partial \rho_E}{\partial t} - \nabla \cdot (\sigma \nabla U_e) + \nabla 
\cdot (U \rho_E)

which is probably not what you are after ... or is it? If not, then it's probably a good idea to read up on the meaning of laplacian & div. Good luck my friend.
Tobermory is offline   Reply With Quote

Old   February 19, 2021, 02:55
Default
  #3
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Many thanks for your reply. Yes, I am aware of laplacian and divergence.

I believe I made a blunder mistake in writing my second equation (Apologies):

\frac{\partial \rho_E}{\partial t}+\nabla \cdot \vec{J} =0

and \vec{J} = \rho_E \vec{u} + \sigma \vec{E}

\frac{\partial \rho_E}{\partial t}+\nabla \cdot (\rho_E \vec{u}) + \nabla \cdot (\sigma \vec{E}) = 0

Using Gauss Law \nabla \cdot (\varepsilon \vec{E}) = \rho_E along with \vec{E} = -\nabla Ue

I get,

\frac{\partial \rho_E}{\partial t}+\nabla \cdot \rho_E u - \nabla \cdot (\sigma \nabla Ue) = 0

Code:
 tmp<fvScalarMatrix> ECDEqn
        (
            fvm::ddt(rhoE) 
          + fvm::div(phi, rhoE)
          - fvc::laplacian(sgm, Ue)
        );

        solve(ECDEqn);
which is equivalent to the below equation EHDFoam (equation 3 within the link),

\frac{\partial \rho_E}{\partial t}+\nabla \cdot \rho_E u = -\frac{\sigma}{\varepsilon}\rho_E

Have I done anything wrong? I have been getting appropriate results but wanted to implement this simplified part,

\nabla . (\sigma \vec{E})= 0

to observe the change but wanted to know if what I had written was correct.

Code:
        tmp<fvScalarMatrix> ECDEqn
        (
          fvm::laplacian(sgm, Ue)

        );

        solve(ECDEqn);
This was the only success but not sure changing it from fvc to fvm is right. Any suggestions? Many thanks in advance
mcfdma is offline   Reply With Quote

Old   February 19, 2021, 04:12
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Aaah - that makes sense now, and yes your coding looks good to me.

In case you are interested, the difference between fvm and fvc is subtle: fvm builds the matrix coefficients for an implicit representation of the term (i.e. expresses the equation in terms of the variable at the new time step), whilst fvc uses an explicit representation (using old time values only) ... so it makes sense that at least one of your terms in the fvMatrix must be an implicit (fvm) term.
tonnykz likes this.
Tobermory is offline   Reply With Quote

Old   February 19, 2021, 04:18
Default
  #5
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Thanks for the quick fvm and fvc explanation.

Could I double check when you say my coding looks okay, do you mean the original equation with 3 terms or the simplified one or all of them?
mcfdma is offline   Reply With Quote

Old   February 19, 2021, 04:22
Default
  #6
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Both look fine to me - did they compile and run okay?
Tobermory is offline   Reply With Quote

Old   February 19, 2021, 04:29
Default
  #7
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Thanks for the quick response, much appreciated.

Yes, it does compile alright but since the original equation has now been simplified, I have run a case but there has been no charge density \rho_E at that surface of the fluid. I am left confused which is why I posted thinking I made a mistake in my coding.

Would it be possible for you to have a quick look at my solver?
mcfdma is offline   Reply With Quote

Old   February 19, 2021, 04:54
Default
  #8
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
By all means, I can take a look at your code, although it has been 30yrs or so since I did my course on electromagnetism!

I would suggest checking your logic first, though. Note that your second (simplified) equation just calculates a divergence-free E field, but you stated earlier that:
\rho_E = \nabla \cdot (\varepsilon \vec{E}) \approx \varepsilon \nabla \cdot \vec{E}=0
and so does this not constrain the charge density \rho_E to zero? Perhaps I am missing something.

Note also that I am assuming that variables \varepsilon and \sigma are constants, since you are moving them inside and outside of the integrals.
Tobermory is offline   Reply With Quote

Old   February 19, 2021, 05:19
Default
  #9
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Thank you very much 30 years? wow, that's amazing!

This part is correct
\rho_E = \nabla \cdot (\varepsilon \vec{E}) \approx \varepsilon \nabla \cdot \vec{E}

but your equation ending with equals to 0 should be for the simplified equation including conductivity \nabla . (\sigma \vec{E})= 0
This above equation is the leaky-dielectric model.

I have created a dropbox link that contains my actual solver (not the leaky-dielectric model).

You are absolutely correct, I am assuming these 2 parameters \varepsilon and \sigma constant along with the surface tension at the interface.
mcfdma is offline   Reply With Quote

Old   February 19, 2021, 07:23
Default
  #10
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
I am probably missing something here, but let me try reiterating my above point. We start with the charge conservation equation:

\frac{\partial \rho_E}{\partial t}+\nabla \cdot (\rho_E \vec{u}) + \nabla \cdot (\sigma \vec{E}) = 0

\frac{D \rho_E}{D t}= -\nabla \cdot (\sigma \vec{E})

where D/Dt is the material derivative since the fluid is incompressible; and then you want to set:

\nabla \cdot(\sigma E) = 0

which means that:

\frac{D \rho_E}{D t}= 0

i.e. the charge density field will be unchanging, or at least is just convected through the domain if the inlet boundary boundary value is non-zero.

Indeed, looking briefly at your EHDEqn.H code, the ECDEqn is where the rhoE value is calculated/updated and so if you change this to your new, simplified version of the equation then where is rhoE calculated now? It is probably just remaining at its initial field definition. You would need to add another expression to calculate rhoE from the electric field since the EHD equation no longer solves for rhoE.

Does that explain why you are not seeing any charge density when you use this simplified version?

I don't have access to the paper that you referenced at the start, nor to your model BCs, but I would suggest thinking again about those to make sure that the simplified equation makes sense for your application, and that your BCs are correct. Good luck.
tonnykz and mcfdma like this.
Tobermory is offline   Reply With Quote

Reply

Tags
ehd, ehdfoam, electrospray


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
Solving coupled steady and unsteady equation in OpenFOAM jd87 OpenFOAM Running, Solving & CFD 2 July 22, 2020 11:36
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Some problem of "Qcriterion.mcr& yuyuxuan Tecplot 9 February 12, 2016 03:27
Need help:about energy equation in CFX Stein CFX 4 July 2, 2009 22:31
Diffusion Equation izardy amiruddin Main CFD Forum 2 July 4, 2002 08:14


All times are GMT -4. The time now is 03:24.