Skip to content

Commit

Permalink
Apply autopep8 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 28, 2024
1 parent c961e03 commit 161aefd
Showing 1 changed file with 156 additions and 156 deletions.
312 changes: 156 additions & 156 deletions Fast/FastC/FastC/PyTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _createPrimVars(t, omp_mode, rmConsVars=True, Adjoint=False, gradP=False, is
fields2compact.append('centers:S'+str(vars_s[i])) #Tenseur S pour HRR
vars.append(fields2compact)
for i in range(len(vars_s)):
fields2compact.append('centers:S'+str(vars_s[i])+'_P1') #Tenseur S pour HRR
fields2compact.append('centers:S'+str(vars_s[i])+'_P1') #Tenseur S pour HRR
vars.append(fields2compact)
for i in range(len(vars_psi)):
fields2compact.append('centers:corr_'+str(vars_psi[i])) #Gradients PSI pour HRR
Expand All @@ -327,12 +327,12 @@ def _createPrimVars(t, omp_mode, rmConsVars=True, Adjoint=False, gradP=False, is
vars.append(fields2compact)

if model_loc == 'Nada' or model_loc == 'Euler' or model_loc == 'NSLaminar' or model_loc == 'NSTurbulent':
timelevel = ['', '_M1','_P1']
timelevel = ['', '_M1','_P1']
elif model_loc == 'LBMLaminar':
if lbmAJ: timelevel = ['', '_M1']
else: timelevel = ['', '_P1']
if lbmAJ: timelevel = ['', '_M1']
else: timelevel = ['', '_P1']
else: raise ValueError('createPrimVars: unknown model %s.'%model_loc)

for level in timelevel: #champs primitives
fields2compact=[]
for v in vars_p:
Expand Down Expand Up @@ -547,7 +547,7 @@ def _createVarsFast(base, zone, omp_mode, rmConsVars=True, adjoint=False, gradP=
else:
neq_lbm = Internal.getNodeFromName2(zone, 'Parameter_int')[1][VSHARE.NEQ_LBM]
sponge = Internal.getNodeFromName2(zone, 'Parameter_int')[1][VSHARE.LBM_SPONGE]

if C.isNamePresent(zone, 'centers:Density_P1' ) != 1: C._cpVars(zone, 'centers:Density' , zone, 'centers:Density_P1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityX_P1' ) != 1: C._cpVars(zone, 'centers:VelocityX' , zone, 'centers:VelocityX_P1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityY_P1' ) != 1: C._cpVars(zone, 'centers:VelocityY' , zone, 'centers:VelocityY_P1' ); FIRST_IT=0
Expand All @@ -574,23 +574,23 @@ def _createVarsFast(base, zone, omp_mode, rmConsVars=True, adjoint=False, gradP=
for comppsi in COMPOSANTES_PSI:
if C.isNamePresent(zone, 'centers:corr_'+str(comppsi)) != 1: C._initVars(zone, 'centers:corr_'+str(comppsi), 0.)
# if C.isNamePresent(zone, 'centers:corr_'+str(comppsi)+'_P1') != 1: C._cpVars(zone, 'centers:corr_'+str(comppsi), zone, 'centers:corr_'+str(comppsi)+'_P1'); FIRST_IT=0

#Ajout du coef des zones eponges si necessaire
if sponge == 1:
if C.isNamePresent(zone, 'centers:SpongeCoef') != 1: C._initVars(zone, 'centers:SpongeCoef', 0.)

#var AJ
if lbmAJ:
for i in range(1,3+1):
if C.isNamePresent(zone, 'centers:cellN_IBC_LBM' +str(i) ) != 1: C._initVars(zone, 'centers:cellN_IBC_LBM_' +str(i) , 0.)
if C.isNamePresent(zone, 'centers:SpongeCoef') != 1: C._initVars(zone, 'centers:SpongeCoef' , 0.)

if C.isNamePresent(zone, 'centers:Density_M1' ) != 1: C._cpVars(zone, 'centers:Density' , zone, 'centers:Density_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityX_M1' ) != 1: C._cpVars(zone, 'centers:VelocityX' , zone, 'centers:VelocityX_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityY_M1' ) != 1: C._cpVars(zone, 'centers:VelocityY' , zone, 'centers:VelocityY_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityZ_M1' ) != 1: C._cpVars(zone, 'centers:VelocityZ' , zone, 'centers:VelocityZ_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:Temperature_M1') != 1: C._cpVars(zone, 'centers:Temperature', zone, 'centers:Temperature_M1'); FIRST_IT=0
for i in range(1,3+1):
if C.isNamePresent(zone, 'centers:cellN_IBC_LBM' +str(i) ) != 1: C._initVars(zone, 'centers:cellN_IBC_LBM_' +str(i) , 0.)

if C.isNamePresent(zone, 'centers:SpongeCoef') != 1: C._initVars(zone, 'centers:SpongeCoef' , 0.)

if C.isNamePresent(zone, 'centers:Density_M1' ) != 1: C._cpVars(zone, 'centers:Density' , zone, 'centers:Density_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityX_M1' ) != 1: C._cpVars(zone, 'centers:VelocityX' , zone, 'centers:VelocityX_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityY_M1' ) != 1: C._cpVars(zone, 'centers:VelocityY' , zone, 'centers:VelocityY_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:VelocityZ_M1' ) != 1: C._cpVars(zone, 'centers:VelocityZ' , zone, 'centers:VelocityZ_M1' ); FIRST_IT=0
if C.isNamePresent(zone, 'centers:Temperature_M1') != 1: C._cpVars(zone, 'centers:Temperature', zone, 'centers:Temperature_M1'); FIRST_IT=0
# fin du if zone LBM ------------------------------------

# init moyenne loi de paroi
Expand Down Expand Up @@ -936,88 +936,88 @@ def _buildOwnData(t, Padding):
}

keys4Zone = {
'scheme':['ausmpred', 'senseur', 'roe_min', 'roe', 'roe_nul', 'roe_kap', 'senseur_hyper'],
'implicit_solver':['lussor', 'gmres'],
'nb_relax':0,
'nb_krylov':0,
'nb_restart':0,
'motion':['none', 'rigid', 'rigid_ext', 'deformation'],
'rotation':4,
'time_step':1,
'io_thread':0,
'sgsmodel': ['smsm','msm','Miles'],
'wallmodel': ['musker','power'],
'wallmodel_sample': 0,
'ransmodel': ['SA', 'SA_comp', 'SA_diff'],
'cache_blocking_I':0,
'cache_blocking_J':0,
'cache_blocking_K':0,
'shiftvar':0,
'time_step_nature':['local', 'global'],
'ssdom_IJK':3,
'lu_match':1,
'epsi_newton':1,
'epsi_linear':1,
'inj1_newton_tol':1,
'inj1_newton_nit':0,
'cfl':1,
'niveaux_temps':0,
'psiroe':1,
'coef_hyper':4,
'prandtltb':1,
'sfd':0,
'sfd_chi':1,
'sfd_delta':1,
'sfd_init_iter':0,
'slope':["o1", "o3","o5", "minmod","o3sc","o5sc"],
'DES':["zdes1", "zdes1_w", "zdes2", "zdes2_w", "zdes3", "zdes3_w"],
'SA_add_LowRe': 0,
'SA_add_RotCorr': 0,
'snear': 1, # ignored
'DES_debug':['none','active'],
'extract_res':0,
'IBC':3,
'source':0,
'Cups':4,
'senseurType':0,
'ratiom':1,
#=========================================================
# LBM specific keywords
#=========================================================
'LBM_velocity_set':['D3Q19','D3Q19i','D3Q27'],
'LBM_coll_model':['BGK', 'BGK+', 'RR', 'RR_HPC', 'HRR', 'TRT'], #Remarque : TRT uniquement pour FastLBM (AJ)
'LBM_relax_time':1,
'LBM_hrr_sigma':1,
'LBM_compressible':0,
'LBM_sponge':0,
'lbm_ns':0,
'lbm_c0':1,
'lbm_gamma_precon':1,
'lbm_dif_coef':1,
'lbm_selective_filter':0,
'lbm_selective_filter_size':0,
'lbm_selective_filter_sigma':1,
'lbm_adaptive_filter_chi':1,
'lbm_chi_spongetypeII':1,
'lbm_sponge_size':0,
'lbm_spng_xmin':1,
'lbm_spng_xmax':0,
'lbm_spng_ymin':0,
'lbm_spng_ymax':0,
'lbm_spng_zmin':0,
'lbm_spng_zmax':0,
'lbm_ibm':0,
'lbm_isforce':0,
'lbm_zlim':1,
'lbm_ibm_connector':0,
'LBM_overset':0,
'LBM_dx':1,
'LBM_NS':0,
#=========================================================
#=========================================================
'KWire_p':1,
'DiameterWire_p':1,
'CtWire_p':1
'scheme':['ausmpred', 'senseur', 'roe_min', 'roe', 'roe_nul', 'roe_kap', 'senseur_hyper'],
'implicit_solver':['lussor', 'gmres'],
'nb_relax':0,
'nb_krylov':0,
'nb_restart':0,
'motion':['none', 'rigid', 'rigid_ext', 'deformation'],
'rotation':4,
'time_step':1,
'io_thread':0,
'sgsmodel': ['smsm','msm','Miles'],
'wallmodel': ['musker','power'],
'wallmodel_sample': 0,
'ransmodel': ['SA', 'SA_comp', 'SA_diff'],
'cache_blocking_I':0,
'cache_blocking_J':0,
'cache_blocking_K':0,
'shiftvar':0,
'time_step_nature':['local', 'global'],
'ssdom_IJK':3,
'lu_match':1,
'epsi_newton':1,
'epsi_linear':1,
'inj1_newton_tol':1,
'inj1_newton_nit':0,
'cfl':1,
'niveaux_temps':0,
'psiroe':1,
'coef_hyper':4,
'prandtltb':1,
'sfd':0,
'sfd_chi':1,
'sfd_delta':1,
'sfd_init_iter':0,
'slope':["o1", "o3","o5", "minmod","o3sc","o5sc"],
'DES':["zdes1", "zdes1_w", "zdes2", "zdes2_w", "zdes3", "zdes3_w"],
'SA_add_LowRe': 0,
'SA_add_RotCorr': 0,
'snear': 1, # ignored
'DES_debug':['none','active'],
'extract_res':0,
'IBC':3,
'source':0,
'Cups':4,
'senseurType':0,
'ratiom':1,
#=========================================================
# LBM specific keywords
#=========================================================
'LBM_velocity_set':['D3Q19','D3Q19i','D3Q27'],
'LBM_coll_model':['BGK', 'BGK+', 'RR', 'RR_HPC', 'HRR', 'TRT'], #Remarque : TRT uniquement pour FastLBM (AJ)
'LBM_relax_time':1,
'LBM_hrr_sigma':1,
'LBM_compressible':0,
'LBM_sponge':0,
'lbm_ns':0,
'lbm_c0':1,
'lbm_gamma_precon':1,
'lbm_dif_coef':1,
'lbm_selective_filter':0,
'lbm_selective_filter_size':0,
'lbm_selective_filter_sigma':1,
'lbm_adaptive_filter_chi':1,
'lbm_chi_spongetypeII':1,
'lbm_sponge_size':0,
'lbm_spng_xmin':1,
'lbm_spng_xmax':0,
'lbm_spng_ymin':0,
'lbm_spng_ymax':0,
'lbm_spng_zmin':0,
'lbm_spng_zmax':0,
'lbm_ibm':0,
'lbm_isforce':0,
'lbm_zlim':1,
'lbm_ibm_connector':0,
'LBM_overset':0,
'LBM_dx':1,
'LBM_NS':0,
#=========================================================
#=========================================================
'KWire_p':1,
'DiameterWire_p':1,
'CtWire_p':1
}

bases = Internal.getNodesFromType1(t, 'CGNSBase_t') # noeud
Expand Down Expand Up @@ -1334,7 +1334,7 @@ def _buildOwnData(t, Padding):
lbm_hrr_sigma = 0.985 # Par defaut: Valeur M2P2 pour HRR
lbm_c0 = 1./math.sqrt(3.) # Lattice speed of sound
lbm_q19i = 0 # Flag for improved D3Q19

lbm_gamma_precon = 1.
lbm_dif_coef = 0. # nu_local
# coll_model = "BGK_O3" #Par defaut: Modele BGK avec eq ordre 3
Expand Down Expand Up @@ -1747,7 +1747,7 @@ def _buildOwnData(t, Padding):

# creation noeud parametre integer


number_of_defines_param_int = 136 # Number Param INT
size_int = number_of_defines_param_int +1 # number of defines + 1

Expand Down Expand Up @@ -1874,7 +1874,7 @@ def _buildOwnData(t, Padding):
datap[VSHARE.LBM_COL_OP] = lbm_collision_model
datap[VSHARE.LBM_HLBM] = lbm_compressible
datap[VSHARE.LBM_Q19i] = lbm_q19i

#Unused parameters at the moment
datap[VSHARE.LBM_FILTER] = lbm_selective_filter
datap[VSHARE.LBM_FILTER_SZ] = lbm_selective_filter_size
Expand Down Expand Up @@ -2646,71 +2646,71 @@ def switchPointersLBM__(zones, neq_lbm, dtloc):

#if level==1 or (level >=2 and level <= level_next_it) :
if level <= level_next_it :
#print("switch Pt", z[0])
sol = Internal.getNodeFromName1(z, 'FlowSolution#Centers')
cro = Internal.getNodeFromName1(sol, 'Density')
cux = Internal.getNodeFromName1(sol, 'VelocityX')
cuy = Internal.getNodeFromName1(sol, 'VelocityY')
cuz = Internal.getNodeFromName1(sol, 'VelocityZ')
cT = Internal.getNodeFromName1(sol, 'Temperature')
croP1 = Internal.getNodeFromName1(sol, 'Density_P1')
cuxP1 = Internal.getNodeFromName1(sol, 'VelocityX_P1')
cuyP1 = Internal.getNodeFromName1(sol, 'VelocityY_P1')
cuzP1 = Internal.getNodeFromName1(sol, 'VelocityZ_P1')
cTP1 = Internal.getNodeFromName1(sol, 'Temperature_P1')
#print("switch Pt", z[0])
sol = Internal.getNodeFromName1(z, 'FlowSolution#Centers')

cro = Internal.getNodeFromName1(sol, 'Density')
cux = Internal.getNodeFromName1(sol, 'VelocityX')
cuy = Internal.getNodeFromName1(sol, 'VelocityY')
cuz = Internal.getNodeFromName1(sol, 'VelocityZ')
cT = Internal.getNodeFromName1(sol, 'Temperature')

croP1 = Internal.getNodeFromName1(sol, 'Density_P1')
cuxP1 = Internal.getNodeFromName1(sol, 'VelocityX_P1')
cuyP1 = Internal.getNodeFromName1(sol, 'VelocityY_P1')
cuzP1 = Internal.getNodeFromName1(sol, 'VelocityZ_P1')
cTP1 = Internal.getNodeFromName1(sol, 'Temperature_P1')

# C._cpVars(z, 'centers:Density' , z, 'centers:Density_M1' )
# C._cpVars(z, 'centers:VelocityX' , z, 'centers:VelocityX_M1' )
# C._cpVars(z, 'centers:VelocityY' , z, 'centers:VelocityY_M1' )
# C._cpVars(z, 'centers:VelocityZ' , z, 'centers:VelocityZ_M1' )
# C._cpVars(z, 'centers:Temperature', z, 'centers:Temperature_M1')
# sauvegarde M1
ta = cro[1]; tb = cux[1]; tc = cuy[1]; td = cuz[1]; te = cT[1];
# M1 <- current
cro[1] = croP1[1]; cux[1] = cuxP1[1]; cuy[1] = cuyP1[1]; cuz[1] = cuzP1[1]; cT[1] = cTP1[1];
# current <- P1
croP1[1] = ta; cuxP1[1] = tb; cuyP1[1] = tc; cuzP1[1] = td; cTP1[1] = te;
cxx = Internal.getNodeFromName1(sol, 'Sxx')
cxy = Internal.getNodeFromName1(sol, 'Sxy')
cxz = Internal.getNodeFromName1(sol, 'Sxz')
cyy = Internal.getNodeFromName1(sol, 'Syy')
cyz = Internal.getNodeFromName1(sol, 'Syz')
czz = Internal.getNodeFromName1(sol, 'Szz')
cxxP1 = Internal.getNodeFromName1(sol, 'Sxx_P1')
cxyP1 = Internal.getNodeFromName1(sol, 'Sxy_P1')
cxzP1 = Internal.getNodeFromName1(sol, 'Sxz_P1')
cyyP1 = Internal.getNodeFromName1(sol, 'Syy_P1')
cyzP1 = Internal.getNodeFromName1(sol, 'Syz_P1')
czzP1 = Internal.getNodeFromName1(sol, 'Szz_P1')
# sauvegarde M1
ta = cro[1]; tb = cux[1]; tc = cuy[1]; td = cuz[1]; te = cT[1];
# M1 <- current
cro[1] = croP1[1]; cux[1] = cuxP1[1]; cuy[1] = cuyP1[1]; cuz[1] = cuzP1[1]; cT[1] = cTP1[1];
# current <- P1
croP1[1] = ta; cuxP1[1] = tb; cuyP1[1] = tc; cuzP1[1] = td; cTP1[1] = te;

cxx = Internal.getNodeFromName1(sol, 'Sxx')
cxy = Internal.getNodeFromName1(sol, 'Sxy')
cxz = Internal.getNodeFromName1(sol, 'Sxz')
cyy = Internal.getNodeFromName1(sol, 'Syy')
cyz = Internal.getNodeFromName1(sol, 'Syz')
czz = Internal.getNodeFromName1(sol, 'Szz')

cxxP1 = Internal.getNodeFromName1(sol, 'Sxx_P1')
cxyP1 = Internal.getNodeFromName1(sol, 'Sxy_P1')
cxzP1 = Internal.getNodeFromName1(sol, 'Sxz_P1')
cyyP1 = Internal.getNodeFromName1(sol, 'Syy_P1')
cyzP1 = Internal.getNodeFromName1(sol, 'Syz_P1')
czzP1 = Internal.getNodeFromName1(sol, 'Szz_P1')

# C._cpVars(z, 'centers:Sxx' , z, 'centers:sxx_M1')
# C._cpVars(z, 'centers:Sxy' , z, 'centers:Sxy_M1')
# C._cpVars(z, 'centers:Sxz' , z, 'centers:Sxz_M1')
# C._cpVars(z, 'centers:Syy' , z, 'centers:Syy_M1')
# C._cpVars(z, 'centers:Syz' , z, 'centers:Syz_M1')
# C._cpVars(z, 'centers:Szz' , z, 'centers:Szz_M1')

# sauvegarde M1
ta = cxx[1]; tb = cxy[1]; tc = cxz[1]; td = cyy[1]; te = cyz[1]; tf = czz[1]
# M1 <- current
cxx[1] = cxxP1[1]; cxy[1] = cxyP1[1]; cxz[1] = cxzP1[1]; cyy[1] = cyyP1[1]; cyz[1] = cyzP1[1]; czz[1] = czzP1[1];
# current <- P1
cxxP1[1] = ta; cxyP1[1] = tb; cxzP1[1] = tc; cyyP1[1] = td; cyzP1[1] = te; czzP1[1] = tf;

for i in range(1,neq_lbm+1):
caM1 = Internal.getNodeFromName1(sol, 'Q'+str(i)+'_M1')
ca = Internal.getNodeFromName1(sol, 'Q'+str(i))

# sauvegarde M1
ta = caM1[1]
# M1 <- current
caM1[1] = ca[1]
# current <- P1
ca[1] = ta
# sauvegarde M1
ta = cxx[1]; tb = cxy[1]; tc = cxz[1]; td = cyy[1]; te = cyz[1]; tf = czz[1]
# M1 <- current
cxx[1] = cxxP1[1]; cxy[1] = cxyP1[1]; cxz[1] = cxzP1[1]; cyy[1] = cyyP1[1]; cyz[1] = cyzP1[1]; czz[1] = czzP1[1];
# current <- P1
cxxP1[1] = ta; cxyP1[1] = tb; cxzP1[1] = tc; cyyP1[1] = td; cyzP1[1] = te; czzP1[1] = tf;

for i in range(1,neq_lbm+1):
caM1 = Internal.getNodeFromName1(sol, 'Q'+str(i)+'_M1')
ca = Internal.getNodeFromName1(sol, 'Q'+str(i))

# sauvegarde M1
ta = caM1[1]
# M1 <- current
caM1[1] = ca[1]
# current <- P1
ca[1] = ta

#==============================================================================
# Construit les donnees compactees pour traiter les BC
Expand Down

0 comments on commit 161aefd

Please sign in to comment.