How to change the Jacobian settings (full, fixed, lumped) when using solvepde?

2 ビュー (過去 30 日間)
Hassan Baji
Hassan Baji 2017 年 5 月 25 日
コメント済み: Hassan Baji 2017 年 6 月 2 日
Anyone knows how to change the Jacobian setting (full, fixed, lumped) when using solvepde. The legacy pdenonlin allows you to change the setting, but it appears that solvepde does not have the option.
Thank you.

回答 (1 件)

J Philps
J Philps 2017 年 6 月 1 日
You are right, Jacobian selection option is no longer supported in the new workflow introduced since R2016a. Note that even in pdenonlin, the Jacobian selection was limited to 2-D problems. Approximate Jacobian, by specifying ‘fixed’ or ‘lumped’ options, often results in convergence issues.
Could you please share your workflow and any possible reason to not use the default full Jacobian?
  1 件のコメント
Hassan Baji
Hassan Baji 2017 年 6 月 2 日
Thanks Philps,
Here is my a simple code I am trying to solve. My actual problem is 3D. It is actually a water seepage problem, which is very similar to heat transfer.
clc clear clf
tic
B = 10; H = 10; a = 2; km = 0.01; ki = 0.10; ti = 0.02;
ht = 100; hb = 0; grad = (ht - hb)/H;
model = createpde;
R = [3 4 -B/2 B/2 B/2 -B/2 -H/2 -H/2 H/2 H/2]';
C = [1, 0, 0, a]'; C = [C; zeros(length® - length(C), 1)];
gd = [R, C];
ns = char('R', 'C'); ns = ns';
sf = 'R-C';
[g, bt] = decsg(gd, sf, ns);
pdegplot(g,'EdgeLabels','on','FaceLabels','on') xlim(1.5*[-B/2, B/2]) ylim(1.5*[-H/2, H/2]) axis equal
pg = geometryFromEdges(model, g);
applyBoundaryCondition(model, 'dirichlet', 'edge', 2, 'u', ht); applyBoundaryCondition(model, 'dirichlet', 'edge', 4, 'u', hb); applyBoundaryCondition(model, 'neumann', 'edge', [1, 3], 'g', 0, 'q', 0);
g = @(region, state) gpdenonlin(region, state, ki, ti, a);
applyBoundaryCondition(model, 'neumann','edge', 5:8, 'g', g, 'q', 0, 'Vectorized', 'on');
specifyCoefficients(model,'m', 0, 'd', 0, 'c', -km, 'a', 0,'f', 0);
generateMesh(model, 'GeometricOrder','linear', 'Hmax', 0.5);
u = pdenonlin(model, -km, 0, 0,'Report','on', 'Jacobian', 'fixed'); results = createPDEResults(model, u);
[gcxu, gcyu] = evaluateCGradient(results); pdeplot(model,'XYData', u, 'Mesh', 'off', 'Contour', 'on', 'FlowData', [gcxu, gcyu]) axis equal
n = 20; xq = linspace(-B/2, B/2, n); yq = (-H/2)*ones(1, n); [qx, qy] = evaluateCGradient(results, xq, yq);
[p, e, t] = model.Mesh.meshToPet();
Qy = -trapz(xq, qy);
disp(Qy)
toc
The Neumann boundary condition is a function with the following code:
function gcoeff = gpdenonlin(region, state, ki, ti, a)
[theta, ~] = cart2pol(region.x, region.y);
hh = 4*del2(state.u, theta);
gcoeff(1, :) = -(ki*ti./a^2)*hh;
end
The problem is that, when you change the setting to "full", it does not converge.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by