Attachment 'model_2_mag_finer_mesh.m'
Download 1 % COMSOL Multiphysics Model M-file
2 % Generated by COMSOL 3.5a (COMSOL 3.5.0.603, $Date: 2008/12/03 17:02:19 $)
3
4 flclear fem
5
6 % COMSOL version
7 clear vrsn
8 vrsn.name = 'COMSOL 3.5';
9 vrsn.ext = 'a';
10 vrsn.major = 0;
11 vrsn.build = 603;
12 vrsn.rcs = '$Name: $';
13 vrsn.date = '$Date: 2008/12/03 17:02:19 $';
14 fem.version = vrsn;
15
16 Inv=1/100;
17 num=80;
18 Detz=Inv/num;
19 z_i=-0.0185;
20 z_sus_vec=(z_i-(Inv/2):Detz:z_i+(Inv/2));
21
22 for i=1:num
23
24 flclear fem
25
26 z_sus_vec_new(i)=z_sus_vec(i);
27
28 % Geometry
29 g1=cylinder3('0.0381','0.0127','pos',{'0','0','-0.00635'},'axis',{'0','0','1'},'rot','0');
30 g2=cylinder3('0.01905','0.00635','pos',{'0','0',z_sus_vec(i)},'axis',{'0','0','1'},'rot','0');
31 g3=block3('0.15','0.15','0.15','base','center','pos',{'0','0','0'},'axis',{'0','0','1'},'rot','0');
32
33 % Analyzed geometry
34 clear s
35 s.objs={g1,g2,g3};
36 s.name={'CYL1','CYL2','BLK1'};
37 s.tags={'g1','g2','g3'};
38
39 fem.draw=struct('s',s);
40 fem.geom=geomcsg(fem);
41
42 % Initialize mesh
43 fem.mesh=meshinit(fem, ...
44 'hauto',4, ...
45 'hmaxsub',[2,0.002,3,0.001]);
46
47 % Initialize mesh
48 fem.mesh=meshinit(fem, ...
49 'hauto',4, ...
50 'hmaxsub',[2,0.002,3,0.001]);
51
52 % (Default values are not included)
53
54 % Application mode 1
55 clear appl
56 appl.mode.class = 'MagnetostaticsNoCurrents';
57 appl.module = 'ACDC';
58 appl.sshape = 2;
59 appl.assignsuffix = '_emnc';
60 clear bnd
61 bnd.type = {'nB0','cont'};
62 bnd.ind = [1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1];
63 appl.bnd = bnd;
64 clear equ
65 equ.magconstrel = {'mur','M','M'};
66 equ.M = {{0;0;0},{0;0;186211},{0;0;166078}};
67 equ.maxwell = {{},{},'sus'};
68 equ.ind = [1,2,3];
69 appl.equ = equ;
70 fem.appl{1} = appl;
71 fem.frame = {'ref'};
72 fem.border = 1;
73 clear units;
74 units.basesystem = 'SI';
75 fem.units = units;
76
77 % ODE Settings
78 clear ode
79 clear units;
80 units.basesystem = 'SI';
81 ode.units = units;
82 fem.ode=ode;
83
84 % Multiphysics
85 fem=multiphysics(fem);
86
87 % Extend mesh
88 fem.xmesh=meshextend(fem);
89
90 % Solve problem
91 fem.sol=femstatic(fem, ...
92 'solcomp',{'Vm'}, ...
93 'outcomp',{'Vm'}, ...
94 'blocksize','auto', ...
95 'linsolver','cg', ...
96 'prefun','amg');
97
98 % Save current fem structure for restart purposes
99 data=postglobaleval(fem,{'sus_forcez_emnc'});
100 z_force_vec(i)=data.y;
101 end
102 plot(z_sus_vec_new,z_force_vec);
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.
