モデルの作成

静電モデルの例は2次元だったが、ここでは3次元モデルを扱う。 今回のモデルは、単純な形状をしているので、Gmshのモデラで作成していく。 3次元形状を作成するとき、対称性などを用いると簡単に作成できる場合がある。 今回は軸対象であるが、2次元の円から「押し出し(Extrude)」を用いる。

Gmshの円の作成方法は、円弧を組み合わせて円にしていく。

lc = DefineNumber[ 0.05, Name "Parameters/lc" ];

lc2 = lc;
lb = 1.0;
core_rad = 0.18;
rt2 = 0.25;
rt1 = 0.2;
bz = 0.0;
ht = 0.25;

er = 0.3;
eh = 0.1;
eg = 0.01;
eb = -eg;
// inductor tube
bz = 0.0;
p = newp;
Point(p) = {0, 0, bz, lc2};
Point(p+1) = {rt1, 0, bz, lc2};
Point(p+2) = {0, rt1, bz, lc2};
Point(p+3) = {-rt1, 0, bz, lc2};
Point(p+4) = {0, -rt1, bz, lc2};
Point(p+5) = {rt2, 0, bz, lc2};
Point(p+6) = {0, rt2, bz, lc2};
Point(p+7) = {-rt2, 0, bz, lc2};
Point(p+8) = {0, -rt2, bz, lc2};
c = newc;
Circle(c) = {p+1, p, p+2};
Circle(c+1) = {p+2, p, p+3};
Circle(c+2) = {p+3, p, p+4};
Circle(c+3) = {p+4, p, p+1};
Circle(c+4) = {p+5, p, p+6};
Circle(c+5) = {p+6, p, p+7};
Circle(c+6) = {p+7, p, p+8};
Circle(c+7) = {p+8, p, p+5};
ll = newll;
Line Loop(ll) = {c+4, c+5, c+6, c+7, -c, -(c+1), -(c+2), -(c+3)};
s = news;
Plane Surface(s) = {ll};
tmp[] = Extrude {0,0,ht}{ Surface{s}; };
vol_coil = tmp[1];

最初の14行程は、形状の寸法を変数に代入している部分である。 「// inductor tube」以降が、電流部分のコイル部分の形状定義である。 Gmshで作成すると、自動的に生の数字が形状定義に使われてしまい、判読性が悪い。 また同じ形状を寸法を変えて使いたいときは、番号を手作業で変更していかなければならない。 ここで注意して欲しいのは、newpやnewcなどの組み込み関数を使うことで、生の数字を扱わないで済むということである。

newpは、Pointで使える番号を返してくれる関数である。 この"new"関数は、形状定義関数の頭文字から決められている。 例えば円:Circleなら、newc、Surfaceならnews、というようになっている。

さて、inductor tubeの作成だが、まず、2つある同心円を決めるためのアンカー点を定義し、その後そこから同心円二つを定義し、さらにチューブの穴あき円の底面の定義をし、最後にそれを押し出して体の定義をする、という流れになっている。

Point(p)で、中心円を定義し、まず内側の円のxy軸との交点座標を指定する。Point(p+5)以降は外側の円である。 次に、その点を用いて、円弧を定義していく。ここでは$\pi/2$刻みで円弧を定義している。 そして、Line Loop(ll)で面を定義している、 最後にLine LoopからSurfaceを定義し、それをExtrude関数で押し出ししてチューブ領域を作成している。

その他の領域も同様に作成することが出来る。

 


モデルの作成:GetDP


ここでは静電モデルでの説明と重複を避け、重要なところについて説明していく。


Function

 


