Skip to content
Snippets Groups Projects
Commit 62dca156 authored by François Henrotte's avatar François Henrotte
Browse files

electrostatic tutorial

parent 4a1828b4
No related branches found
No related tags found
1 merge request!1electrostatic tutorial
/* -------------------------------------------------------------------
File "mStrip.geo"
This file is the geometrical description used by GMSH to produce
the file "mStrip.msh".
------------------------------------------------------------------- */
/* Definition of some parameters for geometrical dimensions, i.e.
h (height of 'Diel1'), w (width of 'Line'), t (thickness of 'Line')
xBox (width of the air box) and yBox (height of the air box) */
h = 1.e-3 ; w = 4.72e-3 ; t = 0.035e-3 ;
xBox = w/2. * 6. ; yBox = h * 12. ;
/* Definition of parameters for local mesh dimensions */
s = 1. ;
p0 = h / 10. * s ;
pLine0 = w/2. / 10. * s ; pLine1 = w/2. / 50. * s ;
pxBox = xBox / 10. * s ; pyBox = yBox / 8. * s ;
/* Definition of gemetrical points */
Point(1) = { 0 , 0, 0, p0} ;
Point(2) = { xBox, 0, 0, pxBox} ;
Point(3) = { xBox, h, 0, pxBox} ;
Point(4) = { 0 , h, 0, pLine0} ;
Point(5) = { w/2., h, 0, pLine1} ;
Point(6) = { 0 , h+t, 0, pLine0} ;
Point(7) = { w/2., h+t, 0, pLine1} ;
Point(8) = { 0 , yBox, 0, pyBox} ;
Point(9) = { xBox, yBox, 0, pyBox} ;
/* Definition of gemetrical lines */
Line(1) = {1,2}; Line(2) = {2,3}; Line(3) = {3,9};
Line(4) = {9,8}; Line(5) = {8,6}; Line(7) = {4,1};
Line(8) = {5,3}; Line(9) = {4,5}; Line(10) = {6,7};
Line(11) = {5,7};
/* Definition of geometrical surfaces */
Line Loop(12) = {8,-2,-1,-7,9}; Plane Surface(13) = {12};
Line Loop(14) = {10,-11,8,3,4,5}; Plane Surface(15) = {14};
/* Definition of Physical entities (surfaces, lines). The Physical
entities tell GMSH the elements and their associated region numbers
to save in the file 'mStrip.msh'. For example, the Region
111 is made of elements of surface 13, while the Region 121 is
made of elements of lines 9, 10 and 11 */
Physical Surface (101) = {15} ; /* Air */
Physical Surface (111) = {13} ; /* Diel1 */
Physical Line (120) = {1} ; /* Ground */
Physical Line (121) = {9,10,11} ; /* Line */
Physical Line (130) = {2,3,4} ; /* SurfInf */
/* -------------------------------------------------------------------
File "microstrip.pro"
This file defines the problem dependent data structures for the
microstrip problem.
To compute the solution:
getdp microstrip -solve EleSta_v
To compute post-processing results:
getdp microstrip -pos Map
getdp microstrip -pos Cut
------------------------------------------------------------------- */
Group {
/* One starts by giving explicit meaningful names to
the Physical regions defined in the "microstrip.msh" mesh file.
There are 2 volume regions and 3 surface regions in this model. */
Air = Region[101];
Diel1 = Region[111];
Ground = Region[120];
Electrode = Region[121];
SurfInf = Region[130];
/* We now define abstract regions to be used in the definition
of the scalar electric potential formulation:
Vol_Dielectric_Ele : dielectric volume regions where "div epsr[] grad v = 0" is solved
Sur_Dir_Ele : Dirichlet boundary condition (v imposed)
Sur_Neu_Ele : Neumann bondary condition ( epsr[] n.grad v = 0 )
Vol_xxx groups contain only volume elements of the mesh (triangles here).
Sur_xxx groups contain only surface elements of the mesh (lines here).
*/
Vol_Dielectric_Ele = Region[ {Air, Diel1} ];
Sur_Dir_Ele = Region[ {Ground, Electrode} ];
Sur_Neu_Ele = Region[ {SurfInf} ];
}
Function {
/* The relative permittivity is defined piecewise using the above defined Groups */
epsr[Air] = 1.;
epsr[Diel1] = 9.8;
}
Constraint {
/* As for material laws, the Dirichlet boundary conditions can be defined piecewise
The constraint "Dirichlet_Ele" is invoked in the FunctionSpace below */
{ Name Dirichlet_Ele; Type Assign;
Case {
{ Region Ground; Value 0.; }
{ Region Electrode; Value 1.e-3; }
}
}
}
/* The function space of the electric scalar potential v
is definied by
- a domain of definition, which is the Group "Dom_Hgrad_v_Ele",
- a type (Form0 means scalar field)
- a set of scalar basis functions (here nodal basis functions "BF_Node")
- constraints (here the Dirichlet boundary conditions)
Contrary to the above defined groups, which contain either volure or surface elements,
Dom_xxx groups contain both volume and surface elements */
Group{
Dom_Hgrad_v_Ele = Region[ {Vol_Dielectric_Ele, Sur_Dir_Ele, Sur_Neu_Ele} ];
}
FunctionSpace {
{ Name Hgrad_v_Ele; Type Form0;
BasisFunction {
{ Name sn; NameOfCoef vn; Function BF_Node;
Support Dom_Hgrad_v_Ele; Entity NodesOf[ All ]; }
}
Constraint {
{ NameOfCoef vn; EntityType NodesOf;
NameOfConstraint Dirichlet_Ele; }
}
}
}
Jacobian {
{ Name Vol ;
Case {
{ Region All ; Jacobian Vol ; }
}
}
}
Integration {
{ Name GradGrad ;
Case { {Type Gauss ;
Case { { GeoElement Triangle ; NumberOfPoints 4 ; }
{ GeoElement Quadrangle ; NumberOfPoints 4 ; } }
}
}
}
}
Formulation {
{ Name Electrostatics_v; Type FemEquation;
Quantity {
{ Name v; Type Local; NameOfSpace Hgrad_v_Ele; }
}
Equation {
Galerkin { [ epsr[] * Dof{d v} , {d v} ];
In Vol_Dielectric_Ele;
Jacobian Vol; Integration GradGrad; }
}
}
}
Resolution {
{ Name EleSta_v;
System {
{ Name Sys_Ele; NameOfFormulation Electrostatics_v; }
}
Operation {
Generate[Sys_Ele]; Solve[Sys_Ele]; SaveSolution[Sys_Ele];
}
}
}
eps0 = 8.854187818e-12; // permittivity of empty space
PostProcessing {
{ Name EleSta_v; NameOfFormulation Electrostatics_v;
Quantity {
{ Name v;
Value {
Local { [ {v} ];
In Dom_Hgrad_v_Ele; Jacobian Vol; }
}
}
{ Name e;
Value {
Local { [ -{d v} ];
In Dom_Hgrad_v_Ele; Jacobian Vol; }
}
}
{ Name d;
Value {
Local { [ -eps0*epsr[] * {d v} ];
In Dom_Hgrad_v_Ele; Jacobian Vol; }
}
}
}
}
}
e = 1.e-7; // parameter to ensure the cut is inside the simulation domain
PostOperation {
{ Name Map; NameOfPostProcessing EleSta_v;
Operation {
Print [ v, OnElementsOf Dom_Hgrad_v_Ele, File "mStrip_v.pos" ];
Print [ e, OnElementsOf Dom_Hgrad_v_Ele, File "mStrip_e.pos" ];
}
}
{ Name Cut; NameOfPostProcessing EleSta_v;
Operation {
Print [ e, OnLine {{e,e,0}{10.e-3,e,0}} {500}, File "Cut_e" ];
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment