diff --git a/Electrostatics/microstrip.pro b/Electrostatics/microstrip.pro index e511520f1767ce00331bb1ad778c56ef71e201b3..7b152d65acb6b445a9ead1a20bb15163311ef063 100644 --- a/Electrostatics/microstrip.pro +++ b/Electrostatics/microstrip.pro @@ -52,19 +52,19 @@ Group { /* We now define abstract regions to be used below in the definition of the scalar electric potential formulation: - Vol_Ele : volume where -Div(epsilon Grad v) = 0 is solved - Sur_Neumann_Ele: surface where non homogeneous Neumann boundary conditions - (on n.d == epsilon n.Grad v) are imposed + Vol_Ele : volume where -Div(epsilon Grad v) = 0 is solved + Sur_Neu_Ele: surface where non homogeneous Neumann boundary conditions + (on n.d == epsilon n.Grad v) are imposed Vol_xxx groups contain only volume elements of the mesh (triangles here). Sur_xxx groups contain only surface elements of the mesh (lines here). Since there are no non-homogeneous Neumann conditions in the model, - Sur_Neumann_Ele is defined as empty. + Sur_Neu_Ele is defined as empty. */ Vol_Ele = Region[ {Air, Diel1} ]; - Sur_Neumann_Ele = Region[ {} ]; + Sur_Neu_Ele = Region[ {} ]; } Function { @@ -99,7 +99,7 @@ Group{ both volume and surface regions. Hence the use of the prefixes Vol_, Sur_ and Dom_ to avoid confusions.*/ - Dom_Hgrad_v_Ele = Region[ {Vol_Ele, Sur_Neumann_Ele} ]; + Dom_Hgrad_v_Ele = Region[ {Vol_Ele, Sur_Neu_Ele} ]; } FunctionSpace { diff --git a/ElectrostaticsFloating/floating.pro b/ElectrostaticsFloating/floating.pro index b099cffcc058d652c6f13b65c40f0f4010b9dc0f..5b668d5050011cb30216d21a6419234d2a707767 100644 --- a/ElectrostaticsFloating/floating.pro +++ b/ElectrostaticsFloating/floating.pro @@ -57,12 +57,12 @@ Group { /* Abstract regions: Vol_Ele : volume where -Div(epsilon Grad v) = 0 is solved - Sur_Neumann_Ele : surface where non homogeneous Neumann boundary conditions + Sur_Neu_Ele : surface where non homogeneous Neumann boundary conditions (on n.d == epsilon n.Grad v) are imposed Sur_Electrodes_Ele : electrode regions */ Vol_Ele = Region[ {Air, Diel1} ]; - Sur_Neumann_Ele = Region[ {} ]; + Sur_Neu_Ele = Region[ {} ]; Sur_Electrodes_Ele = Region [ {Ground, Microstrip} ]; } @@ -117,7 +117,7 @@ Constraint { Group{ /* The domain of definition lists all regions on which the field "v" is defined.*/ - Dom_Hgrad_v_Ele = Region[ {Vol_Ele, Sur_Neumann_Ele, Sur_Electrodes_Ele} ]; + Dom_Hgrad_v_Ele = Region[ {Vol_Ele, Sur_Neu_Ele, Sur_Electrodes_Ele} ]; } FunctionSpace { diff --git a/Magnetodynamics/Lib_MagStaDyn_av_2D_Cir.pro b/Magnetodynamics/Lib_MagStaDyn_av_2D_Cir.pro index e0122eb1c43757fada989dfba4d3cf8d904e0f8d..145c95a2facbb957f2ed9655637d15d693c09e8c 100644 --- a/Magnetodynamics/Lib_MagStaDyn_av_2D_Cir.pro +++ b/Magnetodynamics/Lib_MagStaDyn_av_2D_Cir.pro @@ -16,24 +16,24 @@ DefineConstant[ TimeFinal = 1/50, // final time (for time-domain simulations) DeltaTime = 1/500, // time step (for time-domain simulations) InterpolationOrder = 1 // finite element order - Val_Rint = 0, // interior radius of annulus shell transformation region (VolInf_Mag) - Val_Rext = 0 // exterior radius of annulus shell transformation region (VolInf_Mag) + Val_Rint = 0, // interior radius of annulus shell transformation region (Vol_Inf_Mag) + Val_Rext = 0 // exterior radius of annulus shell transformation region (Vol_Inf_Mag) ]; Group { DefineGroup[ - VolCC_Mag, // the non-conducting part - VolC_Mag, // the conducting part - VolV_Mag, // a moving conducting part, with invariant mesh - VolM_Mag, // permanent magnets - VolS0_Mag, // current source domain with imposed current densities js0 - VolS_Mag, // current source domain with imposed current, imposed voltage or - // circuit coupling - VolInf_Mag, // annulus where a infinite shell transformation is applied - SurFluxTube_Mag, // boundary with Neumann BC - SurPerfect_Mag, // boundary of perfect conductors (i.e. non-meshed) - SurImped_Mag // boundary of conductors approximated by a surface impedance - // (i.e. non-meshed) + Vol_CC_Mag, // the non-conducting part + Vol_C_Mag, // the conducting part + Vol_V_Mag, // a moving conducting part, with invariant mesh + Vol_M_Mag, // permanent magnets + Vol_S0_Mag, // current source domain with imposed current densities js0 + Vol_S_Mag, // current source domain with imposed current, imposed voltage or + // circuit coupling + Vol_Inf_Mag, // annulus where a infinite shell transformation is applied + Sur_FluxTube_Mag, // boundary with Neumann BC + Sur_Perfect_Mag, // boundary of perfect conductors (i.e. non-meshed) + Sur_Imped_Mag // boundary of conductors approximated by a surface impedance + // (i.e. non-meshed) ]; If(Flag_CircuitCoupling) DefineGroup[ @@ -50,15 +50,15 @@ Group { Function { DefineFunction[ nu, // reluctivity (in Vol_Mag) - sigma, // conductivity (in VolC_Mag and VolS_Mag) - br, // remanent magnetic flux density (in VolM_Mag) - js0, // source current density (in VolS0_Mag) - nxh, // n x magnetic field (on SurFluxTube_Mag) - Velocity, // velocity of moving part VolV_Moving - Ns, // number of turns (in VolS_Mag) - Sc, // cross-section of windings (in VolS_Mag) + sigma, // conductivity (in Vol_C_Mag and Vol_S_Mag) + br, // remanent magnetic flux density (in Vol_M_Mag) + js0, // source current density (in Vol_S0_Mag) + nxh, // n x magnetic field (on Sur_FluxTube_Mag) + Velocity, // velocity of moving part Vol_V_Mag + Ns, // number of turns (in Vol_S_Mag) + Sc, // cross-section of windings (in Vol_S_Mag) CoefGeos, // geometrical coefficient for 2D or 2D axi model - Ysur // surface admittance (inverse of surface impedance Zsur) on SurImped_Mag + Ysur // surface admittance (inverse of surface impedance Zsur) on Sur_Imped_Mag ]; If(Flag_CircuitCoupling) DefineFunction[ @@ -73,9 +73,9 @@ Function { Group{ // all volumes - Vol_Mag = Region[ {VolCC_Mag, VolC_Mag, VolV_Mag, VolM_Mag, VolS0_Mag, VolS_Mag} ]; + Vol_Mag = Region[ {Vol_CC_Mag, Vol_C_Mag, Vol_V_Mag, Vol_M_Mag, Vol_S0_Mag, Vol_S_Mag} ]; // all volumes + surfaces on which integrals will be computed - VolWithSur_Mag = Region[ {Vol_Mag, SurFluxTube_Mag, SurPerfect_Mag, SurImped_Mag} ]; + Dom_Mag = Region[ {Vol_Mag, Sur_FluxTube_Mag, Sur_Perfect_Mag, Sur_Imped_Mag} ]; If(Flag_CircuitCoupling) // all circuit impedances DomainZ_Cir = Region[ {Resistance_Cir, Inductance_Cir, Capacitance_Cir} ]; @@ -89,7 +89,7 @@ Group{ Jacobian { { Name Vol; Case { - { Region VolInf_Mag ; + { Region Vol_Inf_Mag ; Jacobian VolSphShell {Val_Rint, Val_Rext} ; } { Region All; Jacobian Vol; } } @@ -127,11 +127,11 @@ FunctionSpace { // \vec{a}(x) = \sum_{n \in N(Domain)} a_n \vec{s}_n(x) // without nodes on perfect conductors (where a is constant) { Name s_n; NameOfCoef a_n; Function BF_PerpendicularEdge; - Support VolWithSur_Mag; Entity NodesOf[All, Not SurPerfect_Mag]; } + Support Dom_Mag; Entity NodesOf[All, Not Sur_Perfect_Mag]; } // global basis function on boundary of perfect conductors { Name s_skin; NameOfCoef a_skin; Function BF_GroupOfPerpendicularEdges; - Support VolWithSur_Mag; Entity GroupsOfNodesOf[SurPerfect_Mag]; } + Support Dom_Mag; Entity GroupsOfNodesOf[Sur_Perfect_Mag]; } // additional basis functions for 2nd order interpolation If(InterpolationOrder == 2) @@ -164,8 +164,8 @@ FunctionSpace { BasisFunction { { Name sr; NameOfCoef ur; Function BF_RegionZ; // constant vector (over the region) with nonzero z-component only - Support Region[{VolC_Mag, SurImped_Mag}]; - Entity Region[{VolC_Mag, SurImped_Mag}]; } + Support Region[{Vol_C_Mag, Sur_Imped_Mag}]; + Entity Region[{Vol_C_Mag, Sur_Imped_Mag}]; } } GlobalQuantity { { Name U; Type AliasOf; NameOfCoef ur; } @@ -183,7 +183,7 @@ FunctionSpace { { Name Hregion_i_2D; Type Vector; BasisFunction { { Name sr; NameOfCoef ir; Function BF_RegionZ; - Support VolS_Mag; Entity VolS_Mag; } + Support Vol_S_Mag; Entity Vol_S_Mag; } } GlobalQuantity { { Name Is; Type AliasOf; NameOfCoef ir; } @@ -233,16 +233,16 @@ Formulation { In Vol_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ -nu[] * br[] , {d a} ]; - In VolM_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_M_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ -js0[] , {a} ]; - In VolS0_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S0_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ - (js0[]*Vector[0,0,1]) * Dof{ir} , {a} ]; - In VolS_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ nxh[] , {a} ]; - In SurFluxTube_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_FluxTube_Mag; Jacobian Sur; Integration Gauss_v; } } } } @@ -272,55 +272,55 @@ Formulation { Integral { [ nu[] * Dof{d a} , {d a} ]; In Vol_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ -nu[] * br[] , {d a} ]; - In VolM_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_M_Mag; Jacobian Vol; Integration Gauss_v; } // Electric field e = -Dt[{a}]-{ur}, - // with {ur} = Grad v constant in each region of VolC + // with {ur} = Grad v constant in each region of Vol_C_Mag Integral { DtDof [ sigma[] * Dof{a} , {a} ]; - In VolC_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_C_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ sigma[] * Dof{ur} / CoefGeos[] , {a} ]; - In VolC_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_C_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ - sigma[] * (Velocity[] /\ Dof{d a}) , {a} ]; - In VolV_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_V_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ -js0[] , {a} ]; - In VolS0_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S0_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ nxh[] , {a} ]; - In SurFluxTube_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_FluxTube_Mag; Jacobian Sur; Integration Gauss_v; } Integral { DtDof [ Ysur[] * Dof{a} , {a} ]; - In SurImped_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_Imped_Mag; Jacobian Sur; Integration Gauss_v; } Integral { [ Ysur[] * Dof{ur} / CoefGeos[] , {a} ]; - In SurImped_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_Imped_Mag; Jacobian Sur; Integration Gauss_v; } // When {ur} act as a test function, one obtains the circuits relations, - // relating the voltage and the current of each region in VolC + // relating the voltage and the current of each region in Vol_C_Mag Integral { DtDof [ sigma[] * Dof{a} , {ur} ]; - In VolC_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_C_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ sigma[] * Dof{ur} / CoefGeos[] , {ur} ]; - In VolC_Mag; Jacobian Vol; Integration Gauss_v; } - GlobalTerm { [ Dof{I} *(CoefGeos[]/Fabs[CoefGeos[]]) , {U} ]; In VolC_Mag; } + In Vol_C_Mag; Jacobian Vol; Integration Gauss_v; } + GlobalTerm { [ Dof{I} *(CoefGeos[]/Fabs[CoefGeos[]]) , {U} ]; In Vol_C_Mag; } Integral { DtDof [ Ysur[] * Dof{a} , {ur} ]; - In SurImped_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_Imped_Mag; Jacobian Sur; Integration Gauss_v; } Integral { [ Ysur[] * Dof{ur} / CoefGeos[] , {ur} ]; - In SurImped_Mag; Jacobian Sur; Integration Gauss_v; } - GlobalTerm { [ Dof{I} *(CoefGeos[]/Fabs[CoefGeos[]]) , {U} ]; In SurImped_Mag; } + In Sur_Imped_Mag; Jacobian Sur; Integration Gauss_v; } + GlobalTerm { [ Dof{I} *(CoefGeos[]/Fabs[CoefGeos[]]) , {U} ]; In Sur_Imped_Mag; } // js[0] should be of the form: Ns[]/Sc[] * Vector[0,0,1] Integral { [ - (js0[]*Vector[0,0,1]) * Dof{ir} , {a} ]; - In VolS_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S_Mag; Jacobian Vol; Integration Gauss_v; } Integral { DtDof [ Ns[]/Sc[] * Dof{a} , {ir} ]; - In VolS_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ Ns[]/Sc[] / sigma[] * (js0[]*Vector[0,0,1]) * Dof{ir} , {ir} ]; - In VolS_Mag; Jacobian Vol; Integration Gauss_v; } - GlobalTerm { [ Dof{Us} / CoefGeos[] , {Is} ]; In VolS_Mag; } + In Vol_S_Mag; Jacobian Vol; Integration Gauss_v; } + GlobalTerm { [ Dof{Us} / CoefGeos[] , {Is} ]; In Vol_S_Mag; } // Attention: CoefGeo[.] = 2*Pi for Axi - GlobalTerm { [ -Dof{I_perfect} , {A_floating} ]; In SurPerfect_Mag; } + GlobalTerm { [ -Dof{I_perfect} , {A_floating} ]; In Sur_Perfect_Mag; } If(Flag_CircuitCoupling) GlobalTerm { NeverDt[ Dof{Uz} , {Iz} ]; In Resistance_Cir; } @@ -339,8 +339,8 @@ Formulation { GlobalEquation { Type Network; NameOfConstraint ElectricalCircuit; - { Node {I}; Loop {U}; Equation {I}; In VolC_Mag; } - { Node {Is}; Loop {Us}; Equation {Us}; In VolS_Mag; } + { Node {I}; Loop {U}; Equation {I}; In Vol_C_Mag; } + { Node {Is}; Loop {Us}; Equation {Us}; In Vol_S_Mag; } { Node {Iz}; Loop {Uz}; Equation {Uz}; In Domain_Cir; } } EndIf @@ -392,45 +392,45 @@ PostProcessing { { Name b; Value { Term { [ {d a} ]; In Vol_Mag; Jacobian Vol; } } } { Name h; Value { Term { [ nu[] * {d a} ]; In Vol_Mag; Jacobian Vol; } - Term { [ -nu[] * br[] ]; In VolM_Mag; Jacobian Vol; } + Term { [ -nu[] * br[] ]; In Vol_M_Mag; Jacobian Vol; } } } { Name js; Value { - Term { [ js0[] ]; In VolS0_Mag; Jacobian Vol; } - Term { [ (js0[]*Vector[0,0,1])*{ir} ]; In VolS_Mag; Jacobian Vol; } + Term { [ js0[] ]; In Vol_S0_Mag; Jacobian Vol; } + Term { [ (js0[]*Vector[0,0,1])*{ir} ]; In Vol_S_Mag; Jacobian Vol; } Term { [ Vector[0,0,0] ]; In Vol_Mag; Jacobian Vol; } // to force a vector result out of sources } } { Name j; // Only correct in MagDyn Value { - Term { [ -sigma[] * (Dt[{a}]+{ur}/CoefGeos[]) ]; In VolC_Mag; Jacobian Vol; } - Term { [ js0[] ]; In VolS0_Mag; Jacobian Vol; } - Term { [ (js0[]*Vector[0,0,1])*{ir} ]; In VolS_Mag; Jacobian Vol; } + Term { [ -sigma[] * (Dt[{a}]+{ur}/CoefGeos[]) ]; In Vol_C_Mag; Jacobian Vol; } + Term { [ js0[] ]; In Vol_S0_Mag; Jacobian Vol; } + Term { [ (js0[]*Vector[0,0,1])*{ir} ]; In Vol_S_Mag; Jacobian Vol; } Term { [ Vector[0,0,0] ]; In Vol_Mag; Jacobian Vol; } // Current density in A/m - Term { [ -Ysur[] * (Dt[{a}]+{ur}/CoefGeos[]) ]; In SurImped_Mag; Jacobian Sur; } + Term { [ -Ysur[] * (Dt[{a}]+{ur}/CoefGeos[]) ]; In Sur_Imped_Mag; Jacobian Sur; } } } { Name JouleLosses; Value { Integral { [ CoefPower * sigma[]*SquNorm[Dt[{a}]+{ur}/CoefGeos[]] ]; - In VolC_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_C_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ CoefPower * 1./sigma[]*SquNorm[js0[]] ]; - In VolS0_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S0_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ CoefPower * 1./sigma[]*SquNorm[(js0[]*Vector[0,0,1])*{ir}] ]; - In VolS_Mag; Jacobian Vol; Integration Gauss_v; } + In Vol_S_Mag; Jacobian Vol; Integration Gauss_v; } Integral { [ CoefPower * Ysur[]*SquNorm[Dt[{a}]+{ur}/CoefGeos[]] ]; - In SurImped_Mag; Jacobian Sur; Integration Gauss_v; } + In Sur_Imped_Mag; Jacobian Sur; Integration Gauss_v; } } } { Name U; Value { - Term { [ {U} ]; In VolC_Mag; } - Term { [ {Us} ]; In VolS_Mag; } + Term { [ {U} ]; In Vol_C_Mag; } + Term { [ {Us} ]; In Vol_S_Mag; } If(Flag_CircuitCoupling) Term { [ {Uz} ]; In Domain_Cir; } EndIf @@ -438,8 +438,8 @@ PostProcessing { } { Name I; Value { - Term { [ {I} ]; In VolC_Mag; } - Term { [ {Is} ]; In VolS_Mag; } + Term { [ {I} ]; In Vol_C_Mag; } + Term { [ {Is} ]; In Vol_S_Mag; } If(Flag_CircuitCoupling) Term { [ {Iz} ]; In Domain_Cir; } EndIf @@ -459,7 +459,8 @@ PostProcessing { { Name h; Value { Term { [ nu[] * {d a} ]; In Vol_Mag; Jacobian Vol; } } } { Name j; Value { - Term { [ js0[] ]; In VolS0_Mag; Jacobian Vol; } + Term { [ js0[] ]; In Vol_S0_Mag; Jacobian Vol; } + Term { [ (js0[]*Vector[0,0,1])*{ir} ]; In Vol_S_Mag; Jacobian Vol; } Term { [ Vector[0,0,0] ]; In Vol_Mag; Jacobian Vol; } } } diff --git a/Magnetodynamics/electromagnet.pro b/Magnetodynamics/electromagnet.pro index 1daf5af9e96f2708a84fcd894622a47bc62435d9..351d0cce2a1229242b101da3dde96aba86518bdb 100644 --- a/Magnetodynamics/electromagnet.pro +++ b/Magnetodynamics/electromagnet.pro @@ -29,10 +29,10 @@ Group { // Abstract regions used in the "Lib_MagStaDyn_av_2D_Cir.pro" template file // that is included below: - VolCC_Mag = Region[{Air, AirInf}]; // Non-conducting regions - VolC_Mag = Region[{Core}]; // Massive conducting regions - VolS_Mag = Region[{Ind}]; // Stranded conductors, i.e., coils - VolInf_Mag = Region[{AirInf}]; // Annulus for infinite shell transformation + Vol_CC_Mag = Region[{Air, AirInf}]; // Non-conducting regions + Vol_C_Mag = Region[{Core}]; // Massive conducting regions + Vol_S_Mag = Region[{Ind}]; // Stranded conductors, i.e., coils + Vol_Inf_Mag = Region[{AirInf}]; // Annulus for infinite shell transformation Val_Rint = rInt; Val_Rext = rExt; // Interior and exterior radii of annulus } diff --git a/Magnetodynamics/transfo.pro b/Magnetodynamics/transfo.pro index 88f0dba59bba74195588d44d190dea40f8e1ba23..0feabec89c9cd9b5a3cc85862a2184ac4924f46c 100644 --- a/Magnetodynamics/transfo.pro +++ b/Magnetodynamics/transfo.pro @@ -32,20 +32,20 @@ Group { template file included below; the regions are first intialized as empty, before being filled with physical groups */ - VolCC_Mag = Region[{}]; // Non-conducting regions - VolC_Mag = Region[{}]; // Massive conductors - VolS_Mag = Region[{}]; // Stranded conductors, i.e., coils + Vol_CC_Mag = Region[{}]; // Non-conducting regions + Vol_C_Mag = Region[{}]; // Massive conductors + Vol_S_Mag = Region[{}]; // Stranded conductors, i.e., coils // air physical groups Air = Region[{AIR_WINDOW, AIR_EXT}]; - VolCC_Mag += Region[Air]; + Vol_CC_Mag += Region[Air]; // exterior boundary Sur_Air_Ext = Region[{SUR_AIR_EXT}]; // magnetic core of the transformer, assumed to be non-conducting Core = Region[CORE]; - VolCC_Mag += Region[Core]; + Vol_CC_Mag += Region[Core]; Coil_1_P = Region[COIL_1_PLUS]; Coil_1_M = Region[COIL_1_MINUS]; @@ -58,10 +58,10 @@ Group { Coils = Region[{Coil_1, Coil_2}]; If (type_Conds == 1) - VolC_Mag += Region[{Coils}]; + Vol_C_Mag += Region[{Coils}]; ElseIf (type_Conds == 2) - VolS_Mag += Region[{Coils}]; - VolCC_Mag += Region[{Coils}]; + Vol_S_Mag += Region[{Coils}]; + Vol_CC_Mag += Region[{Coils}]; EndIf } @@ -219,7 +219,7 @@ Include "Lib_MagStaDyn_av_2D_Cir.pro"; PostOperation { { Name Map_a; NameOfPostProcessing MagDyn_a_2D; Operation { - Print[ j, OnElementsOf Region[{VolC_Mag, VolS_Mag}], Format Gmsh, File "j.pos" ]; + Print[ j, OnElementsOf Region[{Vol_C_Mag, Vol_S_Mag}], Format Gmsh, File "j.pos" ]; Print[ b, OnElementsOf Vol_Mag, Format Gmsh, File "b.pos" ]; Print[ az, OnElementsOf Vol_Mag, Format Gmsh, File "az.pos" ]; diff --git a/Magnetostatics/electromagnet.pro b/Magnetostatics/electromagnet.pro index 1e1c1c4348eba7d9fb4621b0c9d7fe4d69c121d2..37293eeac3c5c834919a7464d5f62e4f377afcf2 100644 --- a/Magnetostatics/electromagnet.pro +++ b/Magnetostatics/electromagnet.pro @@ -3,7 +3,7 @@ Features: - Infinite ring geometrical transformation - - Parameters shared by Gmsh and GetDp, and Onelab parameters + - Parameters shared by Gmsh and GetDP, and ONELAB parameters - FunctionSpaces for the 2D vector potential formulation To compute the solution in a terminal: @@ -15,35 +15,43 @@ Run (button at the bottom of the left panel) ------------------------------------------------------------------- */ -/* Electromagnetic fields expand to infinity. - The corresponding boundary condition can be imposed rigorously - by means of a gometrical transformation that maps a ring (or shell) of finite elements - to the complementary of its interior. - As this is a mere geometric transformation, - it is enough in the model description to attribute a special jacobian - to the ring region ("AirInf"). See Jacobian{} section below. - With this information, GetDP is able to deal with the correct transformation - of all quantities involved in the model. - - The special jacobian "VolSphShell" has parameters. - There are 2 parameters in this case, "Val_Rint" and "Val_Rext", - which represent the inner and outer radii of the transformed ring region - and whose value must match those used - in the geometrical description of the model (.geo file). - This is a typical case where Gmsh and GetDP must consistently share parameter values. - To ensure consistency in all cases, common parameters are defined - is a specific file "electromagnet_common.pro", - which is included in both the .geo and .pro file of the model. - - Besides sharing parameters between Gmsh and GetDP, - it is also useful to share some parameters (not all) with the user of the model, - i.e., to make them editable in the GUI before running the model. - Such variables are called Onelab variables (because the sharing mechanism - between the model and the GUI uses the Onelab interface). - Onelab parameters are defined with a "DefineNumber" statement, - which can be invoked in the .geo, .pro, or _common.pro files. - */ - +/* Electromagnetic fields expand to infinity. The corresponding boundary + condition can be imposed rigorously by means of a gometrical transformation + that maps a ring (or shell) of finite elements to the complementary of its + interior. As this is a mere geometric transformation, it is enough in the + model description to attribute a special Jacobian to the ring region + ("AirInf") - see the "Jacobian" section below. With this information, GetDP + is able to deal with the correct transformation of all quantities involved in + the model. + + The special Jacobian "VolSphShell" takes 2 parameters in this case, + "Val_Rint" and "Val_Rext", which represent the inner and outer radii of the + transformed ring region and whose value must match those used in the + geometrical description of the model (.geo file). This is a typical case + where Gmsh and GetDP must consistently share parameter values. To ensure + consistency in all cases, common parameters are defined is a specific file + "electromagnet_common.pro", which is included in both the .geo and .pro file + of the model. + + Besides sharing parameters between Gmsh and GetDP, it is also useful to share + some parameters (not all) with the user of the model, i.e., to make them + editable in the GUI before running the model. Such variables are called + ONELAB variables (because the sharing mechanism between the model and the GUI + uses the ONELAB interface). ONELAB parameters are defined with a + "DefineNumber" statement, which can be invoked in the .geo and .pro files. + + This model computes the static magnetic field produced by a DC current. This + corresponds to a "magnetostatic" physical model, obtained by combining the + time-invariant Maxwell-Ampere equation (Curl h = js, with h the magnetic + field and js the source current density) with Gauss' law (Div b = 0, with b + the magnetic flux density) and the magnetic constitutive law (b = mu h, with + mu the magnetic permeability). + + Since Div b = 0, b can be derived from a vector magnetic potential a, such + that b = Curl a. Plugging this potential in Maxwell-Ampere's law and using + the constitutive law leads to a vector Poisson equation in terms of the + magnetic vector potential: Curl(nu Curl a) = js, where nu = 1/mu is + the reluctivity. */ Group { // Physical regions: @@ -54,25 +62,24 @@ Group { Surface_bn0 = Region[ 1101 ]; Surface_Inf = Region[ 1102 ]; - /* Abstract regions : - The purpose of abstract regions is to allow a generic definition of - the FunctionSpace, Formulation and PostProcessing fields - with no reference to model-specific Physical regions. - We will show in a later tutorial how abstract formulations can then be isolated - in geometry independent template files, thanks to an appropriate declaration mechanism - (using DefineConstant[], DefineGroup[] and DefineFunction[]). + The purpose of abstract regions is to allow a generic definition of the + FunctionSpace, Formulation and PostProcessing fields with no reference to + model-specific Physical regions. We will show in a later tutorial how + abstract formulations can then be isolated in geometry independent template + files, thanks to an appropriate declaration mechanism (using + DefineConstant[], DefineGroup[] and DefineFunction[]). The abstract regions in this model have the following interpretation: - - Vol_Nu_Mag = region where the term [ nu[] * Dof{d a} , {d a} ] is assembled - - Vol_Js_Mag = region where the term [ - Dof{js} , {a} ] is assembled - - Vol_Inf_Mag = region where the infinite ring geometric transformation is applied - - Sur_Dir_Mag = Homogeneous Dirichlet part of the model's boundary; - - Sur_Neu_Mag = Homogeneous Neumann part of the model's boundary; + - Vol_Mag : full volume domain + - Vol_S_Mag : region where the current source js is defined + - Vol_Inf_Mag : region where the infinite ring geometric transformation is applied + - Sur_Dir_Mag : homogeneous Dirichlet part of the model boundary + - Sur_Neu_Mag : homogeneous Neumann part of the model boundary */ - Vol_Nu_Mag = Region[ {Air, AirInf, Core, Ind} ]; - Vol_Js_Mag = Region[ Ind ]; - Vol_Inf_Mag = Region[ {AirInf} ]; + Vol_Mag = Region[ {Air, AirInf, Core, Ind} ]; + Vol_S_Mag = Region[ Ind ]; + Vol_Inf_Mag = Region[ AirInf ]; Sur_Dir_Mag = Region[ {Surface_bn0, Surface_Inf} ]; Sur_Neu_Mag = Region[ {Surface_ht0} ]; } @@ -88,7 +95,7 @@ Function { NbTurns = 1000 ; Current = DefineNumber[0.01, Name "Model parameters/Current", Help "Current injected in coil [A]"]; - Js_fct[ Ind ] = -NbTurns*Current/SurfaceArea[]; + js_fct[ Ind ] = -NbTurns*Current/SurfaceArea[]; /* The minus sign is to have the current in -e_z direction, so that the magnetic induction field is in +e_y direction */ } @@ -104,22 +111,22 @@ Function { "Hcurl_a_Mag_2D" and "Hregion_j_Mag_2D" as they are defined below. The function space "Hregion_j_Mag_2D" provides one basis function, - and hence one degree of freedom, per physical region in the abstract region "Vol_Js_Mag". + and hence one degree of freedom, per physical region in the abstract region "Vol_S_Mag". The constraint "SourceCurrentDensityZ" fixes all these dofs, so the FunctionSpace "Hregion_j_Mag_2D" is fully fixed and has no FE unknowns. One could thus have replaced it by a simple function and the Integral term would have been - Integral { [ Vector[ 0,0,-Js_fct[] ] , {a} ]; In Vol_Js_Mag; + Integral { [ Vector[ 0,0,-js_fct[] ] , {a} ]; In Vol_S_Mag; Jacobian Vol; Integration Int; } instead of - Integral { [ - Dof{js} , {a} ]; In Vol_Js_Mag; + Integral { [ - Dof{js} , {a} ]; In Vol_S_Mag; Jacobian Vol; Integration Int; } Thechosen implementation below is however more effeicient - as it avoids evaluating repeatedly the function Js_fct[] during assembly. + as it avoids evaluating repeatedly the function js_fct[] during assembly. */ @@ -131,13 +138,13 @@ Constraint { } { Name SourceCurrentDensityZ; Case { - { Region Vol_Js_Mag ; Value Js_fct[]; } + { Region Vol_S_Mag ; Value js_fct[]; } } } } Group { - Dom_Hcurl_a_Mag_2D = Region[ {Vol_Nu_Mag, Sur_Neu_Mag} ]; + Dom_Hcurl_a_Mag_2D = Region[ {Vol_Mag, Sur_Neu_Mag} ]; } FunctionSpace { { Name Hcurl_a_Mag_2D; Type Form1P; // Magnetic vector potential A @@ -154,7 +161,7 @@ FunctionSpace { { Name Hregion_j_Mag_2D; Type Vector; // Electric current density Js BasisFunction { { Name sr; NameOfCoef jsr; Function BF_RegionZ; - Support Vol_Js_Mag; Entity Vol_Js_Mag; } + Support Vol_S_Mag; Entity Vol_S_Mag; } } Constraint { { NameOfCoef jsr; EntityType Region; @@ -193,9 +200,9 @@ Formulation { { Name js; Type Local; NameOfSpace Hregion_j_Mag_2D; } } Equation { - Integral { [ nu[] * Dof{d a} , {d a} ]; In Vol_Nu_Mag; + Integral { [ nu[] * Dof{d a} , {d a} ]; In Vol_Mag; Jacobian Vol; Integration Int; } - Integral { [ -Dof{js} , {a} ]; In Vol_Js_Mag; + Integral { [ -Dof{js} , {a} ]; In Vol_S_Mag; Jacobian Vol; Integration Int; } } }