adding plasma source term to continuity equation

Numerical methods and mathematical models of Elmer
Post Reply
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

adding plasma source term to continuity equation

Post by spacedout »

Hello again

the continuity equation is

d/dt (rho) + div (rho* velocity) = 0

but because of a plasma model, I have to replace the RHS ( 0 as shown above) by a field variable ( call it S for source)

I am only guessing that this code would have to reside in file NavierStokes.F90 fairly close to the end of subroutine NavierStokesCompose

right after some comments:

!------------------------------------------------------------------------------
! The righthand side...
!------------------------------------------------------------------------------
!

Perhaps somebody can shed some light on this new feature.

Thanks for viewing
mika
Posts: 230
Joined: 15 Sep 2009, 07:44

Re: adding plasma source term to continuity equation

Post by mika »

Hi,

By a quick inspection it seems that creating a source term S for the continuity equation would require at least a small change of the code. If the nodal values of the source term would be inserted to the fourth row of the calling argument LoadVector of the subroutine NavierStokesCompose in FlowSolve.F90, then this subroutine would generate a source for the continuity equation. I'm assuming a 3D simulation here. Now LoadVector(4,:) is zero at the calling time, since the keyword "Flow Bodyforce i" is read only in the case of i=1,2,3.

-- Mika
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: adding plasma source term to continuity equation

Post by spacedout »

Sounds very reasonable to me.

But what it is the meaning of the following in subroutine NavierStokesCompose ?

! The relative change in temperature is the source term
! for continuity equation.
!------------------------------------------------------
IF ( Compressible .AND. Cmodel==PerfectGas1 ) THEN
Force(c) = Force(c) / Temperature
END IF


By definition the general continuity equation does not depend on temperature and on the kind of gas (e.g. perfect, compressible) and moreover, Force(c) is always 0. (of course, excluding my plasma case, when i say general)

Regards,

Marc
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: adding plasma source term to continuity equation

Post by raback »

Hi Marc,

Didn't look at the line of code but I would guess the primitive variable to be solved is velocity field, not flow rate which might be favourable for compressible flows. The 1st implementation was probably for incompressible flows. Assuming different types of density functions the continuity equation may give rise to some additional terms.

-Peter
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: adding plasma source term to continuity equation

Post by spacedout »

If one looks at a standard reference text like Compressible Flows by Anderson and more specifically at chapter 6 entitled

Differential Conservation Equations for Inviscid Flows

the mass , momentum and energy equations can be written in conservation (flow variable) form or equivalently in non-conservation form (primitive variable) form

More specifically, the mass (continuity) equation can be written either as

d/dt (rho) + div(rho*V) = 0 (conservative form - here d/dt is the standard derivative)

or as

D/Dt (rho) + rho*div(V) = 0 (primitive variable form - here D/Dt is the substantial derivative)

And, either way, the equation does not involve temperature and in fact does not care about the nature of a gas consisting of neutral particles.

So it would seem to me that the code in subroutine NavierStokesCompose that was mentioned previously, must somehow refer to something else than the continuity equation, contrary to what the associated comment purport it to be.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: adding plasma source term to continuity equation

Post by raback »

Hi

I agree with: D/Dt (rho) + rho*div(V) = 0.

We now have pressure as primitive variable and rho is proportional to p/T (for ideal gas). Hence after some algebra we have

-p/T^2 DT/Dt + 1/T Dp/Dt + (p/T)*div(V) = 0.
<=>
(1/p)*Dp/Dt + div(V) = (1/T)*DT/Dt

Here dT/dt is approximated from solution of the HeatSolver and passed on to this module. I did not write this but I would think this is roughly the background. Note that this is related to just one formulation "IdealGas1" and there are others. Unfortunately I cannot say much about the relative merits of each formulation here.

-Peter
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: adding plasma source term to continuity equation

Post by spacedout »

It had already occurred to me some weeks ago that one could transform

d/dt (rho) + div(rho*V) = 0

using any equation of state f(rho, pressure, temperature) = 0
and some juggling with Leibnitz's rule of differentiation

to a continuity equation that would involve pressure and temperature instead of rho.

However, I had discarded this thought because I could not believe the code was written in such a seemingly round about fashion. Well, I guess I am once more proven wrong. End of story. Thread closed.

Thanks for the tip anyways,

Marc
Post Reply