nonzero m and d coefficients for Matlab PDE
2 views (last 30 days)
Show older comments
Siarhei Hladyshau
on 17 Mar 2019
Commented: Joanna Chang
on 6 Aug 2020
Hello, everyone!
I am trying to solve the 2D problem with Matlab PDE and need to specify both mass (m) and damping (d) to be nonzero.
Workflow in short:
create model with
model = createpde(N);
specify geometry ...
coefficients:
specifyCoefficients(model, 'm', rho, 'd', d, 'c', c, 'a', 0, 'f', f);
and solve it:
result = solvepde(model,time);
I got stuck having the error:
Error using pde.CoefficientAssignment/checkMandD (line 303)
When both 'm' and 'd' coefficients are nonzeros, the 'd' coefficient must be a matrix.
In the documentation to the function "specifyCoefficients" it is said:
Note: If the PDE to solve has both 'm' and 'd' coefficients that are
non-zero, then 'd' must be a matrix that has the same size as
the discretized mass matrix (not to be confused with 'm').
What is the correct way to specify 'd' coefficient when mass is nonzero?
0 Comments
Accepted Answer
Ravi Kumar
on 19 Mar 2019
Refer to this documentation:
d has to be a sparse matrix when m is non-zero.
2 Comments
Joanna Chang
on 6 Aug 2020
I am following the instructions here but it is unclear how to create this sparse matrix. I have a PDE system with 2 equations and two variables u1 and u2, and d should be 0 in the first equation and 1 for u2 in the second equation, such that d=[0 0; 0 1], what should the matrix be if result.M is of size 120x120?
More Answers (0)
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!