What is wrong about my "specifyCoefficients" function use for PDEModel?
Afficher commentaires plus anciens
I am trying to solve the Schnakenberg Model, a (nonlinear) PDE system in 2D:
= 
= 
My code by now is the following:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Define Model
nEquations = 2;
model = createpde(nEquations);
%% Define Geometry
geometryFromEdges(model,@lshapeg);
%% Define Schnakenberg Model Nonlinear Function
a = 1; b = 0.5; gamma = 200; d = 20;
R = @(c) gamma*[a - c(1)+c(1)*c(2)*c(2);
b - c(1)*c(2)*c(2)];
D = [1 0; 0 d];
%% Solve Problem on Model
m_mod = zeros(2); d_mod = eye(2); a_mod = zeros(2);
c_mod = [D(1,1) 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 D(2,2)];
f_mod = @(location,state) R(state.u);
specifyCoefficients(model,'m',m_mod,'d',d_mod,'c',c_mod,'a',a_mod,'f',f_mod);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
However as an output I get the following:
Error using pde.CoefficientAssignment/checkMCoefSize (line 398)
Size of the matrix 'm' is not consistent with
the pde.PDEModel/PDESystemSize property.
Error in pde.CoefficientAssignment/checkAllMatrixCoefSizes (line 240)
self.checkMCoefSize(self.m, systemsize);
Error in pde.CoefficientAssignment (line 103)
obj.checkAllMatrixCoefSizes(systemsize, numdims);
Error in pde.PDEModel/specifyCoefficients (line 139)
coef = pde.CoefficientAssignment(coefcont,argsToPass{:});
Error in ForumAttempt (line 21)
specifyCoefficients(model,'m',m_mod,'d',d_mod,'c',c_mod,'a',a_mod,'f',f_mod);
Where did I go wrong? I think I followed the Instructions at https://ch.mathworks.com/help/pde/ug/equations-you-can-solve.html
where it states "For systems of N equations, the coefficients m, d, and a are N-by-N matrices, f is an N-by-1 vector, and c is a 2N-by-2N tensor (2-D geometry)"
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur General PDEs dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!