Skip to content
Snippets Groups Projects
Commit 07a45107 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

pp

parent ae6dc194
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -8,14 +8,14 @@ DefineConstant[
];
Group{
Domain_M = Region[{}];
Vol_Magnets_Mag = Region[{}];
For i In {1:NumMagnets}
Magnet~{i} = Region[i]; // volume of magnet i
SkinMagnet~{i} = Region[(100+i)]; // boundary of magnet i
Domain_M += Region[Magnet~{i}]; // all the magnet volumes
Vol_Magnets_Mag += Region[Magnet~{i}]; // all the magnet volumes
EndFor
Air = Region[(NumMagnets + 1)];
Domain = Region[{Air, Domain_M}];
Vol_Mag = Region[{Air, Vol_Magnets_Mag}];
Dirichlet_phi_0 = Region[(NumMagnets + 2)]; // boundary of air box
Dirichlet_a_0 = Region[(NumMagnets + 2)]; // boundary of air box
}
......@@ -81,11 +81,11 @@ Constraint {
}
{ Name GaugeCondition_a ; Type Assign ;
Case {
{ Region Domain ; SubRegion Dirichlet_a_0 ; Value 0. ; }
{ Region Vol_Mag ; SubRegion Dirichlet_a_0 ; Value 0. ; }
}
}
For i In {1:NumMagnets}
{ Name Magnet~{i} ;
{ Name un~{i} ;
Case {
{ Region SkinMagnet~{i} ; Value 1. ; }
}
......@@ -98,7 +98,7 @@ FunctionSpace {
{ Name Hgrad_phi ; Type Form0 ;
BasisFunction {
{ Name sn ; NameOfCoef phin ; Function BF_Node ;
Support Domain ; Entity NodesOf[ All ] ; }
Support Vol_Mag ; Entity NodesOf[ All ] ; }
}
Constraint {
{ NameOfCoef phin ; EntityType NodesOf ; NameOfConstraint phi ; }
......@@ -107,7 +107,7 @@ FunctionSpace {
// vector magnetic potential
{ Name Hcurl_a; Type Form1;
BasisFunction {
{ Name se; NameOfCoef ae; Function BF_Edge; Support Domain ;
{ Name se; NameOfCoef ae; Function BF_Edge; Support Vol_Mag ;
Entity EdgesOf[ All ]; }
}
Constraint {
......@@ -120,13 +120,13 @@ FunctionSpace {
// auxiliary field on layer of elements touching each magnet, for the
// accurate integration of the Maxwell stress tensor (using the gradient of
// this field)
{ Name Magnet~{i} ; Type Form0 ;
{ Name H_un~{i} ; Type Form0 ;
BasisFunction {
{ Name sn ; NameOfCoef un ; Function BF_GroupOfNodes ;
Support Air ; Entity GroupsOfNodesOf[ SkinMagnet~{i} ] ; }
}
Constraint {
{ NameOfCoef un ; EntityType GroupsOfNodesOf ; NameOfConstraint Magnet~{i} ; }
{ NameOfCoef un ; EntityType GroupsOfNodesOf ; NameOfConstraint un~{i} ; }
}
}
EndFor
......@@ -137,17 +137,17 @@ Formulation {
Quantity {
{ Name phi ; Type Local ; NameOfSpace Hgrad_phi ; }
For i In {1:NumMagnets}
{ Name un~{i} ; Type Local ; NameOfSpace Magnet~{i} ; }
{ Name un~{i} ; Type Local ; NameOfSpace H_un~{i} ; }
EndFor
}
Equation {
Galerkin { [ - mu[] * Dof{d phi} , {d phi} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Galerkin { [ - mu[] * hc[] , {d phi} ] ;
In Domain_M ; Jacobian JVol ; Integration I1 ; }
Integral { [ - mu[] * Dof{d phi} , {d phi} ] ;
In Vol_Mag ; Jacobian JVol ; Integration I1 ; }
Integral { [ - mu[] * hc[] , {d phi} ] ;
In Vol_Magnets_Mag ; Jacobian JVol ; Integration I1 ; }
For i In {1:NumMagnets} // dummy term to define dofs for fully fixed space
Galerkin { [ 0 * Dof{un~{i}} , {un~{i}} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Integral { [ 0 * Dof{un~{i}} , {un~{i}} ] ;
In Vol_Mag ; Jacobian JVol ; Integration I1 ; }
EndFor
}
}
......@@ -155,17 +155,17 @@ Formulation {
Quantity {
{ Name a ; Type Local ; NameOfSpace Hcurl_a ; }
For i In {1:NumMagnets}
{ Name un~{i} ; Type Local ; NameOfSpace Magnet~{i} ; }
{ Name un~{i} ; Type Local ; NameOfSpace H_un~{i} ; }
EndFor
}
Equation {
Galerkin { [ nu[] * Dof{d a} , {d a} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Galerkin { [ nu[] * br[] , {d a} ] ;
In Domain_M ; Jacobian JVol ; Integration I1 ; }
Integral { [ nu[] * Dof{d a} , {d a} ] ;
In Vol_Mag ; Jacobian JVol ; Integration I1 ; }
Integral { [ nu[] * br[] , {d a} ] ;
In Vol_Magnets_Mag ; Jacobian JVol ; Integration I1 ; }
For i In {1:NumMagnets} // dummy term to define dofs for fully fixed space
Galerkin { [ 0 * Dof{un~{i}} , {un~{i}} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Integral { [ 0 * Dof{un~{i}} , {un~{i}} ] ;
In Vol_Mag ; Jacobian JVol ; Integration I1 ; }
EndFor
}
}
......@@ -214,39 +214,90 @@ Resolution {
PostProcessing {
{ Name MagSta_phi ; NameOfFormulation MagSta_phi ;
Quantity {
{ Name b ; Value { Local { [ - mu[] * {d phi} ] ; In Domain ; Jacobian JVol ; }
Local { [ - mu[] * hc[] ] ; In Domain_M ; Jacobian JVol ; } } }
{ Name h ; Value { Local { [ - {d phi} ] ; In Domain ; Jacobian JVol ; } } }
{ Name hc ; Value { Local { [ hc[] ] ; In Domain_M ; Jacobian JVol ; } } }
{ Name phi ; Value { Local { [ {phi} ] ; In Domain ; Jacobian JVol ; } } }
{ Name b ; Value {
Term { [ - mu[] * {d phi} ] ; In Vol_Mag ; Jacobian JVol ; }
Term { [ - mu[] * hc[] ] ; In Vol_Magnets_Mag ; Jacobian JVol ; }
}
}
{ Name h ; Value {
Term { [ - {d phi} ] ; In Vol_Mag ; Jacobian JVol ; }
}
}
{ Name hc ; Value {
Term { [ hc[] ] ; In Vol_Magnets_Mag ; Jacobian JVol ; }
}
}
{ Name phi ; Value {
Term { [ {phi} ] ; In Vol_Mag ; Jacobian JVol ; }
}
}
For i In {1:NumMagnets}
{ Name un~{i} ; Value { Local { [ {un~{i}} ] ; In Domain ; Jacobian JVol ; } } }
{ Name f~{i} ; Value { Integral { [ - TM[-mu[] * {d phi}] * {d un~{i}} ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fx~{i} ; Value { Integral { [ CompX[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fy~{i} ; Value { Integral { [ CompY[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fz~{i} ; Value { Integral { [ CompZ[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name un~{i} ; Value {
Term { [ {un~{i}} ] ; In Vol_Mag ; Jacobian JVol ; }
}
}
{ Name f~{i} ; Value {
Integral { [ - TM[-mu[] * {d phi}] * {d un~{i}} ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fx~{i} ; Value {
Integral { [ CompX[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fy~{i} ; Value {
Integral { [ CompY[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fz~{i} ; Value {
Integral { [ CompZ[- TM[-mu[] * {d phi}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
EndFor
}
}
{ Name MagSta_a ; NameOfFormulation MagSta_a ;
PostQuantity {
{ Name b ; Value { Local { [ {d a} ]; In Domain ; Jacobian JVol; } } }
{ Name a ; Value { Local { [ {a} ]; In Domain ; Jacobian JVol; } } }
{ Name br ; Value { Local { [ br[] ]; In Domain_M ; Jacobian JVol; } } }
{ Name b ; Value {
Term { [ {d a} ]; In Vol_Mag ; Jacobian JVol; }
}
}
{ Name a ; Value {
Term { [ {a} ]; In Vol_Mag ; Jacobian JVol; }
}
}
{ Name br ; Value {
Term { [ br[] ]; In Vol_Magnets_Mag ; Jacobian JVol; }
}
}
For i In {1:NumMagnets}
{ Name un~{i} ; Value { Local { [ {un~{i}} ] ; In Domain ; Jacobian JVol ; } } }
{ Name f~{i} ; Value { Integral { [ - TM[{d a}] * {d un~{i}} ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fx~{i} ; Value { Integral { [ CompX[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fy~{i} ; Value { Integral { [ CompY[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name fz~{i} ; Value { Integral { [ CompZ[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; } } }
{ Name un~{i} ; Value {
Term { [ {un~{i}} ] ; In Vol_Mag ; Jacobian JVol ; }
}
}
{ Name f~{i} ; Value {
Integral { [ - TM[{d a}] * {d un~{i}} ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fx~{i} ; Value {
Integral { [ CompX[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fy~{i} ; Value {
Integral { [ CompY[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
{ Name fz~{i} ; Value {
Integral { [ CompZ[- TM[{d a}] * {d un~{i}} ] ] ;
In Air ; Jacobian JVol ; Integration I1 ; }
}
}
EndFor
}
}
......@@ -255,13 +306,13 @@ PostProcessing {
PostOperation {
{ Name MagSta_phi ; NameOfPostProcessing MagSta_phi;
Operation {
Print[ b, OnElementsOf Domain, File "b.pos" ] ;
Print[ b, OnElementsOf Vol_Mag, File "b.pos" ] ;
Print[ b, OnPlane{ {-0.1,-0.1,0} {0.1,-0.1,0} {-0.1,0.1,0} } {50, 50},
File "b_cut1.pos" ];
//Print[ h, OnElementsOf Domain, File "h.pos" ] ;
//Print[ hc, OnElementsOf Domain, File "hc.pos" ] ;
//Print[ h, OnElementsOf Vol_Mag, File "h.pos" ] ;
//Print[ hc, OnElementsOf Vol_Mag, File "hc.pos" ] ;
For i In {1:NumMagnets}
//Print[ un~{i}, OnElementsOf Domain, File "un.pos" ];
//Print[ un~{i}, OnElementsOf Vol_Mag, File "un.pos" ];
Print[ f~{i}[Air], OnGlobal, Format Table, File > "F.dat" ];
Print[ fx~{i}[Air], OnGlobal, Format Table, File > "Fx.dat",
SendToServer Sprintf("Output/Magnet %g/X force [N]", i), Color "Ivory" ];
......@@ -274,13 +325,13 @@ PostOperation {
}
{ Name MagSta_a ; NameOfPostProcessing MagSta_a ;
Operation {
Print[ b, OnElementsOf Domain, File "b.pos" ];
Print[ b, OnElementsOf Vol_Mag, File "b.pos" ];
Print[ b, OnPlane{ {-0.1,-0.1,0} {0.1,-0.1,0} {-0.1,0.1,0} } {50, 50},
File "b_cut1.pos" ];
//Print[ br, OnElementsOf Domain_M, File "br.pos" ];
//Print[ a, OnElementsOf Domain, File "a.pos" ];
//Print[ br, OnElementsOf Vol_Magnets_Mag, File "br.pos" ];
//Print[ a, OnElementsOf Vol_Mag, File "a.pos" ];
For i In {1:NumMagnets}
//Print[ un~{i}, OnElementsOf Domain, File "un.pos" ];
//Print[ un~{i}, OnElementsOf Vol_Mag, File "un.pos" ];
Print[ f~{i}[Air], OnGlobal, Format Table, File > "F.dat" ];
Print[ fx~{i}[Air], OnGlobal, Format Table, File > "Fx.dat",
SendToServer Sprintf("Output/Magnet %g/X force [N]", i), Color "Ivory" ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment