Re: Fluid Dynamic Basics

2019-09-04 Thread Daniel DeSantis
Thanks Daniel. I have to admit, I'm a bit surprised that these types of
problems are a challenge in FiPy, but I appreciate the information.

On Thu, Aug 29, 2019 at 3:06 PM Daniel Wheeler 
wrote:

> Hi Daniel,
>
> Solving the flow equations isn't easy and we certainly don't provide
> much guidance on how to solve them with FiPy. We do have the Stokes
> cavity example [1] and reactive wetting example [2], which might be a
> good place for you to start. The Stokes cavity example demonstrates
> the simple algorithm [3] which basically turns the continuity equation
> into an equation that solves for pressure. However, this becomes more
> complicated if the convection terms are included in the momentum
> equation.
>
> I have solved compressible flow problems with FiPy for my research.
> FWIW, I have code for this, see [4, 5]. However, I don't think that
> the code is much use to you other than as a reference for what is
> possible with FiPy given enough persistence.
>
> You might also want to try Dolfyn [6]. It might have an example that
> you can use right out of the box.
>
> Cheers,
>
> Daniel
>
> [1]:
> https://www.ctcms.nist.gov/fipy/examples/flow/generated/examples.flow.stokesCavity.html
> [2]:
> https://www.ctcms.nist.gov/fipy/examples/reactiveWetting/generated/examples.reactiveWetting.liquidVapor1D.html#module-examples.reactiveWetting.liquidVapor1D
> [3]: https://en.wikipedia.org/wiki/SIMPLE_algorithm
> [4]: https://gist.github.com/wd15/c28ab796cb3d9781482b01fb67a7ec2d
> [5]: https://journals.aps.org/pre/abstract/10.1103/PhysRevE.82.051601
> [6]: https://www.dolfyn.net/index_en.html
>
> On Thu, Aug 29, 2019 at 10:33 AM Daniel DeSantis 
> wrote:
> >
> > Hello to the FiPy Team:
> >
> > I was recently reviewing some old work and thinking of converting it
> over to FiPy and realized that, while I had done some successful work in
> FiPy (with your assistance several times), there are a few gaps in my
> knowledge of how to apply FiPy to some CFD type problems. I apologize for
> asking questions you may feel are clear in your guide, but  I am trying to
> learn how to use your awesome program a bit better so I don't have to keep
> asking questions.
> >
> > I'm essentially looking at coupling the continuity equation for a fluid
> with the equations for motion or the equations of change. So, we start with
> this:
> >
> > \nabla(\rho*v) = -\frac{\partial \rho}{\partial t}
> >
> > But frequently I have a steady state situation in which:
> > \nabla(\rho*v) = 0
> >
> > In either case, I'm not sure how the continuity equation up in FiPy. Do
> you have any suggestions? Should I set up multiple convection terms like
> this:
> >
> > PowerLawConvectionTerm(coeff=rho, var = v_x) +
> PowerLawConvectionTerm(coeff=rho, var = v_y) +
> PowerLawConvectionTerm(coeff=rho, var = v_z) = 0
> >
> > Similarly, we have momentum equations as:
> >
> > \nabla(\rho v_x) = -\frac{\partial{P}}{\partial x} +\rho g_x + \mu
> \nabla^2v_x
> >
> > \nabla(\rho v_y) = -\frac{\partial{P}}{\partial y} +\rho g_y + \mu
> \nabla^2v_y
> >
> > \nabla(\rho v_z) = -\frac{\partial{P}}{\partial z} +\rho g_z + \mu
> \nabla^2v_z
> >
> > I frequently am able to ignore the \rho g_i term but if I didn't, I
> believe I could treat this as a source term in Fipy, and simply add it to
> my equation. I understand how to do the diffusion and convection terms,
> from your guides.
> >
> > However, I don't know what to do with the pressure term. I don't usually
> have a consistent pressure in all dimensions so I would think that the
> pressure term should be a cell variable, but I don't know how to add it. I
> tried treating it as P.faceGrad, but I get errors. I've tried it as a
> PowerLawConvectionTerm, and I don't seem to get a result. Perhaps the
> problem is with the continuity equation?
> >
> > As a sort of classic example, I've uploaded a code that describes two
> plates with a fluid in between. In it, fluid is flowing between two plates.
> The bottom plate is stationary, the top one is moving. There's a pressure
> difference over the length of the plates. It's at steady state, but I'll
> probably end up playing with it as a non-steady state system eventually.
> I've tried it before, and perhaps I'm graphing it incorrectly, but it seems
> like it just presents a steady state solution.
> >
> > If I've got this completely wrong, could you suggest how to set up a
> continuity equation coupled with a momentum equation and, perhaps how to
> handle a first order differential term like the pressure gradient?
> >
> > Thank you,
> >
> > --
> > Daniel DeSantis
> >
> >
> > ___
> > fipy mailing list
> > fipy@nist.gov
> > http://www.ctcms.nist.gov/fipy
> >   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
>
> --
> Daniel Wheeler
>
> ___
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: 

