On Jan 17, 2013, at 1:02 PM, Maximilian Balandat wrote:

>> I am confused by the above equation. Are the x and t derivatives on the 
>> correct terms?
> 
> Yes they are. This equation comes from expressing the equation rho_t + 
> (g(rho)*rho)_x in terms of the flux u rather the density rho. The function f 
> is the partial inverse of the flux function g(rho)*rho. This equation shows 
> up in a PDE constrained optimal control problem. 
> 
> 
>> Why do you need either the ".divergence" or ".grad" methods? I am not sure 
>> what you are trying to do.
> 
> I was hoping relabel variables x <=> t and then write u_t + f(u)_x = 0 with 
> initial condition u(x,.), and then express the term f(u)_x by fu.getGrad(),
> where fu is a new Cell or FaceVariable updated to f(u) at each step. But if I 
> just do this I get the following Type Error at runtime:
>  TypeError, "The coefficient must be rank 0 for a rank 0 solution variable."

What this means is that fu is a scalar field and fu.getGrad() produces a vector 
field. Instead, if f(u) represents a flux, then it needs to be a vector field 
and then you could do fu.divergence to get a rank-0 scalar field that FiPy is 
looking for (fu would need to be a rank-1 FaceVariable; we provide no 
divergence operator for rank-1 CellVariables).

As to whether this is a good idea in FiPy, I think Daniel will have a better 
idea. Such an implementation would be fully explicit, so you'll be limited to 
small timesteps. Your rho equation is more the form that FiPy is designed to 
solve, although such a purely advective equation may have issues, too.
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to