AMSC 661 / CMSC 661 Homework 2 FAQ

Known typos:

  • In the first paragraph, "x" was meant to be a vector. Let's replace it by "x,y" (3 places) for clarity.
  • Submission instructions: Submit these four things:

  • A listing of well-documented Matlab code that I could run that would reproduce your results for all 6 problems. (The code needs to run without any input from the user.) To build this code, you might want to solve a problem in the GUI, use the "save as" command to make a ".m" file, and then edit it to use the "getpetuc" function to make the data available for error analysis. (15 points)
  • A well-formatted table of output from your Matlab code containing the 18 numbers requested in Problem 1. (5 points)
  • A discussion of any deviations from the theoretical convergence rate. (5 points)
  • A plot ("pdemesh" can be used) of the error vector | u_{computed} - u_{true} | for the finest mesh for Omega_2 and a_2. (You will actually be plotting the values only at the mesh points.) (5 points)
  • Question: For the first domain, "the unit circle" means the radius of the circle is 1, right?

    Answer: Yes, and it is centered at the origin.

    Question: For the PDE problem subject to Dirichlet boundary conditions, is it assumed u=0 on the boundary? I didn't find the boundary condition in pdf.

    Answer: No, use the true values of u on the boundary.

    Question: For "2 refinements of it", do you mean that after initialmesh, refine mesh twice?

    Answer: Yes.

    Question: I can't figure out how to enter piecewise boundary conditions and piecewise functions for the PDE into the portion of the GUI that allows you to define these values.

    Answer: I suggest entering them the same way you would enter a continuous boundary condition. As an example, if
    f(x) = 5 if x < 1
    f(x) = 2 if x >= 1
    then we can write that in Matlab as
    (x < 1).* 5 + (x >= 1).*2

    Question: I'm getting a message that there is a max number of users using the pdetoolbox, so that I am locked out.

    Answer: Yes, there is a limit, so you may need to work in off-hours, plan ahead, and not wait until the last minute to do this assignment. I checked into this further. There is a max of 100 users of the toolbox at one time, so we shouldn't have trouble. If you do get locked out, please send me email with the time that it happened, and I will pass the information on to the staff.

    Question: If I have it right, getpetuc.m just does the work of the various 'Export' commands in PDE tool all at once right ?

    Answer: Correct, and in "batch" mode rather than "interactive", so that a user doesn't need to intervene at the right moment.

    Question: How do I keep pdetool from asking whether I want to save my data when I try to run it in "batch" mode?

    Answer: Here is some code that works, copied from pdetool.m (with thanks to Sam Lamphier). Insert it between problems, when you want pdetool to overwrite its data.
    h = findobj(get(pde_fig,'Children'),'flat','Tag','PDEFileMenu');
    flags = get(h,'UserData');
    flags(1) = 0;
    set(h,'UserData',flags)
    A modification suggested by Ryan Harvey to avoid error in case pdetool is not running:
    pde_fig=findobj(allchild(0),'flat','Tag','PDETool');
    if ~isempty(pde_fig),
    h = findobj(get(pde_fig,'Children'),'flat','Tag','PDEFileMenu');
    flags = get(h,'UserData');
    flags(1) = 0;
    set(h,'UserData',flags)
    end

    Beware: The pdetool objects if you embed blanks in your definitions of the functions h, r, f, .... (It thinks you are trying to define a vector.) Remove all blanks.

    Question: How do I plot the error?

    Answer: You can do this by "pdeplot(p,e,t,'xydata',err)" "pdeplot(p,e,t,'zdata',err)" where p,e,t are returned by getpetuc and err is the absolute value of computed solution minus true solution at the vertices of the triangles.

    Question: I'm getting error messages about vertcat error (all rows in the bracketed expression must have the same number of columns)

    Answer: One possibility: "setuprop" is fussy about wanting all the strings of the same length, so if you edit one of the strings in the argument list, make sure that you adjust each string to have the same number of characters.

    Question: How does h change when we refine the mesh?

    Answer: Each triangle is divided into 4, so h is reduced by a factor of 2.