parallelPartitioningType = ct.parallelPartitioningType nLayersOfOverlapForParallel = ct.nLayersOfOverlapForParallel restrictFineSolutionToAllMeshes = ct.restrictFineSolutionToAllMeshes triangleOptions = ct.triangleOptions timeIntegration = TimeIntegration.BackwardEuler_cfl stepController = StepControl.Min_dt_cfl_controller femSpaces = {0: ct.basis} elementQuadrature = ct.elementQuadrature elementBoundaryQuadrature = ct.elementBoundaryQuadrature massLumping = False numericalFluxType = Dissipation.NumericalFlux conservativeFlux = None subgridError = Dissipation.SubgridError(coefficients=physics.coefficients, nd=ct.domain.nd) shockCapturing = Dissipation.ShockCapturing( coefficients=physics.coefficients, nd=ct.domain.nd, shockCapturingFactor=ct.dissipation_shockCapturingFactor, lag=ct.dissipation_lag_shockCapturing) fullNewtonFlag = True multilevelNonlinearSolver = NonlinearSolvers.Newton levelNonlinearSolver = NonlinearSolvers.Newton nonlinearSmoother = None linearSmoother = None #printNonlinearSolverInfo = True matrix = LinearAlgebraTools.SparseMatrix if not ct.useOldPETSc and not ct.useSuperlu:
RD_model = 3 LS_model = 2 ME_model = 6 kappa_model = 5 # dissipation_model_flag = 1 if ct.useRANS == 2: dissipation_model_flag = 2 coefficients = Dissipation.Coefficients(V_model=0, ME_model=ME_model, LS_model=LS_model, RD_model=RD_model, kappa_model=kappa_model, dissipation_model_flag=dissipation_model_flag,#1 -- K-epsilon, 2 -- K-omega useMetrics=ct.useMetrics, rho_0=ct.rho_0, nu_0=ct.nu_0, rho_1=ct.rho_1, nu_1=ct.nu_1, g=ct.g, c_mu=0.09,sigma_e=1.0, sc_uref=ct.dissipation_sc_uref, sc_beta=ct.dissipation_sc_beta) dirichletConditions = {0: lambda x, flag: domain.bc[flag].dissipation_dirichlet.init_cython()} advectiveFluxBoundaryConditions = {0: lambda x, flag: domain.bc[flag].dissipation_advective.init_cython()} diffusiveFluxBoundaryConditions = {0: {0: lambda x, flag: domain.bc[flag].dissipation_diffusive.init_cython()}} dissipationInflow = coefficients.c_mu*kInflow**(1.5)/(0.03*ct.L[1]) class ConstantIC: def __init__(self,cval=0.0):
ME_model = 6 kappa_model = 5 if movingDomain: kappa_model += 1 ME_model += 1 # dissipation_model_flag = 1 if useRANS == 2: dissipation_model_flag=2 elif useRANS == 3: dissipation_model_flag=3 coefficients = Dissipation.Coefficients(V_model=0,ME_model=ME_model,LS_model=LS_model,RD_model=RD_model,kappa_model=kappa_model, dissipation_model_flag=dissipation_model_flag,#1 -- K-epsilon, 2 -- K-omega 1998, 3 -- K-omega 1988 useMetrics=useMetrics, rho_0=rho_0,nu_0=nu_0, rho_1=rho_1,nu_1=nu_1, g=g, c_mu=0.09,sigma_e=1.0, sc_uref=dissipation_sc_uref, sc_beta=dissipation_sc_beta) dissipationInflow = coefficients.c_mu*kInflow**(1.5)/(0.03*L[1]) if useRANS >= 2: dissipationInflow = dissipationInflow/(kInflow+1.0e-12) def getDBC_dissipation(x,flag): if flag == boundaryTags['left']: return lambda x,t:dissipationInflow if flag == boundaryTags['right']: return lambda x,t:0.0
from proteus import * from proteus.default_p import * from suboff2D import * from proteus.mprans import Dissipation LevelModelType = Dissipation.LevelModel coefficients = Dissipation.Coefficients(V_model=0,ME_model=4,LS_model=1,RD_model=None,kappa_model=3, dissipation_model_flag=dissipation_model_flag, useMetrics=useMetrics, rho_0=rho_0,nu_0=nu_0, rho_1=rho_1,nu_1=nu_1, g=g, c_mu=0.09,sigma_e=1.0,#default values for c_1,c_2,c_e sc_uref=dissipation_sc_uref,sc_beta=dissipation_sc_beta) dissipationInflow = coefficients.c_mu*kInflow**(1.5)/(0.03*upstream_height) if dissipation_model_flag >= 2: dissipationInflow = dissipationInflow/(kInflow+1.0e-12) def getDBC_dissipation(x,flag): if flag == boundaryTags['left']: return lambda x,t:dissipationInflow dirichletConditions = {0:getDBC_dissipation} fluxBoundaryConditions = {0:'outFlow'} def getAFBC_dissipation(x,flag): if flag == boundaryTags['right']: return None if flag == boundaryTags['obstacle']:
LevelModelType = Dissipation.LevelModel dissipation_model_flag = 1 if ct.useRANS >= 2: dissipation_model_flag = 2 coefficients = Dissipation.Coefficients( V_model=ct.V_model, ME_model=ct.EPS_model, LS_model=ct.LS_model, RD_model=ct.RD_model, kappa_model=ct.K_model, SED_model=ct.SED_model, dissipation_model_flag=dissipation_model_flag + int(ct.movingDomain), #1 -- K-epsilon, 2 -- K-omega useMetrics=useMetrics, rho_0=rho_0, nu_0=nu_0, rho_1=rho_1, nu_1=nu_1, g=g, c_mu=ct.opts.Cmu, sigma_e=ct.opts.sigma_e, nd=ct.nd, sc_uref=dissipation_sc_uref, sc_beta=dissipation_sc_beta, closure=ct.sedClosure) kInflow = ct.kInflow dissipationInflow = ct.dissipationInflow
if timeIntegration == "VBDF": timeIntegration = TimeIntegration.VBDF timeOrder = 2 else: timeIntegration = TimeIntegration.BackwardEuler_cfl stepController = StepControl.Min_dt_controller femSpaces = {0: basis} elementQuadrature = elementQuadrature elementBoundaryQuadrature = elementBoundaryQuadrature massLumping = False numericalFluxType = Dissipation.NumericalFlux conservativeFlux = None subgridError = Dissipation.SubgridError(coefficients=physics.coefficients, nd=nd) shockCapturing = Dissipation.ShockCapturing( coefficients=physics.coefficients, nd=nd, shockCapturingFactor=user_param.dissipation_shockCapturingFactor, lag=user_param.dissipation_lag_shockCapturing) fullNewtonFlag = True multilevelNonlinearSolver = NonlinearSolvers.Newton levelNonlinearSolver = NonlinearSolvers.Newton nonlinearSmoother = None linearSmoother = None matrix = LinearAlgebraTools.SparseMatrix
if user_param.useRANS == 2: dissipation_model_flag = 2 if user_param.useRANS == 3: dissipation_model_flag = 3 print('dissipation_model_flag =', dissipation_model_flag) gravity = numpy.array([user_param.gravity[0], user_param.gravity[1], user_param.gravity[2]], dtype='d'), coefficients = Dissipation.Coefficients( V_model = 0 + int(movingDomain), ME_model = ME_model, LS_model = LS_model, RD_model = RD_model, #kappa_model = kappa_model, dissipation_model_flag = dissipation_model_flag, #1 -- K-epsilon, 2 -- K-omega 1998, 3 -- K-omega 1988 useMetrics = useMetrics, #user_param rho_0 = rho_0, rho_1 = rho_1, nu_0 = nu_0, nu_1 = nu_1, g = gravity c_mu = 0.09, sigma_e = 1.0, sc_uref = dissipation_sc_uref, sc_beta = dissipation_sc_beta ) dirichletConditions = { 0: lambda x,flag: domain.bc[domain.meshtag_bcIdx[flag]].dissipation_dirichlet.init_cython() }
LS_model = 2 ME_model = 6 kappa_model = 5 # dissipation_model_flag = 1 if useRANS >= 2: dissipation_model_flag = 2 coefficients = Dissipation.Coefficients( V_model=0 + int(ct.movingDomain), ME_model=ME_model + int(ct.movingDomain), LS_model=LS_model + int(ct.movingDomain), RD_model=RD_model + int(ct.movingDomain), kappa_model=kappa_model + int(ct.movingDomain), dissipation_model_flag=dissipation_model_flag + int(ct.movingDomain), #1 -- K-epsilon, 2 -- K-omega useMetrics=useMetrics, rho_0=rho_0, nu_0=nu_0, rho_1=rho_1, nu_1=nu_1, g=g, c_mu=ct.opts.c_mu, sigma_e=ct.opts.sigma_e, sc_uref=dissipation_sc_uref, sc_beta=dissipation_sc_beta) kInflow = ct.kInflow dissipationInflow = ct.dissipationInflow dirichletConditions = { 0: lambda x, flag: domain.bc[flag].dissipation_dirichlet.init_cython()
if useRANS == 2: dissipation_model_flag = 2 elif useRANS == 3: dissipation_model_flag = 3 coefficients = Dissipation.Coefficients( V_model=int(movingDomain) + 0, ME_model=ME_model, LS_model=LS_model, RD_model=RD_model, # kappa_model=kappa_model, dissipation_model_flag= dissipation_model_flag, #1 -- K-epsilon, 2 -- K-omega 1998, 3 -- K-omega 1988 useMetrics=user_param.useMetrics, rho_0=user_param.rho_water, nu_0=user_param.nu_water, rho_1=user_param.rho_air, nu_1=user_param.nu_air, #g=user_param.gravity, g=numpy.array( [user_param.gravity[0], user_param.gravity[1], user_param.gravity[2]], dtype='d'), c_mu=0.09, sigma_e=1.0, sc_uref=user_param.dissipation_sc_uref, sc_beta=user_param.dissipation_sc_beta) dirichletConditions = { 0: lambda x, flag: domain.bc[flag].dissipation_dirichlet.init_cython() } advectiveFluxBoundaryConditions = {