0

I would like to know how I can represent the third derivate term:

enter image description here

In Fipy python. I know that the diffusion term is represented as

DiffusionTerm(coeff=D)

and higher order diffusion terms as

DiffusionTerm(coeff=(Gamma1, Gamma2))

But can not figure out a way to represent this third derivate. Thanks

Mafeni Alpha
  • 308
  • 2
  • 13

1 Answers1

2

Is the vector v defined in terms of a (scalar) solution variable? If not, just write the term explicitly:

v.divergence.faceGrad.divergence

If v is a function of the solution variable (say \phi), then there's no mechanism to do this like there is with higher-order diffusion, but there really isn't a need (nor is there a need for higher-order diffusion). Split your equation into two 2nd order PDEs and couple them:

\partial \phi / \partial t = \nabla^2 \nabla\cdot\vec{v}

can be rewritten as

\partial \phi / \partial t = \nabla^2 \psi \\
\psi = \nabla\cdot\vec{v}

which would be

TransientTerm(var=phi) == DiffusionTerm(var=psi)
ImplicitSourceTerm(var=psi) == ConvectionTerm(coeff=v, var=???)

I'd need to know more about v and your full set of equations to advise further on what that ConvectionTerm should look like.

[notes added given the information that these terms arise from the Korteweg-de Vries equation]:

While it is not strictly true that v isn't a function of some phi in the KdV equation, there still is no way to put the \partial^3 v / \partial x^3 term into a form that FiPy can readily make use of. If v is scalar, then \partial^3 v / \partial x^3 is vector. If v is vector, then \partial^3 v / \partial x^3 is either scalar or tensor. There's no way to make the rank of this term consistent with the others unless you dot it with a unit vector, in which case it's just some source without an efficient implicit representation.

At the root, 1D equations are always misleading. It's critical to know what's a scalar and what's a vector. FiPy, as a finite volume code, is applying the divergence theorem when it solves, and so it is necessary to know when one is dealing with the divergence of a flux (which FiPy can treat implicitly) or just some random partial derivative (which it cannot).

Reading through the derivations of the KdV equation, it appears that so many long-wave approximations and variable substitutions have been made that any trace of vector calculus has been cast away. As a result, this is not a PDE that FiPy has efficient forms for. You can write v.faceGrad.divergence.grad.dot([[1]]), and FiPy should accept this, but it won't solve very effectively.

Further, since the KdV equations are about wave propagation and are essentially hyperbolic, FiPy really isn't well suited (some diffusive element is generally needed for the algorithms underlying FiPy to converge). You might take a look at Clawpack or hp-FEM.

jeguyer
  • 2,379
  • 1
  • 11
  • 15
  • the kdv equation is the kdv given by \partial v / \partial t+6v partial v / \partial x + partial ^3 v / \partial x^3=0 – Mafeni Alpha Sep 04 '19 at 18:11
  • Am stuck on the third-order derivative on the last. its a scalar function. The equation is alone not related to any \phi – Mafeni Alpha Sep 04 '19 at 18:15