Re: Fluid Dynamic Basics

2019-08-29 Thread Daniel Wheeler
Hi Daniel,

Solving the flow equations isn't easy and we certainly don't provide
much guidance on how to solve them with FiPy. We do have the Stokes
cavity example [1] and reactive wetting example [2], which might be a
good place for you to start. The Stokes cavity example demonstrates
the simple algorithm [3] which basically turns the continuity equation
into an equation that solves for pressure. However, this becomes more
complicated if the convection terms are included in the momentum
equation.

I have solved compressible flow problems with FiPy for my research.
FWIW, I have code for this, see [4, 5]. However, I don't think that
the code is much use to you other than as a reference for what is
possible with FiPy given enough persistence.

You might also want to try Dolfyn [6]. It might have an example that
you can use right out of the box.

Cheers,

Daniel

[1]: 
https://www.ctcms.nist.gov/fipy/examples/flow/generated/examples.flow.stokesCavity.html
[2]: 
https://www.ctcms.nist.gov/fipy/examples/reactiveWetting/generated/examples.reactiveWetting.liquidVapor1D.html#module-examples.reactiveWetting.liquidVapor1D
[3]: https://en.wikipedia.org/wiki/SIMPLE_algorithm
[4]: https://gist.github.com/wd15/c28ab796cb3d9781482b01fb67a7ec2d
[5]: https://journals.aps.org/pre/abstract/10.1103/PhysRevE.82.051601
[6]: https://www.dolfyn.net/index_en.html

On Thu, Aug 29, 2019 at 10:33 AM Daniel DeSantis  wrote:
>
> Hello to the FiPy Team:
>
> I was recently reviewing some old work and thinking of converting it over to 
> FiPy and realized that, while I had done some successful work in FiPy (with 
> your assistance several times), there are a few gaps in my knowledge of how 
> to apply FiPy to some CFD type problems. I apologize for asking questions you 
> may feel are clear in your guide, but  I am trying to learn how to use your 
> awesome program a bit better so I don't have to keep asking questions.
>
> I'm essentially looking at coupling the continuity equation for a fluid with 
> the equations for motion or the equations of change. So, we start with this:
>
> \nabla(\rho*v) = -\frac{\partial \rho}{\partial t}
>
> But frequently I have a steady state situation in which:
> \nabla(\rho*v) = 0
>
> In either case, I'm not sure how the continuity equation up in FiPy. Do you 
> have any suggestions? Should I set up multiple convection terms like this:
>
> PowerLawConvectionTerm(coeff=rho, var = v_x) + 
> PowerLawConvectionTerm(coeff=rho, var = v_y) +  
> PowerLawConvectionTerm(coeff=rho, var = v_z) = 0
>
> Similarly, we have momentum equations as:
>
> \nabla(\rho v_x) = -\frac{\partial{P}}{\partial x} +\rho g_x + \mu \nabla^2v_x
>
> \nabla(\rho v_y) = -\frac{\partial{P}}{\partial y} +\rho g_y + \mu \nabla^2v_y
>
> \nabla(\rho v_z) = -\frac{\partial{P}}{\partial z} +\rho g_z + \mu \nabla^2v_z
>
> I frequently am able to ignore the \rho g_i term but if I didn't, I believe I 
> could treat this as a source term in Fipy, and simply add it to my equation. 
> I understand how to do the diffusion and convection terms, from your guides.
>
> However, I don't know what to do with the pressure term. I don't usually have 
> a consistent pressure in all dimensions so I would think that the pressure 
> term should be a cell variable, but I don't know how to add it. I tried 
> treating it as P.faceGrad, but I get errors. I've tried it as a 
> PowerLawConvectionTerm, and I don't seem to get a result. Perhaps the problem 
> is with the continuity equation?
>
> As a sort of classic example, I've uploaded a code that describes two plates 
> with a fluid in between. In it, fluid is flowing between two plates. The 
> bottom plate is stationary, the top one is moving. There's a pressure 
> difference over the length of the plates. It's at steady state, but I'll 
> probably end up playing with it as a non-steady state system eventually. I've 
> tried it before, and perhaps I'm graphing it incorrectly, but it seems like 
> it just presents a steady state solution.
>
> If I've got this completely wrong, could you suggest how to set up a 
> continuity equation coupled with a momentum equation and, perhaps how to 
> handle a first order differential term like the pressure gradient?
>
> Thank you,
>
> --
> Daniel DeSantis
>
>
> ___
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]



