Error imposing space-deri​vative-dep​endent boundary condition with solvepde using variable state.uy - Error: Unrecognized field name "uy".

4 views (last 30 days)
I would appreciate any advice of the following. I am working with PDE Tool box solvepde and a 2d membrane simulation and struggling to impose a spatial-derivative-dependent absorbing a boundary condition on an edge. I am following PDE Toolbox documentation trying two different methods, one (commented out) below using a simple anonymous function and another using a matlab function. These methods work with variables like location.x, location.y, and state.time but seem to fail me with the spatial derivatives. Here is the code snippet in the setup preamble to calling solvepde:
case 3
alpha_absorb=1;beta_absorb=0.0;
m3=m_func(0,ribbonlength/2);
c3=c_func(0,ribbonlength/2);
v3=sqrt(c3(3)/m3);
% my_g= @(location, state,alpha,beta) (-alpha_y *v3.* state.uy +beta_y*state.uyy);
%
% g=@(location,state)(-alpha_y *v3.* state.uy +beta_y*state.uyy)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3);
applyBoundaryCondition(model, 'neumann', 'Edge', topEdgeID, "q",0,...
'g', g);
end
function absorb=my_g(location, state,alpha_absorb,beta_absorb,v3)
n1=1;
nr=numel(location.x);
absorb=zeros(n1,nr);
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
end
For the method shown, solvepde throws the following error ( and the commented out anonymous functio method throws a similar error)
Unrecognized field name "uy".
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3)
bci = func(appRegion, state);
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, ...
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
bcmat = bcImpl.getBCMatrices(u,time,gmat);
bmat = self.assembleBoundary(u,time,gmatrix);
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
obj = obj.initialDiscretization(u0,tdummy);
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, ...

Accepted Answer

Torsten
Torsten on 4 Aug 2024
Moved: Torsten on 4 Aug 2024
According to the documentation (User's guide, page 2-128), g can be a function of x,y,t and u.
The boundary condition of a second-order PDE can never have u_yy in it, and u_y is already contained in n*(c*grad u).
  5 Comments
Torsten
Torsten on 4 Aug 2024
I don't have the necessary experience with the PDE Toolbox to answer your questions. I think it would be best if you contact the official MATLAB support for this:

Sign in to comment.

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!