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".
Error in MembraneWaveExplorer>my_g (line 303)
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)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, …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".
Error in MembraneWaveExplorer>my_g (line 303)
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)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, … 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".
Error in MembraneWaveExplorer>my_g (line 303)
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)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, … pdesolve, edge boundary condition MATLAB Answers — New Questions