Error imposing space-deri​vative-dep​endent 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);
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

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, thanks! Firstly, Can you point me to an up-to-date user's guide? I can find only a quite old (2010?) pdf no longer pulbished describing the pde toolbox details of implementation and no similar thing in the present online documentation, just fragments. Not sure the online documentation says g cannot access u_y or u_x which I do see used in some examples, and I don't see use of u_yy or u_xx or presumably a u_xy used anywhere.
2ndly, it seems I'm naively trying to implement an absorbing boundary condition I found in some paper to force an update of the spatial derivative at each time step as a radiation boundary condition as follows (lacking access to the time derivative of u in the state structure):
${\bf n}\cdot (c\nabla u)+qu=g= -\alpha_y c v{\partial u\over \partial y}+\beta_y u {\partial^2 u\over\partial y^2}$and $q=0$.
where $\alpha_y$ and $\beta_y$ are parameters. For $\beta_y=0$, this give $\nabla u= -\alpha_yv{\partial u\over\partial y}$.
My membrane can have an anisotropic stress distribution but I'm approximating c on the edge with a constant value. I was hoping the implementation would use the BC to update the spatial derivative.
Can you suggest any other simple method of creating an approximately absorbing BC using the available Neumann and Dirchilet BC fuinctionality? Adding a damping region to a random/user-selectable edge for my user selectable membrane shapes is rather involved and something I'm trying to avoid.
Here is the User's Guide for R2024a:
The boundary conditions section starts with 2-126.
Absorbing boundary conditions or more generally boundary conditions that contain the time derivative of the solution variable cannot be set.
Thank you! I'm wondering how to implement a region with a damping spatial gradient to make a radiation absorber. Right now I have implemented damping following instructions as show below. I don't know how to determine the locations of the nodes associated with the elements of the mass and stiffnes matrices. Is there a way to do that? ANd if so could I then vary the damping node by node and damp those in a region of on an edge or say make a dampin matrix that behaved like a stairstep in damping in some direction of a region?
Add coefficient functions to the model.
Note: We do not specify a face - assume we have one face.
CA=specifyCoefficients(model,"m",m,"d",d,"c",c,"a",a,"f",f);
Update the model after initial creation to include damping
If damping in turned on, update the coefficients with the damping term. The Rayleigh damping model often used in structural mechanics is used to define the 'd' parameter.
if damping==1
fem = assembleFEMatrices(model);
alpha_damp = 1/tau;
beta_damp = 0.01;
dampmat = alpha_damp*fem.M + beta_damp*fem.K;
CA=specifyCoefficients(model,"m",m,"d",dampmat,"c",c,"a",a,"f",f);
end
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!