-
Notifications
You must be signed in to change notification settings - Fork 0
/
ls_n.py
82 lines (65 loc) · 2.39 KB
/
ls_n.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from proteus.default_n import *
import ls_p as physics
from proteus import (StepControl,
TimeIntegration,
NonlinearSolvers,
LinearSolvers,
LinearAlgebraTools)
from proteus.mprans import NCLS
from proteus import Context
ct = Context.get()
domain = ct.domain
nd = ct.domain.nd
mesh = domain.MeshOptions
# time stepping
runCFL = ct.runCFL
if ct.timeIntegration == "VBDF":
timeIntegration = TimeIntegration.VBDF
timeOrder = 2
else:
timeIntegration = TimeIntegration.BackwardEuler_cfl
stepController = StepControl.Min_dt_controller
# mesh options
nLevels = ct.nLevels
parallelPartitioningType = mesh.parallelPartitioningType
nLayersOfOverlapForParallel = mesh.nLayersOfOverlapForParallel
restrictFineSolutionToAllMeshes = mesh.restrictFineSolutionToAllMeshes
triangleOptions = mesh.triangleOptions
elementQuadrature = ct.elementQuadrature
elementBoundaryQuadrature = ct.elementBoundaryQuadrature
femSpaces = {0: ct.basis}
massLumping = False
conservativeFlux = None
numericalFluxType = NCLS.NumericalFlux
subgridError = NCLS.SubgridError(coefficients=physics.coefficients,
nd=ct.domain.nd)
shockCapturing = NCLS.ShockCapturing(physics.coefficients,
ct.domain.nd,
shockCapturingFactor=ct.ls_shockCapturingFactor,
lag=ct.ls_lag_shockCapturing)
fullNewtonFlag = True
multilevelNonlinearSolver = NonlinearSolvers.Newton
levelNonlinearSolver = NonlinearSolvers.Newton
nonlinearSmoother = None
linearSmoother = None
matrix = LinearAlgebraTools.SparseMatrix
if ct.useOldPETSc:
multilevelLinearSolver = LinearSolvers.PETSc
levelLinearSolver = LinearSolvers.PETSc
else:
multilevelLinearSolver = LinearSolvers.KSP_petsc4py
levelLinearSolver = LinearSolvers.KSP_petsc4py
if ct.useSuperlu:
multilevelLinearSolver = LinearSolvers.LU
levelLinearSolver = LinearSolvers.LU
linear_solver_options_prefix = 'ncls_'
levelNonlinearSolverConvergenceTest = 'r'
linearSolverConvergenceTest = 'r-true'
tolFac = 0.0
linTolFac = 0.001
l_atol_res = 0.001*ct.ls_nl_atol_res
nl_atol_res = ct.ls_nl_atol_res
useEisenstatWalker = False#True
maxNonlinearIts = 50
maxLineSearches = 0
auxiliaryVariables = ct.domain.auxiliaryVariables['ls']