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

rework explanations

parent 6a21d983
No related branches found
No related tags found
No related merge requests found
......@@ -12,38 +12,36 @@
------------------------------------------------------------------- */
/*
A thing GetDP is pretty good at is the management of global (non-local) basis
/* A thing GetDP is pretty good at is the management of global (non-local) basis
functions. Finite element expansions typically associate basis functions to
individual nodes or edges in the mesh. But consider the situation
where a scalar field is set to be uniform over a region of the problem
(Say a floating potential electrode in an Electrostatics problem,
to fix the idea). By factorizing the identical nodal value "v_electrode",
a global (non-local) basis function "BF_electrode" is obtained as factor
which is the sum of the shape functions of all the nodes in the electrode
region. This basis function "BF_electrode"
individual nodes or edges in the mesh. But consider the situation where a
scalar field is set to be uniform over a region of the problem (say a
floating potential electrode in an electrostatic problem). By factorizing the
identical nodal value "v_electrode", a global (non-local) basis function
"BF_electrode" is obtained as factor which is the sum of the shape functions
of all the nodes in the electrode region. This basis function "BF_electrode"
- is a continuous function, scalar in this case,
- is equal to 1 at the nodes of the electrode region, and to 0
at all other nodes
- decreases from 1 to 0 over the one element thick layer of outside
finite elements immediately in contact with the electrode region.
One such glabal basis function can be associated with each electrode
in the system, so that the finite element expansion of the electric
scalar potential reads:
- is equal to 1 at the nodes of the electrode region, and to 0 at all other
nodes,
- decreases from 1 to 0 over the one element thick layer of outside finite
elements immediately in contact with the electrode region.
One such glabal basis function can be associated with each electrode in the
system, so that the finite element expansion of the electric scalar potential
reads:
v = Sum_k sn_k vn_k + Sum_electrode v_electrode BF_electrode
We show in this tutorial how GetDP takes advantage of global quantities
and the associated global basis functions
We show in this tutorial how GetDP takes advantage of global quantities and
the associated global basis functions
- to reduce the number of unknowns
- to compute efficiently the electrode charges "Q_electrode",
which are precisely the energy duals of the global "v_electrode" quantities
- to compute efficiently the electrode charges "Q_electrode", which are
precisely the energy duals of the global "v_electrode" quantities
- to deal with floating potentials, which are the computed electrode
potential when the electrode charge is imposed
- to provide output quantities (charges, armature voltages,
capacitances, ...) that can be immediately used in a external circuit.
*/
- to provide output quantities (charges, armature voltages, capacitances,
...) that can be immediately used in a external circuit. */
Group {
/* Geometrical regions: */
......@@ -56,56 +54,48 @@ Group {
SurfInf = Region[130];
/* Abstract regions:
Vol_Dielectric_Ele : dielectric volume regions where
"Div ( epsr[] Grad v)" is solved
Sur_Neu_Ele : Neumann bondary condition ( epsr[] n.Grad v = 0 )
Electrodes_Ele : electrode regions
No prefix (Vol_ or Sur_) for the region "Electrodes_Ele",
which may contain both surface or volume regions.
There are two electrodes in this model: Ground and Microstrip
*/
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
Sur_Electrodes_Ele : electrode regions */
Vol_Dielectric_Ele = Region[ {Air, Diel1} ];
Sur_Neu_Ele = Region[ {SurfInf} ];
Electrodes_Ele = Region [ {Ground, Microstrip} ];
Vol_Ele = Region[ {Air, Diel1} ];
Sur_Neumann_Ele = Region[ {} ];
Sur_Electrodes_Ele = Region [ {Ground, Microstrip} ];
}
/* A number of ONELAB parameters are defined to define model parameters
or model options interactively. */
MicrostripTypeBC =
DefineNumber[0, Name "1Microstrip excitation/Type",
Choices{ 0="Fixed voltage", 1="Fixed charge"} ] ;
MicrostripValueBC =
DefineNumber[1e-3, Name "1Microstrip excitation/Value"] ;
EpsilonRelDiel =
DefineNumber[9.8, Name "2Dielectric/Relative permittivity"] ;
DisplayGlobalBF =
DefineNumber[0, Name "3Options/Display global basis functions", Choices {0,1} ] ;
OverwriteOutput =
DefineNumber[1, Name "3Options/Overwrite output.txt file", Choices {0,1} ] ;
/* A number of ONELAB parameters are defined to define model parameters or model
options interactively. */
MicrostripTypeBC = DefineNumber[0, Name "1Microstrip excitation/Type",
Choices{0="Fixed voltage", 1="Fixed charge"}] ;
MicrostripValueBC = DefineNumber[1e-3, Name "1Microstrip excitation/Value"] ;
EpsilonRelDiel = DefineNumber[9.8, Name "2Dielectric/Relative permittivity"] ;
DisplayGlobalBF = DefineNumber[0, Name "3Options/Display global basis functions",
Choices {0,1} ] ;
OverwriteOutput = DefineNumber[1, Name "3Options/Overwrite output.txt file",
Choices {0,1} ] ;
Function {
epsr[Air] = 1.;
epsr[Diel1] = EpsilonRelDiel;
eps0 = 8.854187818e-12; // permittivity of empty space
epsilon[Air] = eps0;
epsilon[Diel1] = EpsilonRelDiel * eps0;
}
Constraint {
/* Dirichlet boundary condition is no longer used.
The microstrip and the ground are now treated as electrodes,
whose voltage is imposed with the "SetGlobalPotential" constraint below. */
/* Dirichlet boundary condition on the local electric potential is no longer
used. The microstrip and the ground are now treated as electrodes, whose
voltage is imposed with the "SetGlobalPotential" constraint below. */
{ Name Dirichlet_Ele; Type Assign;
Case {}
Case {
}
}
{ Name SetGlobalPotential; Type Assign;
Case {
/* Define the imposed potential regionwise on the different parts of
"Electrodes_Ele". No voltage imposed to the Microstrip electrode
when the "Fixed charge" option is enabled
( MicrostripTypeBC = true ). */
"Sur_Electrodes_Ele". No voltage imposed to the Microstrip electrode when
the "Fixed charge" option is enabled (if MicrostripTypeBC != 0). */
{ Region Ground; Value 0; }
If(!MicrostripTypeBC)
{ Region Microstrip; Value MicrostripValueBC; }
......@@ -114,6 +104,7 @@ Constraint {
}
{ Name SetArmatureCharge; Type Assign;
Case {
/* Impose the charge if MicrostripTypeBC != 0 */
If(MicrostripTypeBC)
{ Region Microstrip; Value MicrostripValueBC; }
EndIf
......@@ -122,11 +113,9 @@ Constraint {
}
Group{
/* The domain of definition lists all regions
on which the field "v" is defined.*/
Dom_Hgrad_v_Ele = Region[ {Vol_Dielectric_Ele,
Sur_Neu_Ele,
Electrodes_Ele } ];
/* 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} ];
}
FunctionSpace {
......@@ -137,30 +126,40 @@ FunctionSpace {
v = Sum_k sn_k vn_k + Sum_electrode v_electrode BF_electrode
with the the sum_k running over all nodes except those of the electrode
regions. This is exactly what one finds in the FunctionSpace definotion
regions. This is exactly what one finds in the FunctionSpace definition
below with "sf" standing for "BF_electrode" and "vf" for "v_electrode".
The global quantities are also be attributed a more explicit
and meaningful name. Moreover the "AssociatedWith" statement manifests
the fact that the global potential of an electrode is the (electrostatic)
energy dual of the electric charge carried by that electrode.
By checking the "Display global basis functions" checkbox and running
the model, you can take a look on how the two "BF_electrode" basis
functions in this model look like.
Constraints can then be set on either component of the FunctionSpace.
Besides the usual Dirichlet boundary condition conditions, which is
left here for the sake of completeness but is not used in this model,
there is the possibility to fix either the GlobalPotential or the
ArmatureCharge of each indidual electrode (not both, of course).
When the ArmatureCharge is fixed, the computed GlobalPotential computed
for that electrode is the so-called floating potential.
*/
The global quantities are attributed an explicit and meaningful name in the
"GlobalQuantity" section; these names are used in the corresponding
"GlobalTerm" in the Formulation. Such global terms are the equivalent of a
"Integral" term, but where no integration needs to be performed. The
"AssociatedWith" statement manifests the fact that the global potential of
an electrode is the (electrostatic) energy dual of the electric charge
carried by that electrode. Indeed, in the weak formulation, when the
test-function v' is BF_electrode,
(epsilon n.Grad v, BF_electrode)_Bnd_Vol_Ele =
(epsilon n.Grad v, BF_electrode)_Sur_Electrodes_Ele =
(epsilon n.Grad v, 1)_Sur_Electrodes_Ele = Q_electrode,
the charge carried by the electrodes.
By checking the "Display global basis functions" checkbox and running the
model, you can take a look on how the two "BF_electrode" basis functions in
this model look like. Constraints can then be set on either component of
the FunctionSpace. Besides the usual Dirichlet boundary condition on the
local field, which is left here for the sake of completeness but is not
used in this model, there is the possibility to fix either the
GlobalPotential or the ArmatureCharge of each indidual electrode (not both,
of course). When the ArmatureCharge is fixed, the computed GlobalPotential
computed for that electrode is the so-called floating potential. */
{ Name Hgrad_v_Ele; Type Form0;
BasisFunction {
{ Name sn; NameOfCoef vn; Function BF_Node;
Support Dom_Hgrad_v_Ele; Entity NodesOf[ All, Not Electrodes_Ele ]; }
Support Dom_Hgrad_v_Ele; Entity NodesOf[ All, Not Sur_Electrodes_Ele ]; }
{ Name sf; NameOfCoef vf; Function BF_GroupOfNodes;
Support Dom_Hgrad_v_Ele; Entity GroupsOfNodesOf[ Electrodes_Ele ]; }
Support Dom_Hgrad_v_Ele; Entity GroupsOfNodesOf[ Sur_Electrodes_Ele ]; }
}
GlobalQuantity {
{ Name GlobalPotential; Type AliasOf ; NameOfCoef vf; }
......@@ -200,14 +199,15 @@ Integration {
}
Formulation {
/* Only minor changes in the formulation.
The global quantities are declared in the "Quantity{}" section,
and a "GlobalTerm" is added that triggers the assembly
of an additional equation per electrode in the system
to compute the charge Q_electrode accordint to:
Q_electrode = (-epsr[] Grad v, Grad BF_electrode)_Vol_Dielectric_Ele
*/
/* The formulation only contains minor changes compared to the first tutorial.
The global quantities are declared as "Global" in the "Quantity" section,
and a "GlobalTerm" is added that triggers the assembly of the additional
equation per electrode (the "pre-integrated" surface Neumann term) in the
system to compute the charge Q_electrode. Considering the equation
corresponding to the test function BF_electrode leads to the following
expression for the electrode charge:
Q_electrode = (-epsilon[] Grad v, Grad BF_electrode)_Vol_Ele */
{ Name Electrostatics_v; Type FemEquation;
Quantity {
{ Name v; Type Local; NameOfSpace Hgrad_v_Ele; }
......@@ -217,9 +217,9 @@ Formulation {
{ Name vf; Type Local; NameOfSpace Hgrad_v_Ele [vf]; }
}
Equation {
Galerkin { [ epsr[] * Dof{d v} , {d v} ]; In Vol_Dielectric_Ele;
Jacobian Vol; Integration Int; }
GlobalTerm { [ -Dof{Q}/eps0 , {U} ]; In Electrodes_Ele; }
Integral { [ epsilon[] * Dof{d v} , {d v} ];
In Vol_Ele; Jacobian Vol; Integration Int; }
GlobalTerm { [ -Dof{Q} , {U} ]; In Sur_Electrodes_Ele; }
}
}
}
......@@ -231,9 +231,6 @@ Resolution {
}
Operation {
Generate[Sys_Ele]; Solve[Sys_Ele]; SaveSolution[Sys_Ele];
If( OverwriteOutput )
DeleteFile[ "output.txt" ];
EndIf
}
}
}
......@@ -241,36 +238,55 @@ Resolution {
PostProcessing {
{ Name EleSta_v; NameOfFormulation Electrostatics_v;
Quantity {
{ Name v; Value { Term { [ {v} ]; In Dom_Hgrad_v_Ele; Jacobian Vol; } } }
{ Name e; Value { Term { [ -{d v} ]; In Dom_Hgrad_v_Ele; Jacobian Vol; } } }
{ Name d; Value { Term { [ -eps0*epsr[] * {d v} ];
In Dom_Hgrad_v_Ele; Jacobian Vol; } } }
{ Name Q; Value { Term { [ {Q} ]; In Electrodes_Ele; } } }
{ Name U; Value { Term { [ {U} ]; In Electrodes_Ele; } } }
{ Name C; Value { Term { [ {Q}/{U} ];
In Electrodes_Ele; } } }
{ Name energy;
Value { Integral { Type Global;
[ eps0*epsr[] / 2. * SquNorm[{d v}] ];
In Vol_Dielectric_Ele; Jacobian Vol; Integration Int;
{ Name v; Value {
Term { [ {v} ]; In Vol_Ele; Jacobian Vol; }
}
}
{ Name e; Value {
Term { [ -{d v} ]; In Vol_Ele; Jacobian Vol; }
}
}
{ Name d; Value {
Term { [ -epsilon[] * {d v} ]; In Vol_Ele; Jacobian Vol; }
}
}
{ Name Q; Value {
Term { [ {Q} ]; In Sur_Electrodes_Ele; }
}
}
{ Name U; Value {
Term { [ {U} ]; In Sur_Electrodes_Ele; }
}
}
{ Name C; Value {
Term { [ {Q}/{U} ]; In Sur_Electrodes_Ele; }
}
}
{ Name energy; Value {
Integral { Type Global; // not per sub-region in Vol_Ele
[ epsilon[] / 2. * SquNorm[{d v}] ];
In Vol_Ele; Jacobian Vol; Integration Int;
}
}
}
// next lines only needed to display global BF in PostProcessing
{ Name BFGround; Value { Term { [ BF {vf} ]; In Dom_Hgrad_v_Ele;
SubRegion Ground; Jacobian Vol; } } }
{ Name BFMicrostrip; Value { Term { [ BF {vf} ]; In Dom_Hgrad_v_Ele;
SubRegion Microstrip; Jacobian Vol; } } }
{ Name BFGround; Value {
Term { [ BF{vf} ]; In Dom_Hgrad_v_Ele; SubRegion Ground; Jacobian Vol; }
}
}
{ Name BFMicrostrip; Value {
Term { [ BF{vf} ]; In Dom_Hgrad_v_Ele; SubRegion Microstrip; Jacobian Vol; }
}
}
}
}
}
/* Various output results are generated, which are both displayed
in the graphical user interface, and stored in disk files.
In particular, global quantities related results are stored
in the "output.txt" file. A user option allows to chose
to not overwrite the "output.txt" file when running a new simulation. */
/* Various output results are generated, which are both displayed in the
graphical user interface, and stored in disk files. In particular, global
quantities related results are stored in the "output.txt" file. A user option
allows to chose to not overwrite the "output.txt" file when running a new
simulation. */
PostOperation {
{ Name Map; NameOfPostProcessing EleSta_v;
......@@ -298,6 +314,10 @@ PostOperation {
"View[l].NbIso = 40;"],
File "v.opt", LastTimeStepOnly] ;
If(OverwriteOutput)
DeleteFile[ "output.txt" ];
EndIf
Echo[ "Microstrip charge [C]:", Format Table, File > "output.txt"] ;
Print[ Q, OnRegion Microstrip, File > "output.txt", Color "AliceBlue",
Format Table, SendToServer "Output/Microstrip/Charge [C]" ];
......@@ -311,11 +331,9 @@ PostOperation {
Print[ C, OnRegion Microstrip, File > "output.txt", Color "AliceBlue",
Format Table, SendToServer "Output/Global/Capacitance [F]" ];
Echo[ "Electrostatic energy [J]:", Format Table, File > "output.txt"] ;
Print[ energy, OnRegion Vol_Dielectric_Ele, File > "output.txt",
Print[ energy, OnGlobal, File > "output.txt",
Color "AliceBlue",
Format Table, SendToServer "Output/Global/Energy [J]" ];
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment