How do I use specifyCoefficients with a vectorized conductivity c?
Show older comments
I am trying to use the solvepde function to solve an elliptic PDE and return the solution and its gradient. To do this I need to use the specifyCoefficients function to specify the coefficients in the model. My problem arises when trying to use a vector for the conductivity coefficient c. In the given (2-D) application I have a vector, that is the conductivity evaluated at the nodes of the PDE mesh, but I do not have a function for c. The code snippet looks as follows:
m = m(:);
model = prob_data.fwd_model;
p = prob_data.Meshdata.points;
t = prob_data.Meshdata.triangles;
c = exp(m);
c = pdeintrp(p,t,c);
specifyCoefficients(model,'m',0,'d',0,'c',c,'a',0,'f',@myffun);
forward_solve = solvepde(fwd_model);
This causes the following error:
% Error using pde.CoefficientAssignment/checkCCoefSize (line 429)
% Size of the matrix 'c' is not consistent with
% the pde.PDEModel/PDESystemSize property.
I have tried letting c be a vector the size of the mesh nodes, and also tried interpolating c to evaluate it at the center of the triangles of the mesh as in the code above. I have also looked at the documentation https://www.mathworks.com/help/pde/ug/c-coefficient-for-systems-for-specifycoefficients.html . Based on the documentation it looks like I may need to elongate the vector by repeating its values several times to represent the elements of a tensor. The documentation here is rather confusing to me and I haven't been able to get specifyCoefficients to work, any help clarifying this would be much appreciated.
-Isaac
Answers (0)
Categories
Find more on Eigenvalue Problems 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!