[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Yves Renard |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Sun, 28 May 2017 11:22:52 -0400 (EDT) |
branch: devel-yves
commit a33f6e339efe1041d22066a36aec13710ec627ae
Author: Yves Renard <address@hidden>
Date: Sun May 28 16:08:43 2017 +0200
cosmetical changes
---
interface/tests/matlab/demo_laplacian_pyramid.m | 40 +++++++++++++++++++------
src/bgeot_convex_ref.cc | 3 +-
src/getfem/bgeot_poly.h | 2 --
src/getfem_fem.cc | 2 --
4 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/interface/tests/matlab/demo_laplacian_pyramid.m
b/interface/tests/matlab/demo_laplacian_pyramid.m
index d3a6b9c..1996abf 100644
--- a/interface/tests/matlab/demo_laplacian_pyramid.m
+++ b/interface/tests/matlab/demo_laplacian_pyramid.m
@@ -16,6 +16,7 @@
% Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
% Options for prescribing the Dirichlet condition
+clear all;
dirichlet_version = 1; % 0 = simplification, 1 = with multipliers,
% 2 = penalization, 3 = Nitsche's method
theta = 1; % Nitsche's method parameter theta
@@ -24,14 +25,13 @@ r = 1e8; % Penalization parameter
draw = true;
draw_mesh = false;
-K = 1; % Degree of the finite element method
+K = 2; % Degree of the finite element method
asize = size(who('automatic_var654'));
if (asize(1)) draw = false; end;
% trace on;
-gf_workspace('clear all');
-NX = 2;
+NX = 1;
m = gf_mesh('pyramidal', [0:1/NX:1], [0:1/NX:1], [0:1/NX:1]);
@@ -57,9 +57,11 @@ end
% Interpolate the exact solution
% Uexact = gf_mesh_fem_get(mf, 'eval', { '10*y.*(y-1).*x.*(x-1)+10*x.^5' });
Uexact = gf_mesh_fem_get(mf, 'eval', { 'x.*sin(2*pi*x).*sin(2*pi*y)' });
+% Uexact = gf_mesh_fem_get(mf, 'eval', { 'sin(x).*sin(y).*sin(z)' });
% Opposite of its laplacian
% F = gf_mesh_fem_get(mf, 'eval', {
'-(20*(x.^2+y.^2)-20*x-20*y+200*x.^3)' });
F = gf_mesh_fem_get(mf, 'eval', { '4*pi*(2*pi*x.*sin(2*pi*x) -
cos(2*pi*x)).*sin(2*pi*y)' });
+% F = gf_mesh_fem_get(mf, 'eval', { '-3*sin(x).*sin(y).*sin(z)' });
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
@@ -82,7 +84,6 @@ switch (dirichlet_version)
end
gf_model_get(md, 'solve');
U = gf_model_get(md, 'variable', 'u');
-Utest = U*0;
if (draw)
figure(2);
subplot(2,1,1); gf_plot(mf,U,'mesh','off', 'cvlst', gf_mesh_get(m, 'outer
faces'), 'refine', 4);
@@ -92,7 +93,32 @@ if (draw)
colorbar;title('exact solution');
end
-if(0)
+err = gf_compute(mf, Uexact-U, 'H1 norm', mim);
+
+disp(sprintf('H1 norm of error: %g', err));
+
+M = gf_asm('mass matrix', mim, mf);
+K = gf_asm('laplacian', mim, mf, mf, ones(1, gf_mesh_fem_get(mf, 'nbdof')));
+
+if (0) % Drawing the shape functions on the reference element
+ m2 = gf_mesh('empty', 3);
+ gf_mesh_set(m2, 'add convex', gf_geotrans('GT_PYRAMID(1)'), [-1 -1 0; 1,
-1, 0; -1, 1, 0; 1, 1, 0; 0, 0, 1]');
+ mf2 = gf_mesh_fem(m2,1);
+ gf_mesh_fem_set(mf2,'fem',gf_fem('FEM_PYRAMID_LAGRANGE(1)'));
+ Utest = zeros(1,gf_mesh_fem_get(mf2, 'nbdof'));
+ gf_mesh_fem_get(mf2, 'basic dof nodes')
+ for i = 1:size(Utest,2)
+ Utest(i) = 1;
+ figure(3);
+ gf_plot(mf2,Utest,'mesh','on', 'cvlst', gf_mesh_get(m2, 'outer faces'),
'refine', 8);
+ colorbar;title('shape function');
+ pause;
+ Utest(i) = 0;
+ end
+end
+
+if (0) % Drawing the shape functions on the whole mesh
+ Utest = U*0;
for i = 1:size(U,2)
Utest(i) = 1;
figure(3);
@@ -103,10 +129,6 @@ if(0)
end
end
-err = gf_compute(mf, Uexact-U, 'H1 norm', mim);
-
-disp(sprintf('H1 norm of error: %g', err));
-
if (err > 2E-4)
error('Laplacian test: error to big');
end
diff --git a/src/bgeot_convex_ref.cc b/src/bgeot_convex_ref.cc
index 82b00f9..75484bd 100644
--- a/src/bgeot_convex_ref.cc
+++ b/src/bgeot_convex_ref.cc
@@ -318,7 +318,8 @@ namespace bgeot {
}
pyramid_of_ref_(dim_type k) {
- GMM_ASSERT1(k == 1 || k == 2, "Sorry exist only in degree 1 or 2, not "
<< k);
+ GMM_ASSERT1(k == 1 || k == 2,
+ "Sorry exist only in degree 1 or 2, not " << k);
cvs = pyramidal_structure(k);
convex<base_node>::points().resize(cvs->nb_points());
diff --git a/src/getfem/bgeot_poly.h b/src/getfem/bgeot_poly.h
index 3c4275c..c441448 100644
--- a/src/getfem/bgeot_poly.h
+++ b/src/getfem/bgeot_poly.h
@@ -175,8 +175,6 @@ namespace bgeot
* variables of P plus the number of variables of Q.
* The resulting polynomials have a smaller degree.
*
- * @todo <h3>Horner scheme to evaluate polynomials.</h3>
- *
*/
template<typename T> class polynomial : public std::vector<T> {
protected :
diff --git a/src/getfem_fem.cc b/src/getfem_fem.cc
index 888cf7b..ecc9a80 100644
--- a/src/getfem_fem.cc
+++ b/src/getfem_fem.cc
@@ -1322,8 +1322,6 @@ namespace getfem {
"implemented only for degree 0, 1 or 2");
return pfem(p);
-
-
}