| 1 |
function [thetam] = fu(evalKey, parm, xm,ym,type, nvec, u,ux,uy); |
| 2 |
%FU Evaluate the nonlinear strong form of a PDE |
| 3 |
% |
| 4 |
% Usage: [thetam] = fu(evalKey, parm, xm,ym,type, u,ux,uy, nvec); |
| 5 |
% |
| 6 |
% Evaluate the nonlinear form by providing the value of the quantity |
| 7 |
% at a particular point. |
| 8 |
% |
| 9 |
% Input: |
| 10 |
% |
| 11 |
% evalKey ==> particular piece of the strong form that is desired |
| 12 |
% xm ==> x-coordindinates of the point |
| 13 |
% ym ==> y-coordindinates of the point |
| 14 |
% type ==> point type (interior/diri/neum) |
| 15 |
% |
| 16 |
% u ==> u, evaluated on master element |
| 17 |
% ux ==> partial w.r.t. x of u |
| 18 |
% uy ==> partial w.r.t. x of u |
| 19 |
% |
| 20 |
% nvec(1:2) ==> unit outward normal vector if an element face |
| 21 |
% |
| 22 |
% Output: |
| 23 |
% |
| 24 |
% thetam ==> the value of the strong form at the point |
| 25 |
% not including the jacobian of transformation |
| 26 |
% |
| 27 |
% Author: Michael Holst |
| 28 |
% rcsid="$Id: fu.m,v 1.2 2008/03/12 06:23:07 fetk Exp $" |
| 29 |
|
| 30 |
lambda = parm(1); |
| 31 |
|
| 32 |
%%% element residual case: b(u)^i - a(u)^{iq}_{~;q} |
| 33 |
if (evalKey == 0) |
| 34 |
|
| 35 |
%%% value |
| 36 |
thetam = 0.0; |
| 37 |
|
| 38 |
%%% neumann face residual case: c(u)^i + a(u)^{iq} n_q |
| 39 |
elseif (evalKey == 1) |
| 40 |
|
| 41 |
%%% apply appropriate condition based on which boundary we are on |
| 42 |
thetam = 0.0; |
| 43 |
if (type == 2) |
| 44 |
thetam = pi*cos(pi*xm)*sin(pi*ym); |
| 45 |
elseif (type == 4) |
| 46 |
thetam = -pi*cos(pi*xm)*sin(pi*ym); |
| 47 |
elseif (type == 1) |
| 48 |
thetam = pi*sin(pi*xm)*cos(pi*ym); |
| 49 |
elseif (type == 3) |
| 50 |
thetam = -pi*sin(pi*xm)*cos(pi*ym); |
| 51 |
else |
| 52 |
thetam = 0; |
| 53 |
end |
| 54 |
|
| 55 |
%%% value |
| 56 |
thetam = thetam + ux .* nvec(:,1) + uy .* nvec(:,2); |
| 57 |
|
| 58 |
%%% interior face residual case: a(u)^{iq} n_q |
| 59 |
elseif (evalKey == 2) |
| 60 |
|
| 61 |
%%% initialization |
| 62 |
thetam = 0.0; |
| 63 |
|
| 64 |
%%% value |
| 65 |
thetam = thetam + ux * nvec(1) + uy * nvec(2); |
| 66 |
|
| 67 |
%%% error |
| 68 |
else |
| 69 |
assertw( 0, 'fu 1' ); |
| 70 |
end |
| 71 |
|