Initial conditions in a mixed function space
Dear all, I hope I have not missed something obvious again but I'm looking to assign initial conditions for my variables \underline{u} , \rho and p. Velocity, density and pressure respectively. I have a mixed function space W, and my first thought was to define initial variables by splitting a W function w_ = Function(W) (u_, r_, p_) = split(w_) and then interpolating my expression for the exact solution for each variable u_.sub(0).interpolate(exact_w) r_.interpolate(exact_r) but as I get the error File "compressible.py", line 74, in <module> r_.interpolate(exact_r) AttributeError: 'Indexed' object has no attribute 'interpolate' this is clearly not the way to go. What would be a better approach ? Will
On 10 Dec 2015, at 17:15, William Booker <scwb@leeds.ac.uk> wrote:
Dear all,
I hope I have not missed something obvious again but I'm looking to assign initial conditions for my variables \underline{u} , \rho and p. Velocity, density and pressure respectively.
I have a mixed function space W, and my first thought was to define initial variables by splitting a W function
w_ = Function(W) (u_, r_, p_) = split(w_)
and then interpolating my expression for the exact solution for each variable u_.sub(0).interpolate(exact_w) r_.interpolate(exact_r)
but as I get the error
File "compressible.py", line 74, in <module> r_.interpolate(exact_r) AttributeError: 'Indexed' object has no attribute 'interpolate'
this is clearly not the way to go. What would be a better approach ?
You've hit the split(u) vs. u.split() issue that we discussed last friday. Use u_, r_, p_ = w_.split() to get sub functions you can assign to, and u_, r_, p_ = split(w_) for things you can use in variational forms. Cheers, Lawrence
participants (2)
- 
                
                Lawrence Mitchell
- 
                
                William Booker