Commit 654049d6 by Christophe Geuzaine

nonlin sta + magdyn

parent bca82325
Pipeline #1474 passed with stage
in 9 minutes 27 seconds
......@@ -289,13 +289,19 @@ Resolution{
EndIf
}
Operation {
If(!NbrRegions[Vol_NL_Mag])
Generate[A]; Solve[A];
Else
//IterativeLoopN[ NL_max_iter, NL_relax,
// System { {A, NL_reltol, NL_abstol, Solution MeanL2Norm} } ]{
IterativeLoop[NL_max_iter, NL_tol, NL_relax]{
GenerateJac[A]; SolveJac[A];
InitSolution[A];
Generate[A]; Solve[A];
If(NbrRegions[Vol_NL_Mag])
Generate[A]; GetResidual[A, $res0];
Evaluate[ $res = $res0, $iter = 0 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
While[$res > NL_tol_abs && $res / $res0 > NL_tol_rel &&
$res / $res0 <= 1 && $iter < NL_iter_max]{
Solve[A]; Generate[A]; GetResidual[A, $res];
Evaluate[ $iter = $iter + 1 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
}
EndIf
SaveSolution[A];
......
// Lib_EleSta_v.pro
//
// Template library for electrostatics using a scalar electric potential (v)
// formulation, with floating potentials
// formulation, with floating potentials.
// Default definitions of constants, groups and functions that can/should be
// redefined from outside the template:
......@@ -22,26 +22,26 @@ Group {
// Full dielectric domain:
Vol_Ele,
// The following are subsets of Vol_Ele:
Vol_Q_Ele, // domain with imposed volume charge density
Vol_Inf_Ele, // infinite region
// Subsets of Vol_Ele:
Vol_Q_Ele, // region with imposed free charge density rho[]
Vol_Inf_Ele, // annulus where a infinite shell transformation is applied
// Boundaries:
Sur_Neu_Ele, // non-homogeneous Neumann boundary conditions (n.d)
Sur_C_Ele // boundary of conductors
Sur_Neu_Ele, // surfaces with Neumann boundary conditions (n . d = dn[])
Sur_C_Ele // boundary of conductors (constant v)
];
Dom_Ele = Region[ {Vol_Ele, Sur_Neu_Ele} ];
}
Function{
DefineFunction[
epsr, // relative permittivity
rho, // charge density in Vol_Q_Ele
dn // normal displacement on Sur_Neu_Ele
epsr, // relative permittivity (in Vol_Ele)
rho, // free charge density (in Vol_Q_Ele)
dn // normal displacement (on Sur_Neu_Ele)
];
}
// End of default definitions.
// End of definitions.
Jacobian {
{ Name Vol;
......@@ -59,7 +59,7 @@ Jacobian {
}
Integration {
{ Name GradGrad;
{ Name Int;
Case {
{ Type Gauss;
Case {
......@@ -119,14 +119,14 @@ Formulation {
{ Name vf; Type Local; NameOfSpace Hgrad_vf_Ele [vf]; }
}
Equation {
Integral { [ epsr[] * eps0 * Dof{Grad v} , {Grad v} ];
In Vol_Ele; Jacobian Vol; Integration GradGrad; }
Integral { [ epsr[] * eps0 * Dof{d v} , {d v} ];
In Vol_Ele; Jacobian Vol; Integration Int; }
Integral { [ - rho[], {v} ];
In Vol_Q_Ele; Jacobian Vol; Integration GradGrad; }
In Vol_Q_Ele; Jacobian Vol; Integration Int; }
Integral { [ dn[] , {v} ];
In Sur_Neu_Ele; Jacobian Sur; Integration GradGrad; }
In Sur_Neu_Ele; Jacobian Sur; Integration Int; }
GlobalTerm { [ - Dof{Q}, {V} ]; In Sur_C_Ele; }
}
......@@ -176,16 +176,16 @@ PostProcessing {
}
}
{ Name force; Value {
Integral { [ eps0*epsr[] / 2. * VirtualWork[{Grad v}] ];
Integral { [ eps0*epsr[] / 2. * VirtualWork[{d v}] ];
//In Vol_Ele; // restrict support to speed-up search
In ElementsOf[Vol_Ele, OnOneSideOf Sur_C_Ele];
Jacobian Vol; Integration GradGrad;
Jacobian Vol; Integration Int;
}
}
}
{ Name energy; Value {
Integral { [ eps0*epsr[] / 2. * SquNorm[{Grad v}] ];
In Vol_Ele; Jacobian Vol; Integration GradGrad;
Integral { [ eps0*epsr[] / 2. * SquNorm[{d v}] ];
In Vol_Ele; Jacobian Vol; Integration Int;
}
}
}
......
// Lib_MagSta_a_phi.pro
//
// Template library for magnetostatics using a scalar (phi) or a vector (a)
// potential formulation
// potential formulation.
// Default definitions of constants, groups and functions that can/should be
// redefined from outside the template:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment