precision=1e-5
def initial_conditions_shock(my_mesh, isCircle):
- print "Initial data : Spherical wave"
+ print( "Initial data : Spherical wave" )
dim = my_mesh.getMeshDimension()
nbCells = my_mesh.getNumberOfCells()
implMat.addValue(j*nbComp,cellAutre*nbComp,Am)
implMat.addValue(j*nbComp, j*nbComp,Am*(-1.))
elif(Fk.getGroupName() != "Neumann"):#Nothing to do for Neumann boundary condition
- print Fk.getGroupName()
+ print( Fk.getGroupName() )
raise ValueError("computeFluxes: Unknown boundary condition name");
return implMat
elif(filename.find("disk")>-1 or filename.find("Disk")>-1):
pressure_field, velocity_field = initial_conditions_shock(my_mesh,True)
else:
- print "Mesh name : ", filename
+ print( "Mesh name : ", filename )
raise ValueError("Mesh name should contain substring square, cube or disk")
for k in range(nbCells):
cvgceLS=LS.getStatus();
iterGMRES=LS.getNumberOfIter();
if(not cvgceLS):
- print "Linear system did not converge ", iterGMRES, " GMRES iterations"
+ print( "Linear system did not converge ", iterGMRES, " GMRES iterations" )
raise ValueError("Pas de convergence du système linéaire");
dUn-=Un
#Sauvegardes
if(it%output_freq==0 or it>=ntmax or isStationary or time >=tmax):
- print"-- Iter: " + str(it) + ", Time: " + str(time) + ", dt: " + str(dt)
- print "Variation temporelle relative : pressure ", maxVector[0]/p0 ,", velocity x", maxVector[1]/rho0 ,", velocity y", maxVector[2]/rho0
- print "Linear system converged in ", iterGMRES, " GMRES iterations"
+ print( "-- Iter: " + str(it) + ", Time: " + str(time) + ", dt: " + str(dt) )
+ print( "Variation temporelle relative : pressure ", maxVector[0]/p0 ,", velocity x", maxVector[1]/rho0 ,", velocity y", maxVector[2]/rho0 )
+ print( "Linear system converged in ", iterGMRES, " GMRES iterations" )
for k in range(nbCells):
pressure_field[k]=Un[k*(dim+1)+0]
velocity_field.setTime(time,it);
velocity_field.writeVTK("WaveSystem"+str(dim)+"DPStag"+meshName+"_velocity",False);
- print"-- Iter: " + str(it) + ", Time: " + str(time) + ", dt: " + str(dt)
- print "Variation temporelle relative : pressure ", maxVector[0]/p0 ,", velocity x", maxVector[1]/rho0 ,", velocity y", maxVector[2]/rho0
- print
+ print( "-- Iter: " + str(it) + ", Time: " + str(time) + ", dt: " + str(dt) )
+ print( "Variation temporelle relative : pressure ", maxVector[0]/p0 ,", velocity x", maxVector[1]/rho0 ,", velocity y", maxVector[2]/rho0)
+ print()
if(it>=ntmax):
- print "Nombre de pas de temps maximum ntmax= ", ntmax, " atteint"
+ print( "Nombre de pas de temps maximum ntmax= ", ntmax, " atteint")
elif(isStationary):
- print "Régime stationnaire atteint au pas de temps ", it, ", t= ", time
- print "------------------------------------------------------------------------------------"
+ print( "Régime stationnaire atteint au pas de temps ", it, ", t= ", time)
+ print( "------------------------------------------------------------------------------------")
pressure_field.setTime(time,0);
pressure_field.writeVTK("WaveSystem"+str(dim)+"DPStag"+meshName+"_pressure_Stat");
PV_routines.Save_PV_data_to_picture_file("WaveSystem"+str(dim)+"DPStag"+meshName+"_velocity_Stat"+'_0.vtu',"Velocity",'CELLS',"WaveSystem"+str(dim)+"DPStag"+meshName+"_velocity_Stat")
else:
- print "Temps maximum Tmax= ", tmax, " atteint"
+ print( "Temps maximum Tmax= ", tmax, " atteint" )
def solve(my_mesh,meshName,resolution):
- print "Resolution of the Wave system in dimension ", my_mesh.getSpaceDimension()
- print "Numerical method : implicit pseudo staggered"
- print "Initial data : spherical wave"
- print "Wall boundary conditions"
- print "Mesh name : ",meshName , my_mesh.getNumberOfCells(), " cells"
+ print( "Resolution of the Wave system in dimension ", my_mesh.getSpaceDimension() )
+ print( "Numerical method : implicit pseudo staggered" )
+ print( "Initial data : spherical wave" )
+ print( "Wall boundary conditions" )
+ print( "Mesh name : ",meshName , my_mesh.getNumberOfCells(), " cells" )
# Problem data
tmax = 1000.