Error imposing space-derivative-dependent boundary condition with solvepde using variable state.uy - Error: Unrecognized field name "uy".
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Torsten
2024-8-4
移动:Torsten
2024-8-4
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 个评论
Torsten
2024-8-4
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:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!