Skip to content

Commit b8aebc8

Browse files
committed
update testcases
1 parent 7de32c9 commit b8aebc8

File tree

4 files changed

+39
-34
lines changed

4 files changed

+39
-34
lines changed

SU2_CFD/src/numerics/flow/flow_sources.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ CSourceUserDefined::CSourceUserDefined(unsigned short val_nDim, unsigned short v
847847
CNumerics::ResidualType<> CSourceUserDefined::ComputeResidual(const CConfig *config) {
848848

849849
unsigned short iDim;
850-
850+
cout << "CSourceUserDefined" << endl;
851851
/*--- Zero the continuity contribution. ---*/
852852

853853
residual[0] = 0.0;

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,13 +1833,13 @@ void CIncEulerSolver::Custom_Source_Residual(CGeometry *geometry, CSolver **solv
18331833

18341834
numerics->SetVolume(geometry->nodes->GetVolume(iPoint));
18351835

1836-
/*--- Get control volume size. ---*/
1837-
su2double Volume = geometry->nodes->GetVolume(iPoint);
1836+
/*--- Get control volume size. ---*/
1837+
su2double Volume = geometry->nodes->GetVolume(iPoint);
18381838

1839-
/*--- Compute the residual for this control volume and subtract. ---*/
1840-
for (iVar = 0; iVar < nVar; iVar++) {
1841-
LinSysRes[iPoint*nVar+iVar] += PointSource[iPoint][iVar] * Volume;
1842-
}
1839+
/*--- Compute the residual for this control volume and subtract. ---*/
1840+
for (iVar = 0; iVar < nVar; iVar++) {
1841+
LinSysRes[iPoint*nVar+iVar] += PointSource[iPoint][iVar] * Volume;
1842+
}
18431843
}
18441844
END_SU2_OMP_FOR
18451845

TestCases/py_wrapper/turbulent_premixed_psi/psi.cfg

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ SOLVER= INC_RANS
1515
KIND_TURB_MODEL= SST
1616
SST_OPTIONS= V1994m
1717

18+
RESTART_SOL= YES
19+
1820
MGLEVEL= 0
1921
%
2022

@@ -63,11 +65,12 @@ MARKER_SYM= ( symmetry )
6365
AXISYMMETRIC= YES
6466
%
6567
SPECIFIED_INLET_PROFILE= YES
68+
INLET_MATCHING_TOLERANCE=1e-4
6669
INLET_FILENAME= inlet.dat
6770
%INLET_INTERPOLATION_FUNCTION= LINEAR_1D
6871
INC_INLET_TYPE= VELOCITY_INLET
6972
INC_INLET_DAMPING= 0.01
70-
MARKER_INLET= ( inlet, 673, 40.0, 1.0, 0.0, 0.0)
73+
MARKER_INLET= ( inlet, 673, 40.0, 1.0, 0.0, 0.0)
7174
MARKER_INLET_TURBULENT = (inlet, 0.10, 15)
7275
MARKER_INLET_SPECIES= (inlet, 0.0)
7376
%
@@ -79,7 +82,7 @@ MARKER_OUTLET= ( outlet, 0.0 )
7982
%
8083
NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES
8184
%
82-
CFL_NUMBER= 20.0
85+
CFL_NUMBER= 1.0
8386
CFL_REDUCTION_SPECIES= 1.0
8487
CFL_REDUCTION_TURB= 1.0
8588
%
@@ -90,7 +93,7 @@ ITER= 1
9093
LINEAR_SOLVER= FGMRES
9194
LINEAR_SOLVER_PREC= ILU
9295
LINEAR_SOLVER_ERROR= 1E-8
93-
LINEAR_SOLVER_ITER= 5
96+
LINEAR_SOLVER_ITER= 10
9497

9598
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
9699
%
@@ -136,15 +139,14 @@ CONV_STARTITER= 10
136139
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
137140
%
138141
%MESH_FILENAME= psi_coarse.su2
139-
MESH_FILENAME= psi_medium.su2
142+
MESH_FILENAME= psi.su2
140143
%MESH_FILENAME= psi_fine.su2
141144
%
142145
SCREEN_OUTPUT= INNER_ITER WALL_TIME \
143-
RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_TKE RMS_DISSIPATION RMS_SPECIES_0 RMS_SPECIES_1 \
146+
RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_TKE RMS_DISSIPATION RMS_SPECIES_0 \
144147
LINSOL_ITER LINSOL_RESIDUAL \
145148
LINSOL_ITER_TURB LINSOL_RESIDUAL_TURB \
146-
LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES \
147-
SURFACE_SPECIES_0
149+
LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES
148150
SCREEN_WRT_FREQ_INNER= 1
149151
%
150152
HISTORY_OUTPUT= ITER RMS_RES LINSOL SPECIES_COEFF SPECIES_COEFF_SURF
@@ -156,7 +158,6 @@ OUTPUT_FILES= RESTART_ASCII, PARAVIEW_MULTIBLOCK
156158
VOLUME_OUTPUT= RESIDUAL, PRIMITIVE
157159
OUTPUT_WRT_FREQ= 100
158160
%
159-
RESTART_SOL= YES
160161
READ_BINARY_RESTART= NO
161162
RESTART_FILENAME= restart
162163
SOLUTION_FILENAME= solution

TestCases/py_wrapper/turbulent_premixed_psi/run.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import sys
2929
import pysu2
30+
from mpi4py import MPI
3031
import numpy as np
3132
#from mpi4py import MPI
3233

@@ -121,6 +122,7 @@ def zimont(SU2Driver, iPoint):
121122
# laminar burning velocity of methane-air at phi=0.5, P=5
122123
Slu = 0.232
123124

125+
124126
rho = primvar[iDENSITY]
125127
mu = primvar[iMU]
126128
nu=mu/rho
@@ -131,10 +133,10 @@ def zimont(SU2Driver, iPoint):
131133
lt = (0.09**0.75) * (tke**1.5) / dissipation
132134
Re = up*lt/nu
133135
Le = 1.0
134-
Ut = Slu * (1.0 + (0.46/Le)*np.power(Re,0.25)*np.power(up/Slu,0.3)*np.power(Pu,0.2))
135-
136+
Ut = Slu * (1.0 + (0.46/Le) * np.power(Re,0.25) * np.power(up/Slu,0.3) * np.power(Pu,0.2) )
136137
norm_gradc = np.sqrt(gradc[0]*gradc[0] + gradc[1]*gradc[1])
137-
138+
#if (norm_gradc > 1.):
139+
# print(tke," ",rho_u," Ut=",Ut," , |grad(c)| = ",norm_gradc, " ",gradc[0]," ",gradc[1])
138140
Sc = rho_u * Ut * norm_gradc
139141

140142
return Sc
@@ -152,11 +154,8 @@ def getsolvar(SU2Driver):
152154

153155

154156
def main():
155-
"""
156-
Run the flow solver with a custom inlet (function of time and space).
157-
"""
158-
# comm = MPI.COMM_WORLD
159-
comm = 0
157+
comm = MPI.COMM_WORLD
158+
rank = comm.Get_rank()
160159

161160
# Initialize the primal driver of SU2, this includes solver preprocessing.
162161
try:
@@ -165,8 +164,9 @@ def main():
165164
print('A TypeError occured in pysu2.CSinglezoneDriver : ', exception)
166165
raise
167166

168-
print("\n------------------------------ Begin Solver -----------------------------")
169-
sys.stdout.flush()
167+
if rank == 0:
168+
print("\n------------------------------ Begin Solver -----------------------------")
169+
sys.stdout.flush()
170170

171171
nDim = driver.GetNumberDimensions()
172172
print("Dimensions of the problem = ",nDim)
@@ -223,7 +223,8 @@ def main():
223223
#
224224

225225
#print("solver variable names:",varindex)
226-
#print("index of density = ",primindex.get("DENSITY"))
226+
iDENSITY = primindex.get("DENSITY")
227+
#print("index of density = ",iDENSITY)
227228

228229
index_Vel = varindex.get("VELOCITY_X")
229230
#print("index of velocity = ",index_Vel)
@@ -233,17 +234,20 @@ def main():
233234

234235
#print("max. number of inner iterations: ",driver.GetNumberInnerIter());
235236
#print("max nr of outer iterations: ",driver.GetNumberOuterIter());
236-
237-
# We can set an initial condition by calling this function:
238-
#print("Start calling SetInitialSpecies")
239-
#SetInitialSpecies(driver)
240-
#print("End calling SetInitialSpecies")
237+
with open('psi.cfg') as f:
238+
if 'RESTART_SOL= YES' in f.read():
239+
print("restarting from file")
240+
else:
241+
# We can set an initial condition by calling this function:
242+
print("Start calling SetInitialSpecies")
243+
SetInitialSpecies(driver)
244+
print("End calling SetInitialSpecies")
241245

242246
# super important to actually push the commands.
243247
sys.stdout.flush()
244248

245-
# run 5 iterations
246-
for inner_iter in range(5):
249+
# run N iterations
250+
for inner_iter in range(10000):
247251

248252
driver.Preprocess(inner_iter)
249253
driver.Run()
@@ -260,7 +264,7 @@ def main():
260264

261265
driver.Postprocess()
262266
driver.Update()
263-
driver.Monitor(inner_iter)
267+
#driver.Monitor(inner_iter)
264268
driver.Output(inner_iter)
265269

266270
# Finalize the solver and exit cleanly.

0 commit comments

Comments
 (0)