Linear
Handle linear system solvers with three different attribute features: Direct, Iterative, and Multigrid.
Syntax
sol.feature(fname).create(lname,"Direct")
sol.feature(fname).feature(lname).set(pname,value)
 
sol.feature(fname).create(lname,"Iterative")
sol.feature(fname).feature(lname).set(pname,value)
sol.feature(fname).feature(lname).create(pcname,PType);
sol.feature(fname).feature(lname).feature(pcname).set(pname,value)
 
sol.feature(fname).feature(lname).create(pname,"Multigrid")
sol.feature(fname).feature(lname).feature(pname).feature("pr").create(prename,SType)
sol.feature(fname).feature(lname).feature(pname).feature("po").create(postname,SType)
sol.feature(fname).feature(lname).feature(pname).feature("cs").create(cname,CType)
sol.feature(fname).feature(lname).feature(pname).feature("pr").feature(prename).
set(pname,value)
sol.feature(fname).feature(lname).feature(pname).feature("po").feature(postname).
set(pname,value)
sol.feature(fname).feature(lname).feature(pname).feature("cs").feature(cname).
set(pname,value)
 
PType is any of the allowed preconditioner feature types. These types are Direct preconditioner, Multigrid, Domain decomposition, SCGS, SOR, SOR Gauge, SOR Vector, Vanka, SOR Line, AMS, Incomplete LU, and Krylov preconditioners. SType is any of the allowed smoother types. These are the same as the PType except Domain decomposition, Multigrid, and AMS. CType is any of the allowed coarse grid solver types: Direct and all types listed for PType.
Presmoother, Postsmoother, and Coarse Solver
Specify the Presmoother, Postsmoother, and Coarse Solver via feature("ps"), feature("po"), and feature("cs"), respectively. These features are for administrative purposes only and do not contain any settings themselves.
Description
Three attribute features for linear system solvers.
Examples:
GMRES with ILU as preconditioner:
Code for Use with Java
SolverFeature solver = sol.feature(fname).create("iter1","Iterative");
solver.set("solver","gmres");
solver.create("ilu","IncompleteLU");
Code for Use with MATLAB
solver = sol.feature(fname).create('iter1','Iterative');
solver.set('solver','gmres');
solver.create('ilu','IncompleteLU');
Change the preconditioner to GMG/SORVector/SPOOLES:
Code for Use with Java
solver.create("gmg","Multigrid");
solver("gmg").set("solver","gmg");
solver("gmg").feature("pr").create("p1","SORVector");
solver("gmg").feature("po").create("p1","SORVector");
SolverFeature csolver = solver("gmg").feature("csolver").create("c1","Direct");
csolver.set("solver","spooles");
csolver.set("errorchkd","on");
Code for Use with MATLAB
solver.create('gmg','Multigrid');
solver('gmg').set('solver','gmg');
solver('gmg').feature('pr').create('p1','SORVector');
solver('gmg').feature('po').create('p1','SORVector');
csolver = solver('gmg').feature('csolver').create('c1','Direct');
csolver.set('solver','spooles');
csolver.set('errorchkd','on');
Use Conjugate Gradients instead of GMRES:
Code for Use with Java
solver.set("solver","cg");
Code for Use with MATLAB
solver.set('solver','cg');
Use the sparse approximate inverse (SAI) preconditioner using a sparsity pattern of SAI defined by a power of 3 of the system matrix:
Code for Use with Java
model.sol("sol1").feature("t1").create("i1", "Iterative");
model.sol("sol1").feature("t1").feature("i1").set("linsolver", "cg");
model.sol("sol1").feature("t1").feature("i1").create("sai1", "SAI");
model.sol("sol1").feature("t1").feature("i1").feature("sai1").set("saisymm", "on");
model.sol("sol1").feature("t1").feature("i1").feature("sai1").
   set("saipattern","saipowa");
model.sol("sol1").feature("t1").feature("i1").feature("sai1").set("saipowera", "3");
Code for Use with MATLAB
iter = model.sol('sol1').feature('t1').create('i1', 'Iterative');
iter.set('linsolver', 'cg');
iter.create('sai1', 'SAI');
iter.feature('sai1').set('saisymm', 'on');
iter.feature('sai1').set('saipattern','saipowa');
iter.feature('sai1').set('saipowera', '3');
The Prefun Property
The prefun property for the solver (preconditioner) accepts a different set of values depending on the context. In the section below, its possible values and default value is listed for each preconditioner that supports it.
Direct Properties
off | on | auto
on | off
on
off
(eigenvalue solver)
mumps | pardiso | spooles | dense
on | off
mumps | pardiso | spooles | dense
 400
1
(coarse solver)
 
on | off
auto | manual
auto | amd | amf | qamd | nd
on | off
automatic | on | off
Use out-of-core (PARDISO, MUMPS). The automatic option switches to out-of-core storage if needed.
on | off
mmd | nd | ndmt
 on | off
auto | one | two
on | off
 on | off
mmd | nd | ms | bestof
Iterative Properties
 
off | on | auto
on | off
gmres | fgmres | bicgstab | cg | precond
gmres, ilu (precond)
10000
500
(coarse solver)
on | off
 400
1
(coarse solver)
 
