How to correct the error in specifycoefficient

My function is
function c=ccoef(nodes,elements,~,~,~,~)
N=1;
nr=size(elements,2);
c=zeros(N,nr);
c(1,:)=1/3/(0.02+0.01*20)*ones(1,nr);
a=[];
for i=1:size(nodes,2)
if nodes(1,i)>-0.1 && nodes(1,i)<0.1 && nodes(2,i)<=-5
a=[a i];
end
end
[~,col]=find(elements==a(1));
% b=1/3./(0.02+0.01*20);
c(:,col(1))=1/3./(0.3+0.01*20);
specifyCoefficients(model,'m',0,'d',0,'c',@ccoef2,'a',@acoef,'f',@fcoef);
Error in command window is
Error in pde.PDEModel/specifyCoefficients (line 139)
coef = pde.CoefficientAssignment(coefcont,argsToPass{:});
Error in fem (line 14)
specifyCoefficients(model,'m',0,'d',0,'c',@ccoef2,'a',@acoef,'f',@fcoef);
How to correct this error
kindly help me

4 件のコメント

Ravi Kumar
Ravi Kumar 2019 年 6 月 18 日
What is you ccoef2?
Can you simplify the problem and post the complete code that we can run?
Boni_Pl
Boni_Pl 2019 年 6 月 18 日
Sir, Can I mail the code to you?
Boni_Pl
Boni_Pl 2019 年 6 月 18 日
The equation is
equation.jpg
eq1.jpg
ccoef is the D(r).
model=createpde();
g = @circleg;
geometryFromEdges(model,g);
figure,
pdegplot(model,'EdgeLabels','on')
specifyCoefficients(model,'m',0,'d',0,'c',@ccoef2,'a',@acoef,'f',@fcoef);
generateMesh(model,'Hmax',0.75);
figure,
pdeplot(model);
Ravi Kumar
Ravi Kumar 2019 年 6 月 18 日
Coefficient functions should use region and state, which contain coordinates and solution values, respectively, to compute the coefficient. You don't need to deal with elements and nodes as you are doing. Refer to simple examples in the documentation page: https://www.mathworks.com/help/pde/ug/pde.pdemodel.specifycoefficients.html
Also, it looks like you are modeling axisymmetric problem, correct? If so, you need to modify the setup a bit as PDE Toolbox uses Cartesian coordinates.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePartial Differential Equation Toolbox についてさらに検索

タグ

質問済み:

2019 年 6 月 17 日

コメント済み:

2019 年 6 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by