Passing Structure Array of Parameters into Boundary Condition Function for PDEPE
Show older comments
Hello,
I am trying to use PDEPE, and have many constants that I would like to pass to my Boundary Condition Function via a structure array. I followed the instructions for the "Solve PDE and Compute Partial Derivatives" Example, but when I try to pass in the Structure Array "C" into my BC function "magBC", I get:
Not enough input arguments.
Error in ParametricCode>magBC (line 127)
I_0 = C.I_0;
Error in pdepe (line 250)
[pL,qL,pR,qR] = feval(bc,xmesh(1),y0(:,1),xmesh(nx),y0(:,nx),t(1),varargin{:});
Error in ParametricCode (line 21)
sol = pdepe(m,eqn,ic,@magBC,x,t);
How would I pass my Parameters into the Boundary condition? Here is the function for reference:
function [pl,ql,pr,qr] = magBC(xl,ul,xr,ur,t,C)
I_0 = C.I_0;
delta = C.delta;
R_0 = C.R_0;
r_w = C.r_w;
pl = ul - I_p(t)/I_0 * (log(8*R_0/r_w) - 2 );
ql = 0;
pr = ur;
qr = 1/delta * (log(8*R_0/(r_w*(1+delta))) - 2 ); %removed (1 + delta)
% from numerator
% because we have it
% in the definition
% for f in the kernel
end
Would taking out the xl and xr terms, or filling them in with the first and land entries of by x mesh work? It seems that the magBC function isn't taking in my C structure, and after fidding around, I am unable to get the constants to pass into the BC function like I have with the others.
Thanks,
Myles
Accepted Answer
More Answers (0)
Categories
Find more on Structural Mechanics 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!