Error imposing space-derivative-dependent boundary condition with solvepde using variable state.uy - Error: Unrecognized field name "uy".
显示 更早的评论
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);
Error in MembraneWaveExplorer>@(location,state)my_g(location,state,alpha_absorb,beta_absorb,v3) (line 295)
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, ...
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Eigenvalue Problems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
