Solving PDEs: Number of rows required in output of user defined coefficient functions
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I am trying to solve an inhomogenous wave equation using a script (not PDETool) and the hyperbolic PDE solver. My coefficients are quite complicated so I am writing my own functions to describe them. I understand that the coefficient array the function outputs must have as many columns as mesh elements, but what about the number of rows? I currently only have one row but I get errors from 'pdeasma' indicating that matrix dimensions must agree. When I give the coefficient a single scalar value it's fine, so I am confident the error has to do with my coefficient function. My coefficients are only dependent on position in the mesh (not time or initial conditions). Thanks a lot!
0 commentaires
Réponse acceptée
Bill Greene
le 23 Oct 2013
Hi Susannah,
I think I can give you some help on this. I'll discuss the c-coefficient since that is the most complex one.
You didn't say whether you have more than one PDE in your system. If you have only one (i.e. a scalar PDE), the number of rows for the c-coefficient can be 1, 2, 3, or 4. For this case, you can think of c as a 2x2 matrix. If your properties are the same in the x and y directions, you need to input only one row (c11=c22=c). Otherwise, you enter the terms from the 2x2 matrix row by row. For example, if you want to enter the full 2 x 2 matrix, you would need 4 rows.
For the system case (N>1), there is a bewildering number of options depending on which terms in the 2N x 2N c-matrix you need to describe your equations. Those options are described here:
One final tip: you can always define your c-coefficient with 2*N*2*N rows but, usually, many of those entries will be zero.
Hope that helps.
Bill
2 commentaires
Bill Greene
le 23 Oct 2013
For a scalar PDE, d, f, and a must be scalars (one row).
Bill
PS: FYI, you could also have defined c as:
c = [-1 -1]';
c = [-1 0 -1]';
c = [-1 0 0 -1]';
They are all equivalent to the most convenient form
c = -1;
which you chose.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Geometry and Mesh 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!