MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / Solve

Method Solve

python/solve_implementation.py:46–79  ·  view source on GitHub ↗
(
        self,
        rhs=None,
        dirichlet = None,
        printing: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

44
45class NonLinearApplication(Application):
46 def Solve(
47 self,
48 rhs=None,
49 dirichlet = None,
50 printing: bool = False,
51 **kwargs,
52 ):
53 solver_args = {}
54
55 if rhs is not None and rhs != 0:
56 rhs.Assemble()
57 solver_args["rhs"] = rhs
58 if "freedofs" in kwargs:
59 solver_args["freedofs"] = kwargs.pop("freedofs")
60 if "inverse" in kwargs:
61 solver_args["inverse"] = kwargs.pop("inverse")
62 solver = NewtonSolver(self.a, self.gf, **solver_args)
63 if dirichlet is not None:
64 dirichlet_gf = GridFunction(self.gf.space)
65 if isinstance(dirichlet, list):
66 for i in range(len(dirichlet)):
67 if dirichlet[i] is not None:
68 if isinstance(dirichlet[i], Dirichlet):
69 dirichlet_gf.components[i].Set(
70 dirichlet[i].cf, definedon=dirichlet[i].region
71 )
72 else:
73 dirichlet_gf.components[i].Set(dirichlet[i], BND)
74 elif isinstance(dirichlet, Dirichlet):
75 dirichlet_gf.Set(dirichlet.cf, definedon=dirichlet.region)
76 else:
77 dirichlet_gf.Set(dirichlet, BND)
78 solver.SetDirichlet(dirichlet_gf.vec)
79 solver.Solve(printing=printing, **kwargs)
80
81
82class LinearApplication(Application):

Callers

nothing calls this directly

Calls 6

SetDirichletMethod · 0.95
SolveMethod · 0.95
NewtonSolverClass · 0.85
GridFunctionClass · 0.50
AssembleMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected