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, Auxiliary-Space AMG, Incomplete LU, Krylov, and Block Navier–Stokes. SType is any of the allowed smoother types. These are the same as the PType except Domain decomposition, Multigrid, AMS, and Auxiliary-Space AMG. CType is any of the allowed coarse grid solver types: Direct and all types listed for PType.
Presmoother, AMG Presmoother, Postsmoother, AMG Postsmoother, Coarse Solver, AMG Coarse Solver, SchurSolver, SchurSourceSolver, PressureSolver, and VelocitySolver
Specify the Presmoother and AMG Presmoother, Postsmoother and AMG Postsmoother, Coarse Solver and AMG Coarse Solver, Schur Solver, Schur Source Solver, Pressure Solver, and Velocity Solver via feature("pr"), feature("po"), feature("cs"), feature("sso"), feature("ssso"), feature("ps"), and feature("vs"), 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
 
on | off
auto | manual
 on | off
normal | aggressive
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
true | false
Iterative Properties
 
off | on | auto
gmres | fgmres | bicgstab | tfqmr | cg | precond
gmres, ilu (precond)
10000
500
(coarse solver)
 
true | false
Use approximate approximation, if vankavarsactive is set to true (SCGS).
 0.01 when used as preconditioner; 1 when used as presmoother, postsmoother, or coarse solver; 0.001 for Hierarchical LU and Sparse Localized Schur
tol | fill
Number of approximate eigenvectors, when gcrodr is set to true (GMRES).
Fraction of GMRES iterations when gcrodrrel is set to true (GMRES).
true | false
true | false
Use relative subspace size when gcrodr is set to true (GMRES).
single | multi
all | manual
Residual tolerance when prefuntype is left (gmres, cg, bicgstab, tfqmr).
2 (1 for ILU and ILUT)
tol | iter | itertol
Relative tolerance when iterm is set to tol or itertol.
auto | on | off
Reuse the subspace when gcrodr is set to true (GMRES).
ssor | sor | soru
auto | sparse | filled | matrixfree
ilu | ilut | ilu0 | spooles
auto (SAI only) | left | right
left (auto for SAI)
Left or right preconditioning (gmres, cg, bicgstab, tfqmr, SAI). For SAI, the default preconditioning type is auto.
on | off
on | off
true | false
on | off
auto | off | on | hermitian
sysmat | saipowa
true | false
true | false
true | false
true | false
Apply filter to AMG levels only, if scgsfilter is true (SCGS).
true | false
Filter individual elements, if scgsfilter is true (SCGS)
none | filterstart | filterall
elements | lines | lines_vertices
true | false
gmres | direct | stored | approx
on | off
on | off
on | off
true | false
on | off
gmres | direct | stored | approx
true | false
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
true | false
gmg | amg | saamg
amg if used as Krylov preconditioner. gmg, otherwise.
 
auto | manual
Smoothing of prolongations if usesmooth=on (saamg).
true | false
on | off
Assemble on the order-lowered levels when loweramg is on (amg and saamg).
parallel | classic
on | off
single | multi
all | manual
Jacobi damping factor if usesmooth=on (saamg).
on | off
on | off
on | off
manual | all | any | coarse | coarseorder | refine | refineany | refineall
on | off
constant | rbm
on | off
on | off
regular | longest
on | off
on | off
Use filtering if usesmooth=on (saamg).
on | off
The 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 (Schwarz and Schur)
Multigrid level to start smoothing at, if aggmethod =manual (aggregation) (Schwarz only).
auto | manual
Postpone prolongation smoothing (aggregation) (Schwarz only).
Quality of multigrid hierarchy (algebraic) (Schwarz only).
Quality of multigrid hierarchy (algebraic) (Schwarz only).
on | off
Assemble on the order-lowered levels (algebraic, aggregation) if loweramgdd is on (Schwarz only).
on | off
none | dissection | space
Use coarse level in geometries (for mcasegen=coarseorder | all | any | coarse | refineall | refineany | refine) (Schwarz only).
single | multi
all | manual
Jacobi damping factor (aggregation) (Schwarz only).
on | off
on | off
on | off
Lower element order first (algebraic, aggregation) (Schwarz only).
on | off
Assemble on coarse level (for mcasegen=coarseorder | all | any | coarse | refineall | refineany | refine | manual) (Schwarz only).
Maximum number of DOFs at coarsest level (algebraic, aggregation) if maxcoarsedofsactive is on (Schwarz only).
on | off
coarseorder | all | any | coarse | refineall | refineany | refine | manual
Coarse level that should be used (for mcasegen=manual) (Schwarz only).
Maximum number of algebraic multigrid levels (algebraic, aggregation) (Schwarz only).
on | off
Keep generated coarse level (for mcasegen=all | any | coarse) (Schwarz only).
2 (Schwarz); 4 (Schur)
auto | matrix | mesh
on | off
prefun (Schur)
ddschuradd | ddschurmul
prefun (Schwarz)
ddadd | ddmul | ddhyb | ddsym
on | off
Reuse prolongators when possible (aggregation) (Schwarz only).
longest | regular
Mesh refinement method (for mcasegen=refineall | refineany | refine) (Schwarz only).
Mesh coarsening factor (for mcasegen=coarseorder | any | all | coarse) (Schwarz only).
Strength of connection (aggregation) (Schwarz only).
on | off
Use aggressive coarsening (aggregation) (Schwarz only).
on | algebraic | aggregation | nicolaides | off
Use coarse level: geometric (on), algebraic multigrid (algebraic), aggregations AMG (aggregation), nicolaides (Schwarz only), or off (Schwarz only).
on | off
Use coloring (for prefun = ddmul | ddsym) (Schwarz only).
on | off
Use filtering (aggregation) (Schwarz only).
auto | on | off
on | off
Use coloring (for prefun = ddschurmul) (Schur only).
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