Boundary conditions with stiff problems
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I'm trying to solve a system of PDEs that depends on space (1 dimension) and time. I want to solve it using a second order discretization in space and then using ode23s to solve the system of ODEs (method of lines).
The problem is that I have a laplacian operator and I can just integrate in the interior nodes (let's say from 2 to n-1). The values for nodes 1 and n depend on their neighbours and should be updated at each time step.
How could I set these restrictions to solver?
Here is the scheme:
function dydt = fun(t,u)
for j = 2:n-1
impose right hand side function
end
%Now I want to impose the value in y(1) and y(end)
end
0 commentaires
Réponses (3)
Torsten
le 8 Déc 2016
Boundary conditions don't depend on neighbour values, but are given independently.
What are the boundary conditions for your PDE ?
Best wishes
Torsten.
1 commentaire
Torsten
le 9 Déc 2016
Use the equations
(u(2)-u(1))/(x(2)-x(1)) = G(u(1))
(u(n)-u(n-1))/(x(n)-x(n-1)) = G(u(n))
to solve for u(1) (u at 0) and u(n) (u at 1).
Then use these values for the discretization in the inner grid points.
Best wishes
Torsten.
0 commentaires
Albert Jimenez
le 9 Déc 2016
6 commentaires
Torsten
le 13 Déc 2016
Modifié(e) : Torsten
le 13 Déc 2016
No. The boundary conditions give you u(0) depending on u(1),u(2) and u(n+1) depending on u(n-1),u(n).
Inserting these expressions in the discretized Laplacian in x(1) and x(n) give you the time derivatives for u(1) and u(n).
Best wishes
Torsten.
Voir également
Catégories
En savoir plus sur Eigenvalue Problems dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!