0.01 when used as preconditioner, 1 when used as presmoother, postsmoother, or coarse solver
tol | fill
2 (1 for ILU and ILUT)
tol | iter
ilu | ilut | ilu0 | spooles
auto (SAI only) | left | right
left (auto for SAI)
Left or right preconditioning (gmres, cg, bicgstab, SAI). For SAI, the default preconditioning type is auto.
on | off
auto | off | on | hermitian
sysmat | saipowa
on | off
on | off
on | off
single | multi
all | manual
on | off
gmres | direct
The property divcleantol is used in the inequality |TTb| < divcleantol · |b| to ensure that the numerical divergence after divergence cleaning is small enough; see SOR Gauge in the COMSOL Multiphysics Reference Manual.
Multigrid Properties
gmg | amg
v | w | f
gmg | amg | saamg
amg if used as Krylov preconditioner. gmg, otherwise.
 400
1
(coarse solver)
 
auto | manual
Smoothing of prolongations if usesmooth=on (saamg).
single | multi
all | manual
Jacobi damping facto if usesmooth=on (saamg).
on | off
manual | all | any | coarse | coarseorder | refine | refineany | refineall
on | off
constant | rbm
regular | longest
on | off
on | off
Use filtering if usesmooth=on (saamg).
on | off
Th useaggressive property is no longer used from version 5.3. For the geometric multigrid solver/preconditioners, the multigrid hierarchy is controlled in the following way (see also Multigrid in the COMSOL Multiphysics Reference Manual):
If mcasegen=all, any, or coarse, coarseorder, then the multigrid hierarchy is automatically constructed starting from the mesh and discretization set by the study. The number of multigrid levels generated is given in the property gmglevels. The method all and any first tries to lower the discretization order for the shape functions used, and secondly coarsens the mesh. The method all lowers the order (by one) if all used shape functions can be lowered. The method any lowers the order (by one) if at least one shape function can be lowered. The method coarse does not lower the order, it only coarsens the mesh. The method coarseorder both lowers the order (for any shape functions that can be lowered by one) and coarsen the mesh, at the same time.
If mcasegen=refine, refineany, or refineall then the multigrid hierarchy is automatically constructed by a combination of refining the mesh given by the study and changing the discretization. The number of multigrid levels generated is given in the property gmglevels. The refinement method can be specified using the property rmethod. The originally selected mesh for the study is used, in the case of refining the mesh, in a multigridlevel and the finest multigrid level generated is used for the study (solved for). The generated multigrid levels are kept in the model and the mcasegen property is changed into manual. The method refine only refines the mesh and does not change the shape function order. The method refineany and refineall first tries to lower the order, and secondly refines the mesh. The method refineany constructs a multigrid level by lowering the order (by one) if at least on shape function can be lowered. The method refineall generates multigrid levels by lowering the order (by one) if all used shape function can be lowered.
If mcasegen=manual, then the existing multigrid levels (children to the current study) can be used. The subset to use is selected by giving their tags to the mcaseuse property.
The construction of coarse level matrices is controlled by the property massem and mcaseassem. The first property controls if the matrices should be assembled for the automatically generated levels. If set to off, prolongation and restriction matrices are used to project the matrices from the top level in the hierarchy. The second property controls which multigrid levels that should use the assemble technique in the mcasegen=manual case.
When an iterative solver is used as preconditioner, smoother, or coarse solver you can choose whether to solve using a tolerance or to perform a fixed number of iterations. When used as a coarse solver the default is to solve using a tolerance. When used as a preconditioner or smoother the default is to perform a fixed number of iterations. If both properties itol and iter are given, the program solves using a tolerance.
Domain Decomposition Properties
ddadd | ddmul | ddhyb | ddsym
none | space
auto | matrix | mesh
on | off
on | off
Use coloring (for prefun = ddmul | ddsym).
on | off
on | algebraic | aggregation | off
Use coarse level: geometric (on), algebraic multigrid (algebraic), aggregations AMG (aggregation), or off.
coarseorder | all | any | coarse | refineall | refineany | refine | manual
Mesh coarsening factor (for mcasegen = coarseorder | any | all | coarse).
longest | regular
Mesh refinement method (for mcasegen = refineall | refineany | refine).
Use coarse level in geometries (for mcasegen = coarseorder | all | any | coarse | refineall | refineany | refine).
on | off
Assemble on coarse level (for mcasegen = coarseorder | all | any | coarse | refineall | refineany | refine | manual).
on | off
Keep generated coarse level (for mcasegen = all | any | coarse).
on | off
Maximum number of DOFs at coarsest level (algebraic, aggregation) if maxcoarsedofsactive is on.
Multigrid level to start smoothing at, if aggmethod =manual (aggregation).
auto | manual
on | off
on | off
Use filtering (aggregation).
single | multi
all | manual
Example Code for Use With Java
model.sol("sol1").feature("s1").create("i1", "Iterative");
model.sol("sol1").feature("s1").feature("i1").create("dd1","DomainDecomposition");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").feature("ds").
      create("mg1","Multigrid");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").set("prefun","ddadd");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").set("mcasegen","refine");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").set("domnodesmax","2");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").
      set("overlapmethod","mesh");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").set("ndom", "16");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").
      set("domgeom", new String[]{"geom1"});
model.sol("sol1").feature("s1").feature("i1").feature("dd1").feature("cs").
      feature("dDef").set("linsolver","pardiso");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").feature("ds").
      feature("mg1").set("gmglevels","5");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").
      set("hybridization","multi");
model.sol("sol1").feature("s1").feature("i1").feature("dd1").
      set("hybridcomp", new String[]{"comp1.u"});
SOR Prefun Property
ssor | sor | soru
SSOR Gauge Prefun Property
ssorgauge | sorgauge | sorugauge
sorgauge when used as presmoother; sorugauge when used as postsmoother; ssorgauge otherwise.
SOR Vector Prefun Property
ssorvec | sorvec | soruvec
sorvec when used as presmoother; soruvec when used as postsmoother; ssorvec otherwise.