1/* Copyright (C) 2003 Valerij Pipin <pip@iszf.irk.ru>
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE.  See the GNU General Public License for more details.
12 *
13 * Proving the conservation of helicity in hydrodynamics
14 *
15*/
16(if get('itensor,'version)=false then load(itensor),
17 icounter:5,idummyx:j,derivabbrev:false)$
18
19("the conservation of helicity in hydrodynamics")$
20("the covariant formulation of the Euler equation is")$
21euler:d_t*v([i1])+'liediff(v,v([i0]))=
22      -extdiff(p([]),i1)/rho([])+extdiff((v([i0])|v/2-phi([])),i1)$
23ishow(euler)$
24
25("take the exterior derivative of both sides")$
26euler:d_t*omega([i1,i2])+'liediff(v,omega([i0,i1]))=
27      extdiff(-extdiff(p([]),i1)/rho([])+extdiff(v([i0])|v/2-phi([]),i1),i2)$
28ishow(euler)$
29ishow(omega([i1,i2])=extdiff(v([i1]),i2))$
30("declare the function's dependencies")$
31depends(p,[rho,s])$
32("define the chain rule for the derivatives' replacement")$
33matchdeclare(i,symbolp);
34defrule(p_r, p([],[],i),'diff(p,rho)*rho([],[],i));
35defrule(p_sr, p([],[],i),'diff(p,s)*s([],[],i)+'diff(p,rho)*rho([],[],i));
36("apply the rules")$
37ishow(ratsimp(apply1(euler,p_r)))$
38("this law was originally discovered by Lord Kelvin")$
39("for the more general case there is Ertel's theorem")$
40
41("apply another rule where pressure depends on both rho and the entropy")$
42euler:factor(expand(apply1(euler,p_sr)))$
43ishow(euler)$
44("The RHS vanishes after forming the exterior product with the
45 differential of the entropy")$
46rhs(euler)~extdiff(s([]),i3)$
47ishow(lhs(euler)=factor(expand(apply1(%,p_sr))))$
48
49/* End of demo -- comment line needed by MAXIMA to resume demo menu */
50