itensor, ic_convert for continuity equation



Fabio,

As I indicated in my earlier e-mail, one way to do what you wish to do is by
using

	depends([rho,p,q,T],append(ct_coords, [t]))$

The syntax of depends is such that it expects its second argument to be a
list. The value of the expression

	append(ct_coords, [t])

is a list, namely the four-element list [x,y,z,t] containing the four
independent variables (I am assuming that we were using the 3D Cartesian
coordinate system.) In contrast, if you used

	depends[rho,p,q,T],[ct_coords, t])$

the second argument of depends would read [[x,y,z],t], i.e., a two-element
list consisting of the list [x,y,z], and the symbol t.

A list within a list is rarely a good idea. In this case, it is unlikely to
produce a meaningful result. For example:

(%i1) depends(f,[[x,y,z]]);
(%o1)                           [f([x, y, z])]
(%i2) diff(f,x);
                                 df
(%o2)                        ---------- [1, 0, 0]
                             d[x, y, z]

which makes kind of sense (f differentiated with respect to the list
[x,y,z], which in turn is differentiated with respect to x using the chain
rule) but it is not very useful.


Viktor



-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Fabio
Sent: Tuesday, January 12, 2010 12:24 PM
To: maxima at math.utexas.edu
Subject: Re: [Maxima] itensor, ic_convert for continuity equation

Dear all,
I made an error I already in the equation definition so thank a lot to
Mr Pipin for the prompt correction.
I saw that the code as it was proposed is giving a strange result,
basically something like

            d                 d
 rho ((---------- (q )) (-- ([x, y, z])) + ...   (I hope you can understand
it)
          d[x, y, z]   3    dz

which didn't mean anything to me

I changed the instruction

depends([rho,p,q,T],[ct_coords, t])

with

depends([rho,p,q,T],[x,y,z, t])

which then gives the expected result:

          drho      drho      drho    d         d         d
       q  ---- + q  ---- + q  ---- + (-- (q ) + -- (q ) + -- (q )) rho
         3  dz     2  dy     1  dx     dz   3    dy   2    dx   1


I would have liked to keep the instruction referring to "ct_coords" as
it is more general and, changing coordinate system, easier to deal
with.
Even if I can get the right result I would like to know the logic
behind this behaviour: does anybody know it?

Regards

Fabio


> Message: 5
> Date: Tue, 12 Jan 2010 22:23:26 +0800
> From: Valery Pipin <pip at iszf.irk.ru>
> Subject: Re: [Maxima] itensor, ic_convert for continuity equation
> To: maxima at math.utexas.edu
> Message-ID: <201001122223.26538.pip at iszf.irk.ru>
> Content-Type: Text/Plain; ?charset="iso-8859-1"
>
> The right code is
> derivabbrev:true$
> load(itensor)$
> load(ctensor)$
> ct_coordsys(cartesian3d)$
> cmetric()$
> christof(all)$
> depends([rho,p,q,T],[ct_coords, t])$
> imetric: g$
> eq:ishow( s = ?covdiff((rho([],[]) * q([],[a])),a))$
> ic_convert(eq);
> s: [0,0,0]$
> %th(2), ev;
>
> Look at itensor8.dem
> I belive that there should be a demo for the ?Navie-Stokes equations
aswell
>
>> Dear all,
>> I am trying to get the Navier Stokes equation into MAXIMA using the
>> tensorial packages.
>> I am starting by writing the continuity eq
>>
>> d rho / d t ?+ (rho v^ i )_{ ,j } = 0
>>
>> or in latex
>> \frac{\partial \rho}{\partial t} + (\rho v^i)_{,j} ? (
>> http://tinyurl.com/ydxd6pc )
>>
>> The idea is to start with "itensor" and then convert it to "ctensor"
>> defining the metrics in order to arrive to a final equation in a
>> defined coordinate system.
>>
>> derivabbrev:true$
>> load(itensor)$
>> load(ctensor)$
>> ct_coordsys(cartesian3d)$
>> cmetric()$
>> christof(mcs)$
>> depends([rho,p,q,T],[ct_coords, t])$
>> imetric: g$
>> eq: ishow( s([a],[]) = ?covdiff((rho([],[]) * q([a],[])),b))$
>> ic_convert(eq);
>> s: [0,0,0]$
>> %th(2), ev;
>>
>> I get::
>> ?"Improper indices in - rho([], []) q([%3], []) ichr2([a, b], [%3])
>> ? ? ? ? ? ? ? ? ? ? ? ? + rho([], []) q([a], [], b) + rho([], [], b)
q([a],
>> ?[]) -- an error. ?To debug this try debugmode(true);"
>>
>> I use the same indices both in LHS and RHS and "s" is a dummy var to
>> give value zero to the LHS. it is basically the same thing done in
>> "Maxima Digest, Vol 41, Issue 37" message 5 by Viktor T. Toth.
>> Do you know where I am wrong?
>>
>> Regards
>>
>> Fabio
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima