Error imposing space-derivative-dependent boundary condition with solvepde using variable state.uy - Error: Unrecognized field name "uy".
조회 수: 4 (최근 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!