-- 
Daniel Wheeler

___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Fluid Dynamic Basics

2019-08-29 Thread Daniel DeSantis
Hello to the FiPy Team:

I was recently reviewing some old work and thinking of converting it over
to FiPy and realized that, while I had done some successful work in FiPy
(with your assistance several times), there are a few gaps in my knowledge
of how to apply FiPy to some CFD type problems. I apologize for asking
questions you may feel are clear in your guide, but  I am trying to learn
how to use your awesome program a bit better so I don't have to keep asking
questions.

I'm essentially looking at coupling the continuity equation for a fluid
with the equations for motion or the equations of change. So, we start with
this:

\nabla(\rho*v) = -\frac{\partial \rho}{\partial t}

But frequently I have a steady state situation in which:
\nabla(\rho*v) = 0

In either case, I'm not sure how the continuity equation up in FiPy. Do you
have any suggestions? Should I set up multiple convection terms like this:

PowerLawConvectionTerm(coeff=rho, var = v_x) +
PowerLawConvectionTerm(coeff=rho, var = v_y) +
PowerLawConvectionTerm(coeff=rho, var = v_z) = 0

Similarly, we have momentum equations as:

\nabla(\rho v_x) = -\frac{\partial{P}}{\partial x} +\rho g_x + \mu
\nabla^2v_x

\nabla(\rho v_y) = -\frac{\partial{P}}{\partial y} +\rho g_y + \mu
\nabla^2v_y

\nabla(\rho v_z) = -\frac{\partial{P}}{\partial z} +\rho g_z + \mu
\nabla^2v_z

I frequently am able to ignore the \rho g_i term but if I didn't, I believe
I could treat this as a source term in Fipy, and simply add it to my
equation. I understand how to do the diffusion and convection terms, from
your guides.

However, I don't know what to do with the pressure term. I don't usually
have a consistent pressure in all dimensions so I would think that the
pressure term should be a cell variable, but I don't know how to add it. I
tried treating it as P.faceGrad, but I get errors. I've tried it as a
PowerLawConvectionTerm, and I don't seem to get a result. Perhaps the
problem is with the continuity equation?

As a sort of classic example, I've uploaded a code that describes two
plates with a fluid in between. In it, fluid is flowing between two plates.
The bottom plate is stationary, the top one is moving. There's a pressure
difference over the length of the plates. It's at steady state, but I'll
probably end up playing with it as a non-steady state system eventually.
I've tried it before, and perhaps I'm graphing it incorrectly, but it seems
like it just presents a steady state solution.

If I've got this completely wrong, could you suggest how to set up a
continuity equation coupled with a momentum equation and, perhaps how to
handle a first order differential term like the pressure gradient?

Thank you,

-- 
Daniel DeSantis


Two-plate flow example.py
Description: Binary data
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]