This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How update the initial data in a system of pde (time depending)?

+1 vote

Hi,

I will write a fenics' code to solve a system of 3 pde.
Cause of I'm new on FEniCS, I start with a simple system of two equation, but i have the same problem in all my code: I am not able to update the initial data, in fact whatever the final time, I get the same solution. A piece of my code:

u_1_o, u_2_o = split(u_old)
....
F = F1 + F2
dF = derivative (F, u, du)

# Problem
problem = NonlinearVariationalProblem (F, u, bc, J)
solver = NonlinearVariationalSolver(problem)

T = 100
t = dt
while t<=T:
    solver.solve()
    u1, u2 = split(u)
    t = t + dt
    u_1_o.assign (u1)    # or u_old.assign(u) 
    u_2_o.assign (u2)

u1, u2 = u.split()
plot (u1)
plot (u2)
interactive()

Where is the problem? Are there other methods to solve system of pde ?

thank you
best regard
Lor

asked May 22, 2015 by Lollo FEniCS Novice (140 points)

1 Answer

0 votes
u_old.vector()[:] = u.vector()

Try the numpy array interface please.

answered May 25, 2015 by Chao Zhang FEniCS User (1,180 points)

I tried with your method but i have the same problem. If I update the function F, I don't have this problem. Do I have to update F necessarily?

Could you give more details about your 'F'? I'd like to remind you of the Cahn-Hilliard demo at here, which is a time-dependent problem with two unknowns. It should be very similar to your problem.

...