필터 지우기
필터 지우기

Can I solve a system of nolinear parabolic PDE using PDE toolbox in MATLAB?

조회 수: 2 (최근 30일)
I have a system of two parabolic PDEs with c coefficient of second equation as a function of solution of both first and second equation. I defined c coefficient as a function handle, but getting error: Function handle specifying a coefficient must accept two input arguments and return one output argument.
My function handle is: function c = ccofficient(region,state)
Dref = 2.592e-5; % reference humidity diffucion coefficient in m^2/day alpha = 0.05; % represents Dh,min/Dh,max n = 10; % characterises spread of the drop in Dh U = 25; % activation energy of moisture diffusion process in kJ/mol Tref = 23; % Reference temperature at which Dh,ref measured te = 28; % hydration period of concrete in days hc = 0.75; % value of pore relative humidity at which Dh drops halfway between Dh,max and Dh,min. R = -0.03056; % gas constant in Joule/(mol^oC) t = state.time; n1 = 2; nr = numel(region.x); c = zeros(n1,nr); c(1,:) = k*ones(1,n1); c(2,:) = Dref*(alpha+(1-alpha)+(1+((1-state.u(:,2,t))/(1-hc)).^n))*exp(U/R*(1/Tref-1/(state.u(:,1,t))))... *0.3+(13/te).^0.5;
Kindly suggest me how to write function handle for this type of nonlinear parabolic system of PDE.
  댓글 수: 3
Aditi
Aditi 2017년 4월 14일
function cmatrix = ccoeffunction(region,state)
Dref = 2.592e-5; % reference humidity diffucion coefficient in m^2/day
alpha = 0.05; % represents Dh,min/Dh,max
n = 10; % characterises spread of the drop in Dh
U = 25; % activation energy of moisture diffusion process in kJ/mol
Bh = 0.02592; % Surface humidity transfer coefficient
Tref = 23; % Reference temperature at which Dh,ref measured
te = 28; % hydration period of concrete in days
hc = 0.75; % value of pore relative humidity at which Dh drops halfway between Dh,max and Dh,min.
R = -0.03056; % gas constant in Joule/(mol^oC)
n1 = 2;
nr = numel(region.x);
cmatrix = zeros(n1,nr);
cmatrix(1,:) = k*ones(1,nr);
cmatrix(2,:) = Dref*(alpha+(1-alpha)+(1+((1-state.u(:,2))/(1-hc)).^n))*exp(U/R*(1/Tref-1/(state.u(:,1))))...
*0.3+(13/te).^0.5;
This is my code for the function handle to define coefficient c. I have rectified the initial code by eliminating t = state.time. and now getting error in line nr = numel(region.x).
Aditi
Aditi 2017년 4월 15일
function cmatrix = ccoeffunction(region,state)
n1 = 9;
nr = numel(region.x);
cmatrix = zeros(n1,nr);
cmatrix(1,:) = ones(1,nr);
cmatrix(2,:) = 2*ones(1,nr);
cmatrix(3,:) = 8*ones(1,nr);
cmatrix(4,:) = 1+region.x.^2 + region.y.^2;
cmatrix(5,:) = state.u(2,:)./(1 + state.u(1,:).^2 + state.u(3,:).^2);
cmatrix(6,:) = cmatrix(4,:);
cmatrix(7,:) = 5*region.subdomain;
cmatrix(8,:) = -ones(1,nr);
cmatrix(9,:) = cmatrix(7,:);
I created a function for c coefficient using the above example given in MATLAB documentation.
My problem is a system of parabolic equations. I want to make sure that parabolic non linear system of PDE can be solved using PDE toolbox in MATLAB.
However when I write the state.u as mentioned above error shows up:
Function handle specifying a coefficient must accept two input arguments and return one output argument.

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

채택된 답변

Ravi Kumar
Ravi Kumar 2017년 4월 14일
Hi Aditi,
This error generally indicates that the function for c, ccoefficient, did not return a output value. This could be due to a syntax error in the function. You can insert a breakpoint in the function and step through the code to identify the line containing error.
Regards,
Ravi
  댓글 수: 4
Aditi
Aditi 2017년 4월 15일
>> ccoeffunction
Not enough input arguments.
Error in ccoeffunction (line 32)
nr = numel(region.subdomain);
Aditi
Aditi 2017년 4월 15일
cmatrix(2,:) = Dref*(alpha+(1-alpha)+(1+((1-state.u(:,2))/(1-hc)).^n))*exp(U/R*(1/Tref-1/(state.u(:,1))))...
*0.3+(13/te).^0.5;
I was able to resolve the error as mentioned in my previous comment
nr = numel(region.subdomain);
Kindly guide me how to write the state.u in cmatrix(2,:) above, as I am still getting error
Error using pde.CoefficientAssignment/checkCoefFcnHdlArgCounts (line 531) Function handle specifying a coefficient must accept two input arguments and return one output argument.
Error in pde.CoefficientAssignment/checkFcnHdlArgCounts (line 267) self.checkCoefFcnHdlArgCounts(self.c, systemsize, ndims);
Error in pde.CoefficientAssignment (line 105) obj.checkFcnHdlArgCounts(systemsize, numdims);
Error in pde.PDEModel/specifyCoefficients (line 121) coef = pde.CoefficientAssignment(coefcont,argsToPass{:});
Error in combinedll (line 48) specifyCoefficients(pdem,'m',0,'c',@ccoeffunction,'a',0,'f',f,'d',d);
Note here, my result u is time varying, and I am solving two PDEs.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by