Question: Problem with declaration of Vector a functions of x,y,z

I'm working with a PDE system, I want to bring it from the conservative(or divergent) to not-conservative form. So I have to do some derivatives. I'm working in vectorial form.
I want to declare the unwnown vector W as function of x,y,t and I have problems to do that. I tried in different way and I read a lot of stuff in the help but nothing worked. I tried to use declare but in the help there is not explanation how to use it with a vector. So I used it  with all the component CS[1]..CS[Neq] and then I put them in the vector W.  But it didn't work, when I derive W it returns me a zero vector!! And it's wierd that when I derive the flux vectors Fx and Fy that are functions of CS[1]..CS[Neq] it derives perfectly!! At the end my problem is: I want to work with a simbolic vector W , whose components (I colled them CS[1]..CS[Neq] since I'm not able to initialize the vector W to the symbolic values W[1]..W[Neq] )are function of x,y,t. And then I need to do the x and y derivative of Fx and Fy that are functions of W!! Below is the code. Thanks so much for your help.Alberto.

 

restart;
with(LinearAlgebra):
 with(PDEtools):
 with(CodeGeneration,Fortran): 
with(codegen,fortran): 
 
# Number of equations to solve
 Neq := 5;
 printlevel := 2;
 for m from 1 to Neq do:    
    alias(CS[m] = CS[m](x, y, t));
    declare(CS[m](x, y, t));
 end do;
 assume(CS[2]::real,CS[3]<>0);
 assume(CS[3]::real,CS[3]<>0);
 assume(CS[1]::real,CS[5]::real,CS[1]-CS[5]>0,CS[4]::real,CS[4]>0); 
  assume(AA::real,Ks::real,Ks>0,Diam::real,Diam>0,DELTA::real,DELTA>0,TScr::real,TScr>0,qs::real);
 interface(showassumed=2);
 W := Vector(Neq);    
  for m from 1 to Neq do:    
    W[m] := CS[m];
 end do;
 Fx := <CS[2] , CS[2]^2/(CS[1]-CS[5]) + 1/2*GRAVIT*CS[1]^2 - GRAVIT*CS[5]*CS[1] , CS[2]*CS[3]/(CS[1]- CS[5])                              , CS[4]*CS[2]/(CS[1]-CS[5]) , 0>;
 Fy := <CS[3] , CS[2]*CS[3]/(CS[1]-CS[5])                              , CS[3]^2/(CS[1]-CS[5]) + 1/2*GRAVIT*CS[1]^2 - GRAVIT*CS[5]*CS[1] , CS[4]*CS[3]/(CS[1]-CS[5]) , 0>;
 equatio:=map(diff,W,t)+map(diff,Fx,x)+map(diff,Fy,y)=0;

 

Please Wait...