Function {
...
vDir[] = ( Vector [Sin[Atan2[Y[],X[]]#1], -Cos[#1],0] );
//#1: register of 1 refer to p22 getdp manual
js0[Inds] = vDir[] ; // Inds domain only

電流モデルは、解析解で円柱内部を均一に流れていると仮定する。
GetDPでは、組み込み関数があり、このようなときに重宝する。
ここでは、おなじみの三角関数、Sin, Atan2, Cosを用いている。
ここで大文字のX[],Y[],Z[]は座標値を示している。
また、独自の機能として、#1, #2をつかって一時的に項の値をレジスターに入れることによって後で再利用することが出来る。
ここでは、[Atan2[Y[],X[]]#1]として、Atan2の計算結果をレジスター#1に入れていて、Cosの計算をするときに、その値を用いている。
これは無駄な重複を避けるための独自機能である。

 


FunctionSpace

FunctionSpace {

  // Magnetic vector potential a (b = curl a)
  { Name Hcurl_a_3D ; Type Form1 ;
    BasisFunction {// a = a_e * s_e
      { Name se ; NameOfCoef ae ; Function BF_Edge ;
        Support Domain ; Entity EdgesOf[ All, Not SkinDomainC ] ; }
      { Name se2 ; NameOfCoef ae2 ; Function BF_Edge ;
        Support Domain ; Entity EdgesOf[ SkinDomainC ] ; }
    }
    Constraint {
      { NameOfCoef ae  ; EntityType EdgesOf ; NameOfConstraint MVP_3D ; }
      { NameOfCoef ae2 ; EntityType EdgesOf ; NameOfConstraint MVP_3D ; }
    }
  }

  // Electric scalar potential (3D)
  { Name Hregion_u_3D ; Type Form0 ;
    BasisFunction {
      { Name sr ; NameOfCoef ur ; Function BF_Node ;
        Support DomainC ; Entity NodesOf[ All ] ; }
    }
    Constraint {
      { NameOfCoef ur ; EntityType NodesOf ; NameOfConstraint V ; }
    }
  }

  { Name H_xi ; Type Form0 ;
    BasisFunction {
      { Name sn ; NameOfCoef an ; Function BF_Node ;
        Support Domain ; Entity NodesOf[ All ] ; }
      
    }
    Constraint {
      { NameOfCoef an ; EntityType NodesOf ; NameOfConstraint xi_fixed ; }
    }
  }
        
}

静電ポテンシャル問題ではBF_Node基底関数を用いたが、回転系のポテンシャルである磁気ベクトルポテンシャルは、辺要素、BF_Edge基底関数を用いる。

 


Formulation

ここでは、支配方程式の弱形式をそのまま記述していく。

Formulation {

  { Name MagStaDyn_av_js0_3D ; Type FemEquation ;
    Quantity {
      { Name a  ; Type Local ; NameOfSpace Hcurl_a_3D ; }
      { Name v  ; Type Local ; NameOfSpace Hregion_u_3D ; }
      { Name xi  ; Type Local ; NameOfSpace H_xi ; }
    }

    Equation {
      Galerkin { [ nu[] * Dof{d a} , {d a} ] ;
        In Domain ; Jacobian Vol ; Integration II ; }
      Galerkin { DtDof[ sigma[] * Dof{a} , {a} ] ;
        In DomainC ; Jacobian Vol ; Integration II ; }
      Galerkin { [ sigma[] * Dof{d v} , {a} ] ;
        In DomainC ; Jacobian Vol ; Integration II ; }

      Galerkin { [ -js0[], {a} ] ;
        In  DomainS ; Jacobian Vol ; Integration II ; }


      Galerkin{ DtDof[ sigma[] * Dof{a}, {d v} ] ;
        In DomainC ; Jacobian Vol ; Integration II ; }
      Galerkin{ [ sigma[] * Dof{d v} , {d v} ] ;
        In DomainC ; Jacobian Vol ; Integration II ; }
 
       Galerkin { [ Dof{a}, {d xi} ] ;
        In  Domain ; Jacobian Vol ; Integration II ; }
      Galerkin { [ Dof{d xi}, {a} ] ;
        In  Domain ; Jacobian Vol ; Integration II ; }
      
    }
  }

}

 


Attachments:
Download this file (ring3d_cg.zip)ring3d_cg.zip[Coulomb Gauge Script Files]3 kB

FaLang translation system by Faboba