AnttiLehikoinen

Skin effect in slot-bound conductors

Apr 5th, 2017
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 5.16 KB | None | 0 0
  1. %AC resistance verification for slot-bound conductors
  2. %
  3. % (c) 2017 Antti Lehikoinen / Aalto University
  4.  
  5. addpath(genpath('SMEKlib'), '-begin');
  6.  
  7. condType = 'rect';
  8. %condType = 'circ';
  9.  
  10. w_cond = 4e-3; %conductor width
  11. w_gap = 0.0e-3; %vertical gap between conductors
  12. w_slot = 5e-3; %slot width
  13. N = 6; %number of conductors
  14.  
  15. sigma = 5.96e7; %copper conductivity
  16. mur_iron = 5000; %iron relative permeability
  17. f = 50; %supply frequency
  18.  
  19. h_yoke = 2e-2; %yoke height
  20. h_free = 1e-2; %free space at slot opening
  21. h_air = 1.5e-2;
  22.  
  23. w_domain = 3e-2; %domain width
  24.  
  25. leff = 1; %length in z-direction
  26.  
  27. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  28. % generating geometry and meshing
  29.  
  30. %generating geometry description for conductors
  31. c_centers = linspace(0, (N-1)*(w_cond+w_gap), N);
  32.  
  33. figure(1); clf; hold on; box on;
  34.  
  35. %conductors
  36. if strcmp(condType, 'rect')
  37.     G_cond_r = zeros(2+4*2, N);
  38. elseif strcmp(condType, 'circ')
  39.     G_cond_r = zeros(4, N);
  40. end
  41. for k = 1:N
  42.     if strcmp(condType, 'rect')
  43.         G_cond_r(:, k) = [3 4 w_cond/2*[-1 1 1 -1] c_centers(k)+w_cond/2*[-1 -1 1 1]]';
  44.     elseif strcmp(condType, 'circ')
  45.         G_cond_r(:, k) = [1 0 c_centers(k) w_cond/2]';
  46.     else
  47.         error('Invalid conductor shape.')
  48.     end
  49. end
  50. mPlotG(G_cond_r, 'r'); axis equal;
  51.  
  52. %slot box
  53. yb = (-w_cond/2-w_gap-h_yoke);
  54. yb_s = -w_cond/2-w_gap;
  55. yt = c_centers(end) + w_cond/2+w_gap + h_free;
  56. G_slot = [3 0 w_domain/2*[-1 -1] w_slot/2*[-1 -1 1 1] w_domain/2*[1 1] ...
  57.     yb yt*[1 1] yb_s*[1 1] yt*[1 1] yb]';
  58. G_slot(2) = (numel(G_slot)-2)/2;
  59.  
  60. mPlotG(G_slot, 'c');
  61.  
  62. %full domain box
  63. G_box = [3 0 w_domain/2*[-1 -1 1 1] ...
  64.     yb (yt+h_air)*[1 1] yb]';
  65. G_box(2) = (numel(G_box)-2)/2;
  66. mPlotG(G_box, 'k:')
  67.  
  68. Gtot = zeropadcat(G_box, G_slot, G_cond_r);
  69.  
  70. %namespace
  71. slot_ns = ['b' 'i' char('s'*ones(1,N))];
  72.  
  73. %set formula
  74. slot_sf = 'b';
  75.  
  76. %creating empty model and adding geometry
  77. slot_model = createpde(1);
  78. %adding geometry to the model
  79. [slot_dl, slot_bt] = decsg(Gtot, slot_sf, slot_ns);
  80. geometryFromEdges(slot_model, slot_dl);
  81.  
  82. %meshing
  83. generateMesh(slot_model, 'GeometricOrder', 'linear');
  84.  
  85. %extracting nicer data and refining
  86. [p, e, t] = meshToPet(slot_model.Mesh);
  87. [p, e, t] = refinemesh(slot_dl, p, e, t);
  88. %[p, e, t] = refinemesh(slot_dl, p, e, t, 3:(3+N-1));
  89.  
  90. %getting conductor elements
  91. el_iron = get_elementsInDomain(slot_bt(:,2), t(4,:)); el_iron = el_iron{1};
  92. el_conductors = get_elementsInDomain(slot_bt(:,3:end), t(4,:));
  93.  
  94. msh = inittri(p, t(1:3,:));
  95.  
  96. figure(2); clf; hold on; box on; axis equal;
  97. msh_triplot(msh, [], 'g');
  98. msh_triplot(msh, el_iron, 'k');
  99. msh_triplot(msh, horzcat(el_conductors{:}), 'r');
  100.  
  101. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  102. % assembling matrices and solving
  103.  
  104. Np = size(msh.p, 2); Ne = size(msh.t, 2);
  105. Dnodes = unique(msh.edges(:, ~msh.e2t(2,:)) ); msh_plot(msh, Dnodes, 'ko');
  106. freeVars = setdiff(1:(Np+N+1), Dnodes);
  107.  
  108. mu0 = pi*4e-7;
  109. nu = ones(1, Ne)/mu0; nu(el_iron) = 1/(mur_iron*mu0);
  110.  
  111. %stiffness matrix
  112. S_struct = assemble_matrix('grad', 'nodal', 'grad', 'nodal', nu, [], msh, []);
  113. S = sparseFinalize(S_struct, Np, Np); clear S_struct;
  114.  
  115. %mass matrix
  116. M_struct = assemble_matrix('', 'nodal', '', 'nodal', sigma, horzcat(el_conductors{:}), msh, []);
  117. M = sparseFinalize(M_struct, Np, Np); clear M_struct;
  118.  
  119. %coupling matrix between voltages and the vector potential
  120. CF_struct = [];
  121. for kc = 1:N
  122.     CF_struct = assemble_vector('', 'nodal', sigma, kc, el_conductors{kc}, msh, CF_struct);
  123. end
  124. CF = sparseFinalize(CF_struct, Np, N);
  125. cA = sum(CF*speye(N, N), 1);
  126. DR = sparsediag( leff ./ cA );
  127.  
  128. L = ones(N, 1); %loop matrix
  129.  
  130. %assembling final matrix and solving
  131. w = 2*pi*f;
  132. Qtot = [S+1i*w*M -1/leff*CF sparse(Np, 1);
  133.     DR*1i*w*transpose(CF) -speye(N,N) DR*L;
  134.     sparse(1, Np) transpose(L) sparse(1, 1)];
  135.  
  136. X = zeros(Np+N+1, 1);
  137. X(freeVars) = Qtot(freeVars, freeVars) \ [zeros(numel(freeVars)-1,1);1];
  138.  
  139. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  140. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  141. % post-processing
  142.  
  143. % plotting flux lines and current density
  144. figure(3); clf; hold on; box on;
  145. %current density:
  146. J = zeros(Np, 1);
  147. for k = 1:N
  148.     n_c = unique( msh.t(:, el_conductors{k}) );
  149.     J(n_c) = -1i*w*X(n_c)*sigma + sigma/leff*repmat(X(Np+k), numel(n_c,1), 1);
  150.    
  151.     subplot(1, 2, 1); hold on;
  152.     drawCurrentDensity(msh, 1e6*J, horzcat(el_conductors{k}));
  153.    
  154.     subplot(1, 2, 2); hold on; box on;
  155.     drawCurrentDensity(msh, 1e6*J, horzcat(el_conductors{k}));
  156. end
  157. subplot(1, 2, 1);
  158. colorbar;
  159. %flux lines:
  160. drawFluxLines(msh, real(X(1:Np)), 20, 'k');
  161. %plotting geometry objects for clarity
  162. mPlotG(G_cond_r, 'k');
  163. mPlotG(G_slot, 'k');
  164. mPlotG(G_box, 'k');
  165. axis([w_domain/2*[-1 1] yb (yt+h_air)]);
  166. daspect([1 1 1]);
  167. title('Flux lines and current density');
  168.  
  169.  
  170. subplot(1, 2, 2); hold on; box on;
  171. %drawCurrentDensity(msh, J, horzcat(el_conductors{:}));
  172. mPlotG(G_cond_r, 'k');
  173. axis([w_slot/2*[-1 1] yb_s yt]);
  174. daspect([1 1 1]);
  175. title('Zoom-in of current density')
  176.  
  177.  
  178. %computing conductor impedances
  179. I = X(end); U = X((Np+1):(Np+N));
  180.  
  181. Z = U/I
  182. R = full(diag(DR));
  183.  
  184. real(Z)./R
Advertisement
Add Comment
Please, Sign In to add comment