-
Notifications
You must be signed in to change notification settings - Fork 26
/
sandbox.m
75 lines (70 loc) · 1.67 KB
/
sandbox.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
%% This is a sandbox file!
% % Feel free to test anything here :)
% % clc; clear; close all;
%
% % Load mesh
% file = 'test2d_micro';
% a.fileName = file;
% s = FemDataContainer(a);
% mesh = s.mesh;
% clear s;
%
% % Create functions
%
% sAF.fHandle = @(x) x(1,:,:);
% sAF.ndimf = 1;
% sAF.mesh = mesh;
% xFun = AnalyticalFunction(sAF);
%
% p1trial = xFun.project('P1');
% % p1trial = P1Function.create(mesh, 1);
% p0test = P0Function.create(mesh, 1);
%
% % LHS integrator
%
% s.type = 'MassTestTrial';
% s.mesh = mesh;
% s.test = p0test;
% s.trial = p1trial;
% lhs = LHSintegrator.create(s);
% LHS = lhs.compute();
%
% % Mass P0
%
% s.type = 'MassTestTrial';
% s.mesh = mesh;
% s.test = p0test;
% s.trial = p0test;
% mp0 = LHSintegrator.create(s);
% MP0 = mp0.compute();
%
% % Testing
%
% gj = MP0\(LHS*p1trial.fValues);
%
% z.fValues = gj;
% z.mesh = mesh;
% p0_result = P0Function(z);
% %% Generating a 2D mesh with a hole inclusion
% % Using functions!
% clear; close all
%
% % Create the data container for the FEM problem
% a.fileName = 'test2d_micro';
% m = FemDataContainer(a);
%
% % Create the characteristic function (1 inside circle, 0 outside)
% s.mesh = m.mesh;
% s.fxy = @(x,y) (x-0.5).^2+(y-0.5).^2-0.3.^2;
% circleFun = CharacteristicFunction(s);
%% Generating a 3D mesh with a hole inclusion
% Using functions!
clc; clear; close all
% Create the data container for the FEM problem
% a.fileName = 'holeinclusion3d';
a.fileName = 'test3d_micro_cube';
m = FemDataContainer(a);
% Create the characteristic function (1 inside circle, 0 outside)
s.mesh = m.mesh;
s.fxy = @(x,y,z) (x-0.5).^2+(y-0.5).^2+(z-0.5).^2 -0.3.^2;
circleFun = CharacteristicFunction(s);