Problem with coefficient c in function form in solving 2D-PDE (PDE toolbox)

조회 수: 2(최근 30일)
I'm trying to solve a 2D-PDE with a c coefficent in function form, but i'm having some trouble in using location struct.
here is my function for c coefficient:
function cmatrix = ccoeffunction(location,~)
n1 = 4;
nr = numel(location.x);
cmatrix = zeros(n1,nr);
cmatrix(1,:) = Ds*ones(1,nr);
cmatrix(2,:) = jv*(location.y)+jv*((location.y).^3)/3;
cmatrix(3,:) = -jv*(location.x)+Ds*((location.x)./(location.y));
cmatrix(4,:) = Ds*ones(1,nr);
However the location struct passed to the function contains in fields x and y just one zero, so my function doesen't work correctly.
location =
struct with fields:
x: 0
y: 0
z: 0
subdomain: 1
How can i pass to my function the correct location struct???

채택된 답변

Ravi Kumar
Ravi Kumar 2020년 5월 1일
Hi Chiara,
Solver will call the function several times to check if it is returing the correct format of coeff and so on, for these probing calls a single point is used. If you continue and get past this initial calls, you will be able to see that solver eventually calls with location of several Gauss points where element matrices are integrated.
  댓글 수: 8

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by