def measure(): global qsMean global vxPartPY global phiPartPY global zAxis #Evaluate the average depth profile of streamwise, spanwise and wall-normal particle velocity, particle volume fraction (and drag force for coupling with RANS fluid resolution), and store it in hydroEngine variables vxPart, vyPart, vzPart, phiPart, averageDrag hydroEngine.averageProfile() #Extract the calculated vector. They can be saved and plotted afterwards. vxPartPY = np.array(hydroEngine.vxPart) vyPartPY = np.array(hydroEngine.vyPart) vzPartPY = np.array(hydroEngine.vzPart) phiPartPY = np.array(hydroEngine.phiPart) averageDragPY = np.array(hydroEngine.averageDrag) #Evaluate the dimensionless sediment transport rate for information qsMean = sum(phiPartPY*vxPartPY)*dz/sqrt((densPart/densFluidPY - 1)*abs(gravityVector[2])*pow(diameterPart,3)) plot.addData(SedimentRate = qsMean, time = O.time) #Plot it during the simulation #Condition to stop the simulation after endTime seconds if O.time>=endTime: print('\n End of the simulation, simulated {0}s as required !\n '.format(endTime)) O.pause() #Z scale used for the possible plot at the end global zAxis for i in range(0,ndimz): zAxis[i] = i*dz/diameterPart
def dataCollector(): R = O.bodies[refPoint] plot.addData(v=R.state.vel[1], p=R.state.pos[1] - p0, iterations=O.iter, t=O.realtime) plot.saveDataTxt(output)
def measure(): global qsMean global vxPartPY global phiPartPY global zAxis #Evaluate the average depth profile of streamwise, spanwise and wall-normal particle velocity, particle volume fraction (and drag force for coupling with RANS fluid resolution), and store it in hydroEngine variables vxPart, vyPart, vzPart, phiPart, averageDrag hydroEngine.averageProfile() #Extract the calculated vector. They can be saved and plotted afterwards. vxPartPY = np.array(hydroEngine.vxPart) vyPartPY = np.array(hydroEngine.vyPart) vzPartPY = np.array(hydroEngine.vzPart) phiPartPY = np.array(hydroEngine.phiPart) averageDragPY = np.array(hydroEngine.averageDrag) #Evaluate the dimensionless sediment transport rate for information qsMean = sum(phiPartPY * vxPartPY) * dz / sqrt( (densPart / densFluidPY - 1) * abs(gravityVector[2]) * pow(diameterPart, 3)) plot.addData(SedimentRate=qsMean, time=O.time) #Plot it during the simulation #Condition to stop the simulation after endTime seconds if O.time >= endTime: print('\n End of the simulation, simulated {0}s as required !\n '. format(endTime)) O.pause() #Z scale used for the possible plot at the end global zAxis for i in range(0, ndimz): zAxis[i] = i * dz / diameterPart
def defData(): i=O.interactions[1,0] vecFn=i.phys.normalForce vecDist=upperSphere.state.pos-lowerSphere.state.pos plot.addData(normFn=vecFn.norm(),normFnBis=vecFn.norm(),fnY=vecFn[1],step=O.iter, unPerso=lowerSphere.shape.radius+upperSphere.shape.radius-vecDist.norm(),unTrue=i.geom.penetrationDepth, gamma=upperSphere.state.pos[0]-lowerSphere.state.pos[0],fx=O.forces.f(0)[0],torque=O.forces.t(1)[2])
def addData(): stress=sum(normalShearStressTensors(),Matrix3.Zero) sigzz=stress[2,2] q1T=0.0 q1N=0 q2T=0.0 q2N=0 q3T=0.0 q3N=0 q4T=0.0 q4N=0 for i in O.bodies: if i.isClumpMember==True and i.state.pos[2]<0.25*O.cell.size[2]: q1T+=i.state.temp q1N+=1 elif i.isClumpMember==True and i.state.pos[2]<0.5*O.cell.size[2]: q2T+=i.state.temp q2N+=1 elif i.isClumpMember==True and i.state.pos[2]<0.75*O.cell.size[2]: q3T+=i.state.temp q3N+=1 elif i.isClumpMember==True: q4T+=i.state.temp q4N+=1 plot.addData(szz=sigzz,heat=totHeat,T1=q1T/q1N,T2=q2T/q2N,T3=q3T/q3N,T4=q4T/q4N,t=O.time)
def addPlotData(): plot.addData(unbalanced=utils.unbalancedForce(),i=O.iter, sxx=triax.stress[0],syy=triax.stress[1],szz=triax.stress[2], exx=triax.strain[0],eyy=triax.strain[1],ezz=triax.strain[2], # save all available energy data Etot=O.energy.total(),**O.energy )
def measure(): global qsMean,vxPartPY,phiPartPY #Evaluate the average depth profile of streamwise, spanwise and wall-normal particle velocity, particle volume fraction (and drag force for coupling with RANS fluid resolution), and store it in hydroEngine variables vxPart, phiPart, vyPart, vzPart, averageDrag. hydroEngine.averageProfile() #Extract the calculated vector. They can be saved and plotted afterwards. vxPartPY = np.array(hydroEngine.vxPart) phiPartPY = np.array(hydroEngine.phiPart) #Evaluate the dimensionless sediment transport rate for information qsMean = sum(phiPartPY*vxPartPY)*dz/sqrt((densPart/densFluidPY - 1)*abs(gravityVector[2])*pow(diameterPart,3)) plot.addData(SedimentRate = qsMean, time = O.time) #Plot it during the simulation #Condition to stop the simulation after endTime seconds if O.time>=endTime: print('\n End of the simulation, simulated {0}s as required !\n '.format(endTime)) O.pause() #Evaluate the Shields number from the maximum of the Reynolds stresses evaluated in the fluid resolution shieldsNumber = max(hydroEngine.ReynoldStresses)/((densPart-densFluidPY)*diameterPart*abs(gravityVector[2])) print('Shields number', shieldsNumber) if saveData==1: #Save data for postprocessing global fileNumber nameFile = scriptPath + '/sim'+ str(nbSim) + '/data/'+ str(fileNumber)+'.py' # Name of the file that will be saved globalParam = ['qsMean','phiPartPY','vxPartPY','vxFluidPY','zAxis'] # Variables to save Save(nameFile, globalParam) #Save fileNumber+=1 #Increment the file number #Activate the fluid wall friction only at equilibrium. Not necessary for the transient. if O.time>10: hydroEngine.fluidWallFriction = True
def measure(): global qsMean,vxPartPY,phiPartPY #Evaluate the average depth profile of streamwise, spanwise and wall-normal particle velocity, particle volume fraction (and drag force for coupling with RANS fluid resolution), and store it in hydroEngine variables vxPart, vyPart, vzPart, phiPart, averageDrag hydroEngine.averageProfile() #Extract the calculated vector. They can be saved and plotted afterwards. vxPartPY = np.array(hydroEngine.vxPart) vyPartPY = np.array(hydroEngine.vyPart) vzPartPY = np.array(hydroEngine.vzPart) phiPartPY = np.array(hydroEngine.phiPart) averageDragPY = np.array(hydroEngine.averageDrag) #Evaluate the dimensionless sediment transport rate for information qsMean = sum(phiPartPY*vxPartPY)*dz/sqrt((densPart/densFluidPY - 1)*abs(gravityVector[2])*pow(diameterPart,3)) plot.addData(SedimentRate = qsMean, time = O.time) #Plot it during the simulation #Condition to stop the simulation after endTime seconds if O.time>=endTime: print('\n End of the simulation, simulated {0}s as required !\n '.format(endTime)) O.pause() #Z scale used for the possible plot at the end global zAxis for i in range(0,ndimz): zAxis[i] = i*dz/diameterPart if saveData==1: #Save data for postprocessing global fileNumber nameFile = scriptPath + '/data/'+ str(fileNumber)+'.py' # Name of the file that will be saved globalParam = ['qsMean','phiPartPY','vxPartPY','vxFluidPY','zAxis'] # Variables to save Save(nameFile, globalParam) #Save fileNumber+=1 #Increment the file number
def addPlotData(): fMove = Vector3(0,0,0) for i in idTop: fMove += O.forces.f(i) plot.addData(z=O.iter, pMove=fMove[2], pFest=fMove[2])
def history(): plot.addData( t=O.time, i=O.iter, temp1=axisBodies[0].state.temp, temp2=axisBodies[1].state.temp, temp3=axisBodies[2].state.temp, temp4=axisBodies[3].state.temp, temp5=axisBodies[4].state.temp, temp6=axisBodies[5].state.temp, temp7=axisBodies[6].state.temp, temp8=axisBodies[7].state.temp, temp9=axisBodies[8].state.temp, temp10=axisBodies[9].state.temp, temp11=axisBodies[10].state.temp, AnalyTemp1=analyticalHeatSolution(0, O.time, t0, mx[0], thermalDiff), AnalyTemp2=analyticalHeatSolution(axisBodies[1].state.pos[0], O.time, t0, mx[0], thermalDiff), AnalyTemp3=analyticalHeatSolution( axisBodies[2].state.pos[0] - min(axisTrue), O.time, t0, max(axisTrue) - min(axisTrue), thermalDiff), AnalyTemp4=analyticalHeatSolution( axisBodies[3].state.pos[0] - min(axisTrue), O.time, t0, max(axisTrue) - min(axisTrue), thermalDiff), #bndFlux1 = thermal.thermalBndFlux[0], #bndFlux2 = thermal.thermalBndFlux[1] AnalyTemp5=analyticalHeatSolution(mx[0], O.time, t0, mx[0], thermalDiff)) plot.saveDataTxt( 'txt' + timeStr + identifier + '/conductionAnalyticalComparison.txt', vars=('t', 'i', 'temp1', 'temp2', 'temp3', 'temp4', 'temp5', 'temp6', 'temp7', 'temp8', 'temp9', 'temp10', 'temp11'))
def sim(angle): O.reset() O.dt = 1e-5 # create two bricks with all blockedDOFs mortar = O.materials.append(MortarMat(young=young,poisson=GOverE,tensileStrength=tensileStrength,cohesion=cohesion,frictionAngle=frictionAngle,compressiveStrength=compressiveStrength,ellAspect=ellAspect)) bs = b1,b2 = [polyhedron(((-1,-1,-1),(+1,-1,-1),(-1,+1,-1),(+1,+1,-1),(-1,-1,+1),(+1,-1,+1),(-1,+1,+1),(+1,+1,+1)),material=mortar) for i in (0,1)] b2.state.pos = (0,0,2) for b in bs: b.state.blockedDOFs = 'xyzXYZ' O.bodies.append(bs) # # factor to safely create interaction of just touching bricks factor=1.1 O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]), InteractionLoop( [Ig2_Polyhedra_Polyhedra_ScGeom(interactionDetectionFactor=factor,label='ig2')], [Ip2_MortarMat_MortarMat_MortarPhys()], [Law2_ScGeom_MortarPhys_Lourenco()] ), NewtonIntegrator(), ] O.step() ig2.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1 # reset the interaction detection enlargement b2.state.vel = (sin(angle),0,cos(angle)) # sets velocity to produce desired while len([i for i in O.interactions]) > 0: # run simulatinon until the interaction is broken sn,st = i.phys.sigmaN, i.phys.sigmaT.norm() # store last values O.step() if O.iter > 1e6: raise RuntimeError, "TODO" # not to run forever plot.addData(sn=sn,st=st) # after the interaction is broken, save stress to plot.data and return return
def myAddPlotData(): symId=0 numId=1 O.bodies[symId].state.update() psiDiff=((O.bodies[symId].state)-(O.bodies[numId].state)) psiDiff.zeroRange([dampMarginBandMin,dampMarginBandMin],[size1d-dampMarginBandMax,size1d-dampMarginBandMax],True,False) plot.addData(t=O.time,error=(psiDiff|psiDiff).real)
def addPlotData(): fMove = Vector3(0, 0, 0) for i in idTop: fMove += O.forces.f(i) plot.addData(z=O.iter, pMove=fMove[2], pFest=fMove[2])
def addPlotData(): Fn = 0. Fnn = 0. if(axis==1): for i in posIds: Fn += O.forces.f(i)[axis] Fn=abs(Fn) sigma=Fn/(1000*L) un = (O.bodies[posIds[0]].state.pos[axis] - O.bodies[posIds[0]].state.refPos[axis]) eps=un/L else: for i in rightNodes: Fn += O.forces.f(i)[axis] Fn=abs(Fn) sigma=Fn/(1000*L) un = (O.bodies[rightNodes[0]].state.pos[axis] - O.bodies[rightNodes[0]].state.refPos[axis]) eps=un/L if un*1000 > 300: O.pause() #print eps plot.addData( eps=eps*1000, un=un*1000, Fn=Fn,sigma=sigma )
def addPlotData(): # this function adds current values to the history of data, under the names specified plot.addData(Time=O.time, Torque1=utils.sumTorques, CoordinationNumber=utils.avgNumInteractions(), Unbalancedforce=utils.unbalancedForce(), **O.energy)
def addPlotData(): if debug: print('addPlotData') s = -getStress() p = s.trace()/3.0 s_dev = s - Matrix3.Identity*p DdotS_DEV = sum([s_dev[i,j]**2. for i in range(3) for j in range(3)]) q = sqrt(3./2.*DdotS_DEV) e_x, e_y, e_z = -triax.strain e_v = e_x+e_y+e_z n = porosity() e = n/(1.-n) # return anisotropy # n : normal interaction # t : tangential interaction f0, a_c, a_n, a_t, K, A = getFabricVariables(s_dev) print("Triax goal is: ",triax.goal, "dt=" ,O.dt ,"numIter=",O.iter,"real time=", O.realtime ) plot.addData(e=e, e_v=e_v, e_x=e_x, e_y=e_y, e_z=e_z, p=p, q=q,\ f0=f0, a_c=a_c, a_n=a_n, a_t=a_t, K=K, A=A, dt=O.dt, numIter=O.iter) # continue loading if loadData is not empty if len(loadData) !=0: startLoading() else: # save simulation data and parameters params = {} for name in table.__all__: params[name] = eval('table.'+name) np.save(yadeDataDir+'/SimData_'+table.mode+'_%i'%(table.key)+'.npy',tuple([params,plot.data])) print('triaxial shearing finished after %.3f hours'%((O.realtime-t0)/3600)) O.pause(); exit()
def UpPlot(): global m_stopOnStrain [ normalContactStress, shearContactStress, normalLubrifStress, shearLubrifStress, potentialStress ] = Law2_ScGeom_ImplicitLubricationPhys.getTotalStresses() kineticStress = getTotalDynamicStress() totalStress = normalContactStress + shearContactStress + normalLubrifStress + shearLubrifStress + potentialStress + kineticStress phi = 1. - porosity() if abs(O.cell.hSize[0, 1] / O.cell.hSize[0, 0]) > 1: flipCell() plot.addData(totalStress=totalStress, totalStress2=getStress(), kineticStress=kineticStress, normalContactStress=normalContactStress, shearContactStress=shearContactStress, normalLubrifStress=normalLubrifStress, shearLubrifStress=shearLubrifStress, potentialStress=potentialStress, phi=phi, iter=O.iter, strain=O.cell.trsf, time=O.time, time2=O.time, time3=O.time, velGrad=O.cell.velGrad) if (m_stopOnStrain > 0) & (O.cell.trsf[0, 1] > m_stopOnStrain): SaveAndQuit()
def addPlotData(): global loadData if debug: print('addPlotData') s = triax.stress s33_over_s11 = 2. * s[2] / (s[0] + s[1]) e_x, e_y, e_z = -triax.strain e_v = e_x + e_y + e_z n = porosity() print("Triax goal is: ", triax.goal, "dt=", O.dt, "numIter=", O.iter, "real time=", O.realtime) #e = n/(1.-n) #dt=O.dt, numIter=O.iter, realTime = O.realtime plot.addData(e_v=100. * e_v, e_x=100. * e_x, e_y=100. * e_y, e_z=100. * e_z, s33_over_s11=s33_over_s11, dt=O.dt, numIter=O.iter, realTime=O.realtime) #plot.addData( e_r=100.*(e_x+e_y)/2., e_a=100.*e_z, e_v=100.*e_v, e=e, s33_over_s11=s33_over_s11) if len(loadData) != 0: startLoading() else: if isBatch: dataName = 'triax_' + O.tags['description'] + '.npy' else: dataName = 'triaxSynthetic' + str(num) + '.npy' #dataName = 'triax_%i_%.10e_%.10e' % (table.key, table.E, table.v) + '.npy' np.save(dataName, plot.data) #plot.saveDataTxt(dataName) #dataName = 'triax_%i_%.10e_%.10e' % (table.key, table.E, table.v) + '.txt' print('triaxial shearing finished after %.3f hours' % ((O.realtime - t0) / 3600)) O.pause()
def addPlotData(): #print "%.2f\t%.5f\t%.5f\t%.5f\t%.5f" % (O.time+O.dt, O.bodies[id2].state.pos[2], O.bodies[id2].rho, O.bodies[id2].press, O.forces.f(id2)[2]) s1 = (O.bodies[id12].state.pos[2] - O.bodies[id11].state.pos[2]) - (Rad * 2.0) s2 = (O.bodies[id22].state.pos[2] - O.bodies[id21].state.pos[2]) - (Rad * 2.0) s3 = (O.bodies[id32].state.pos[2] - O.bodies[id31].state.pos[2]) - (Rad * 2.0) s4 = (O.bodies[id42].state.pos[2] - O.bodies[id41].state.pos[2]) - (Rad * 2.0) s5 = (O.bodies[id52].state.pos[2] - O.bodies[id51].state.pos[2]) - (Rad * 2.0) f1 = O.forces.f(id12)[2] f2 = O.forces.f(id22)[2] f3 = O.forces.f(id32)[2] f4 = O.forces.f(id42)[2] f5 = O.forces.f(id52)[2] plot.addData(sc=O.iter, s1=s1, s2=s2, s3=s3, s4=s4, s5=s5, fc=O.iter, f1=f1, f2=f2, f3=f3, f4=f4, f5=f5)
def myAddPlotData(): global westBodyId global midBodyId global eastBodyId global originalPositionW global originalPositionM global originalPositionE global boundaryFriction KE = utils.kineticEnergy() uf = utils.unbalancedForce() displacementWx = O.bodies[westBodyId].state.pos[0] - originalPositionW[0] displacementW = (O.bodies[westBodyId].state.pos - originalPositionW).norm() displacementMx = O.bodies[midBodyId].state.pos[0] - originalPositionM[0] displacementM = (O.bodies[midBodyId].state.pos - originalPositionM).norm() displacementEx = O.bodies[eastBodyId].state.pos[0] - originalPositionE[0] displacementE = (O.bodies[eastBodyId].state.pos - originalPositionE).norm() plot.addData(timeStep=O.iter, timeStep1=O.iter, timeStep2=O.iter, timeStep3=O.iter, timeStep4=O.iter, timeStep5=O.iter, kineticEn=KE, unbalancedForce=uf, waterLevel=waterHeight, boundary_phi=boundaryFriction, displacement=displacementW, displacementWest=displacementW, dispWx=displacementWx, displacementMid=displacementM, dispMx=displacementMx, displacementEast=displacementE, dispEx=displacementEx)
def dataCollector(): zmax=hMax(2) zmin=hMin(2) V = S0*(zmax-zmin) #poro=porosity(V) #F=O.forces.f(O.bodies[pfIds[45]].shape.node1.id) #print F S=pi*l**2 Fnt=O.forces.f(topPlate)[2] sigmaN=Fnt/S0 Fnb=abs(O.forces.f(bottomPlate)[2]) sigmaNb=Fnb/S0 pos=O.bodies[topPlate].state.pos[2] q=(sigmaNb-sigma) cui=(sigmaNb-sigma)/(sigmaNb+sigma) p=(sigmaNb+2*sigma)/2 displ=O.bodies[topPlate].state.pos[2]-O.bodies[bottomPlate].state.pos[2] epsr=epsr0-(O.bodies[m0].state.pos[0]-O.bodies[mm].state.pos[0]) epsa=epsa0-(O.bodies[topPlate].state.pos[2]-O.bodies[bottomPlate].state.pos[2]) epsv=epsa+2*epsr if((displ0-displ)>0.008) and (load==True): O.pause() #print 'Real time = ', O.realtime print 'end of loading, O.realtime (min) = ', O.realtime/60. O.bodies[bottomPlate].state.vel=(0,0,0) O.bodies[topPlate].state.vel=(0,0,0) saveData() #O.exitNoBacktrace() plot.addData(t=O.time,t2=O.time,displ=displ,d=(displ0-displ)/displ0,pos=pos,Fnt=Fnt,Fnb=Fnb,sigmaN=sigmaN,v=O.bodies[topPlate].state.vel[2],cui=cui,sigmaNb=sigmaNb,unbF=unbalancedForce(),p=p,q=q,p0=p0,sigma0=sigma0,epsv=epsv)
def defData(): plot.addData(fy=O.forces.f(3)[1], # vertical component of the force sustained by the upper side of the shear box fx=O.forces.f(3)[0], # horizontal component of the force sustained by the upper side of the shear box step=O.iter, gamma=O.bodies[3].state.pos[0] - length/2.0, u=O.bodies[3].state.pos[1] - (height+thickness/2.0) )
def ploteo(): a1=0 a2=0 a3=0 a4=0 a5=0 a6=0 b=0 for i in range(5, n1+5): b=O.forces.f(i) a1=a1+math.sqrt(numpy.dot(b, b)) for i in range(n1+5, n1+n2+5): b=O.forces.f(i) a2=a2+math.sqrt(numpy.dot(b, b)) for i in range(n1+n2+5, n1+n2+n3+5): b=O.forces.f(i) a3=a3+math.sqrt(numpy.dot(b, b)) for i in range(n1+n2+n3+5, n1+n2+n3+n4+5): b=O.forces.f(i) a4=a4+math.sqrt(numpy.dot(b, b)) for i in range(n1+n2+n3+n4+5, n1+n2+n3+n4+n5+5): b=O.forces.f(i) a5=a5+math.sqrt(numpy.dot(b, b)) for i in range(n1+n2+n3+n4+5, n1+n2+n3+n4+n5+5): b=O.forces.f(i) a5=a5+math.sqrt(numpy.dot(b, b)) for i in range(n1+n2+n3+n4+n5+5, n1+n2+n3+n4+n5+n6+5): b=O.forces.f(i) a6=a6+math.sqrt(numpy.dot(b, b)) fino=a2/n2+a4/n4+a6/n6 gross=a1/n1+a3/n3+a5/n5 G=fino/(fino+gross) time1=O.iter plot.addData(Gt=G,i=O.iter, i1=log10(time1))
def plotAddData(): i = O.interactions[0,1] if i.phys: plot.addData( fn = i.phys.normalForce.norm(), dspl = O.bodies[1].state.displ().norm(), )
def dataCollector(): R = O.bodies[refPoint] plot.addData(v=R.state.vel[2], z=R.state.pos[2], x=R.state.pos[0], iterations=O.iter, t=O.realtime)
def myAddPlotData(): s = O.bodies[1] plot.addData({ 't': O.time, 'y_sph': s.state.pos[1], 'z_sph': s.state.pos[2] })
def measure(): global qsMean, vxPartPY, phiPartPY #Evaluate the average depth profile of streamwise, spanwise and wall-normal particle velocity, particle volume fraction (and drag force for coupling with RANS fluid resolution), and store it in hydroEngine variables vxPart, phiPart, vyPart, vzPart, averageDrag. hydroEngine.averageProfile() #Extract the calculated vector. They can be saved and plotted afterwards. vxPartPY = np.array(hydroEngine.vxPart) phiPartPY = np.array(hydroEngine.phiPart) #Evaluate the dimensionless sediment transport rate for information qsMean = sum(phiPartPY * vxPartPY) * dz / sqrt( (densPart / densFluidPY - 1) * abs(gravityVector[2]) * pow(diameterPart, 3)) plot.addData(SedimentRate=qsMean, time=O.time) #Plot it during the simulation print(qsMean) #Condition to stop the simulation after endTime seconds if O.time >= endTime: print( '\n End of the simulation, simulated {0}s as required !\n '.format( endTime)) O.pause() if saveData == 1: #Save data for postprocessing global fileNumber nameFile = scriptPath + '/data/' + str( fileNumber) + '.py' # Name of the file that will be saved globalParam = [ 'qsMean', 'phiPartPY', 'vxPartPY', 'vxFluidPY', 'zAxis' ] # Variables to save Save(nameFile, globalParam) #Save fileNumber += 1 #Increment the file number
def ploteo(): a1=0. a2=0. a3=0. d1=0. d2=0. cant1=0 cant2=0 cant3=0 actual=O.iter inicial=graf.firstIterRun velMaxFino=0. velMaxGros=0. velMeanFino=0. velMeanGros=0. time=O.engines[4].timeStepUpdateInterval*O.engines[4].previousDt for i in range(6, n1+6): b=O.forces.f(i) rii=O.bodies[i].shape.radius vel=O.bodies[i].state.vel velScalar=math.sqrt(numpy.dot(vel, vel)) if 2*rii<D15: a2=a2+math.sqrt(numpy.dot(b, b)) velFino[cant2]=velScalar d2=d2+velScalar cant2=cant2+1 if 2*rii>D85: a1=a1+math.sqrt(numpy.dot(b, b)) velGros[cant1]=velScalar d1=d1+velScalar cant1=cant1+1 else: a3=a3+math.sqrt(numpy.dot(b, b)) # despRest[cant3]=deltaScalar cant3=cant3+1 if actual<=inicial: __builtin__.time1=time else: __builtin__.time1=time+__builtin__.time2 velMaxFino=numpy.amax(velFino) velMeanFino=d2/cant2 velMaxGros=numpy.amax(velGros) velMeanGros=d1/cant1 gross=a1*1. fino=a2*1. resto=a3*1. Gfp=fino/(cant2*1.)/(fino/(cant2*1.)+gross/(cant1*1.)+resto/(cant3*1.)) __builtin__.G=Gfp e=flow.porosity/(1-flow.porosity) Sf=0.15 nf=e/Sf sigma=O.forces.f(5)[2]/(D*D) dz=O.bodies[5].bound.refPos[2] __builtin__.icr=G/(rhoh*dz*g)*(sigma*tan(radians(angfric)))*1.+nf*rhos/rhoh it=flow.bndCondValue[4]/(O.bodies[5].bound.refPos[2]*g*rhoh) print "velFino",velMeanFino," Cant2",cant2 plot.addData(Vmf=velMeanFino, VMaxf=velMaxFino,Vmg=velMeanGros, VMaxg=velMaxGros, i=__builtin__.time1, i1=__builtin__.time1 , i2=O.iter, ic=__builtin__.icr, ii=it) cant1=0 cant2=0 cant3=0
def addPlotData(): plot.addData(i1=O.iter, t=O.time, Fupper=F33, Fbottom=F22, Q=QinOk, T=total2)
def history(): plot.addData(e11=-triax.strain[0], e22=-triax.strain[1], e33=-triax.strain[2], ev=-triax.strain[0]-triax.strain[1]-triax.strain[2], s11=-triax.stress(triax.wall_right_id)[0], s22=-triax.stress(triax.wall_top_id)[1], s33=-triax.stress(triax.wall_front_id)[2], i=O.iter)
def addPlotData(): f1 = [0, 0, 0] f2 = [0, 0, 0] f3 = [0, 0, 0] f4 = [0, 0, 0] try: f1 = O.forces.f(id12) f2 = O.forces.f(id22) f3 = O.forces.f(id32) f4 = O.forces.f(id42) except: f1 = [0, 0, 0] f2 = [0, 0, 0] f3 = [0, 0, 0] f4 = [0, 0, 0] s1 = (O.bodies[id12].state.pos[2] - O.bodies[id11].state.pos[2]) - (r1 + r2) s2 = (O.bodies[id22].state.pos[2] - O.bodies[id21].state.pos[2]) - (r1 + r2) s3 = (O.bodies[id32].state.pos[2] - O.bodies[id31].state.pos[2]) - (r1 + r2) s4 = (O.bodies[id42].state.pos[2] - O.bodies[id41].state.pos[2]) - (r1 + r2) plot.addData(fc1=f1[2], sc1=-s1, fc2=f2[2], sc2=-s2, fc3=f3[2], sc3=-s3, fc4=f4[2], sc4=-s4)
def plotAddData(): plot.addData( iter=O.iter,iter_=O.iter, sx=p3d.stress[0],sy=p3d.stress[1],sz=p3d.stress[2], syz=p3d.stress[3],szx=p3d.stress[4],sxy=p3d.stress[5], ex=p3d.strain[0],ey=p3d.strain[1],ez=p3d.strain[2], eyz=p3d.strain[3],ezx=p3d.strain[4],exy=p3d.strain[5], )
def history(): xyz=[] for k in [0,1,2]: ksum=0 for i in nodesIds: ksum+=O.bodies[i].state.pos[k] xyz.append(ksum/len(nodesIds)) # take average value as reference plot.addData(i=O.iter,t=O.time,x=xyz[0],y=xyz[1],z=xyz[2])
def history(): plot.addData( ftemp1=flow.getPoreTemperature((0.025, 0.025, 0.025)), p=flow.getPorePressure((0.025, 0.025, 0.025)), t=O.time, i=O.iter, bodyOfIntTemp=O.bodies[bodyOfInterest.id].state.temp, )
def history(): plot.addData(e11=O.engines[4].strain[0], e22=O.engines[4].strain[1], e33=O.engines[4].strain[2], s11=-O.engines[4].stress(0)[0], s22=-O.engines[4].stress(2)[1], s33=-O.engines[4].stress(4)[2], i=O.iter)
def addPlotData(): plot.addData(i1=O.iter, t=O.time, Fupper=F33, Fbottom=F22, Q=QinOk, T=total2 )
def addPlotData(): try: i=O.interactions[FixedSphere.id,MovingSphere.id] plot.addData( Fn=i.phys.normalForce.norm(), un=(O.bodies[1].state.pos[1]-O.bodies[0].state.pos[1])-a ) #plot.saveGnuplot('net-2part-strain') except: print("No interaction!") O.pause()
def history(): xyz = [] for k in [0, 1, 2]: ksum = 0 for i in nodesIds: ksum += O.bodies[i].state.pos[k] xyz.append(ksum / len(nodesIds)) # take average value as reference plot.addData(i=O.iter, t=O.time, x=xyz[0], y=xyz[1], z=xyz[2])
def addPlotData(): plot.addData({ 't': O.time, 'i': O.iter, 'eps': strainer.strain, 'sigma': strainer.avgStress, }) plotSaveDataTxt()
def plotAddData(): plot.addData( progress=p3d.progress,progress_=p3d.progress, sx=p3d.stress[0],sy=p3d.stress[1],sz=p3d.stress[2], syz=p3d.stress[3],szx=p3d.stress[4],sxy=p3d.stress[5], ex=p3d.strain[0],ey=p3d.strain[1],ez=p3d.strain[2], eyz=p3d.strain[3],ezx=p3d.strain[4],exy=p3d.strain[5], )
def myAddPlotData(): i = O.interactions[0, 1] plot.addData(Fn=i.phys.normalForce[0], Fs=i.phys.shearForce[1], un=i.geom.penetrationDepth, time=O.time, time_=O.time, t=O.time)
def history(): plot.addData(e11=triax.strain[0], e22=triax.strain[1], e33=triax.strain[2], s11=-triax.stress(0)[0], s22=-triax.stress(2)[1], s33=-triax.stress(4)[2], i=O.iter)
def history(): plot.addData( e22=-triax.strain[1] - zeroe22, e22_theory=drye22 + (1 - dryFraction) * consolidation( (O.time - zeroTime) * Cv / wetHeight**2) * 1000. / modulus, t=O.time, p=flow.getPorePressure((0.5, 0.1, 0.5)), s22=-triax.stress(3)[1] - 10000)
def addPlotData(): try: i=O.interactions[FixedSphere.id,MovingSphere.id] plot.addData( Fn=i.phys.normalForce.norm(), un=(O.bodies[1].state.pos[1]-O.bodies[0].state.pos[1])-a ) #plot.saveGnuplot('net-2part-strain') except: print "No interaction!" O.pause()
def myAddPlotData(): sph = O.bodies[1] ## store some numbers under some labels plot.addData(t=O.time, i=O.iter, z_sph=sph.state.pos[2], z_sph_half=.5 * sph.state.pos[2], v_sph=sph.state.vel.norm())
def addData(): # get the stress tensor (as 3x3 matrix) stress=sum(normalShearStressTensors(),Matrix3.Zero) # give names to values we are interested in and save them plot.addData(exz=O.cell.trsf[0,2],szz=stress[2,2],sxz=stress[0,2],tanPhi=stress[0,2]/stress[2,2],i=O.iter) # color particles based on rotation amount for b in O.bodies: # rot() gives rotation vector between reference and current position b.shape.color=scalarOnColorScale(b.state.rot().norm(),0,pi/2.)
def history(): plot.addData(e11=-triax.strain[0]-ei0, e22=-triax.strain[1]-ei1, e33=-triax.strain[2]-ei2, s11=-triax.stress(0)[0]-si0, s22=-triax.stress(2)[1]-si1, s33=-triax.stress(4)[2]-si2, pc=-unsat.bndCondValue[2], sw=unsat.getSaturation(False), i=O.iter )
def addPlotData(): try: delta = (O.bodies[id2].state.pos[2]-O.bodies[id1].state.pos[2])-(2*Rad) plot.addData(delta=delta, time1=O.time, time2=O.time, time3=O.time, time4=O.time, Fn = O.interactions[0,1].phys.Fn, Fv = O.interactions[0,1].phys.Fv, deltaDot = O.bodies[id2].state.vel[2] - O.bodies[id1].state.vel[2]) except: pass
def addPlotData(): i=O.interactions[0,1] plot.addData( un=tester.uTest[0],us1=tester.uTest[1],us2=tester.uTest[2], ung=tester.uGeom[0],us1g=tester.uGeom[1],us2g=tester.uGeom[2], phiX=tester.uTest[3],phiY=tester.uTest[4],phiZ=tester.uTest[5], phiXg=tester.uGeom[3],phiYg=tester.uGeom[4],phiZg=tester.uGeom[5], i=O.iter,Fs=i.phys.shearForce.norm(),Fn=i.phys.normalForce.norm(),Tx=O.forces.t(0)[0],Tyz=sqrt(O.forces.t(0)[1]**2+O.forces.t(0)[2]**2) )
def plotPos(): plot.addData( z1=O.bodies[2].state.pos[2] / fluidHeight, z2=O.bodies[3].state.pos[2] / fluidHeight, z3=O.bodies[4].state.pos[2] / fluidHeight, time=O.time, ) if O.time > endTime: print("\nEnd of the simulation, {0}s simulated as asked!\n".format(endTime)) O.pause()
def addPlotData(): # plot.addData(temp0=heat.bodyTemp[heat.heatBodies.index(0+6)], temp24=heat.bodyTemp[heat.heatBodies.index(24+6)], temp49=heat.bodyTemp[heat.heatBodies.index(49+6)], temp74=heat.bodyTemp[heat.heatBodies.index(74+6)], temp99=heat.bodyTemp[heat.heatBodies.index(99+6)], tempPlate4=heat.bodyTemp[heat.heatBodies.index(4)], #tempPlate5=heat.bodyTemp[heat.heatBodies.index(5)], t=O.iter)
def addPlotData(): if not isinstance(O.bodies[-1].shape, Wall): plot.addData() return Fz = O.forces.f(plate.id)[2] plot.addData( Fz=Fz, w=plate.state.pos[2] - (-4*Diameter), unbalanced=unbalancedForce(), i=O.iter )
def addPlotData(): T = [] e = O.bodies[4].state.displ().norm()/O.bodies[4].state.refPos.norm() for i in range(4): inter = O.interactions[i,i+1] if inter.isReal: T.append(inter.phys.normalForce.norm()/thick/width) else: O.pause() print 'membrane broke...' plot.addData(e = e, T1 = T[0], T2 = T[1], T3 = T[2], T4 = T[3])
def addPlotData(): # plot.addData(temp6=bodyHeat.bodyTemp[bodyHeat.heatBodies.index(0+6)], temp55=bodyHeat.bodyTemp[bodyHeat.heatBodies.index(49+6)], temp105=bodyHeat.bodyTemp[bodyHeat.heatBodies.index(99+6)], tempPlateBot=bodyHeat.bodyTemp[bodyHeat.heatBodies.index(4)], t=O.time, sat6=sorption.bodySat[sorption.sorpBodies.index(6)] ,sat55=sorption.bodySat[sorption.sorpBodies.index(55)] ,sat105=sorption.bodySat[sorption.sorpBodies.index(105)] )
def plotAddData(): f1 = sum(O.forces.f(b.id)[2] for b in top) f2 = sum(O.forces.f(b.id)[2] for b in bot) f = .5*(f2-f1) s = f/(pi*.25*width*width) if testType=='cyl' else f/(width*width) if testType=='cube' else None e = (top[0].state.displ()[2] - bot[0].state.displ()[2]) / (height-rParticle*2*bcCoeff) plot.addData( i = O.iter, s = s, e = e, )