yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #26486
Re: [Question #698948]: Stability of advection modeling by ThermalEngine
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948
Zoheir Khademian posted a new comment:
Hi Robert,
>>This is quite odd: applyTempDeltaToSolids is deactivated by default: the
user needs to manually set thermal.delT>0 for that function to activate
I think the problem is delT is being used as a variable here as well
[1], so during fluid-fluid conduction calculations, delT becomes
positive and it activates applyTempDeltaToSolids automatically. I
deleted detT variable here [1] and directly used "cell->info().temp() -
neighborCell->info().temp()" for conductionEnergy calculation here[2].
Then recompiled and the results are stable.
Let me know if this does not makes sense to you.
[1] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L530
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L545
In any case, here is the list of particles (all the same size) and the MWE to run the model.
Thanks - Zoheir
#format x_y_z_r
0.0177741 0.0293044 0.0178294 0.0015
0.032225 0.0197924 0.0178472 0.0015
0.0322266 0.0291739 0.0178539 0.0015
0.0279236 0.032249 0.0261029 0.0015
0.0322118 0.0302264 0.0320853 0.0015
0.0272061 0.0316643 0.0320534 0.0015
0.029361 0.0178245 0.0290514 0.0015
0.0223492 0.0237293 0.0212975 0.0015
0.0322662 0.0177355 0.029063 0.0015
0.0249392 0.0297701 0.0178535 0.0015
0.0278041 0.0253036 0.0320824 0.0015
0.0209031 0.0239399 0.0259082 0.0015
0.029996 0.0247971 0.0227321 0.0015
0.0231086 0.0224061 0.0178694 0.0015
0.0237889 0.026771 0.0280437 0.0015
0.0271796 0.0296372 0.0298686 0.0015
0.0293275 0.0207069 0.0294883 0.0015
0.029728 0.0307252 0.0238577 0.0015
0.029455 0.0177438 0.03204 0.0015
0.0220291 0.0251347 0.0320876 0.0015
0.0228457 0.0177657 0.0205171 0.0015
0.0247976 0.020158 0.0187476 0.0015
0.0221528 0.017793 0.0297048 0.0015
0.0177809 0.0178246 0.0320527 0.0015
0.0178286 0.0204492 0.0192357 0.0015
0.0191019 0.0272907 0.0227524 0.0015
0.023182 0.0266745 0.0241058 0.0015
0.0228497 0.0296931 0.0320761 0.0015
0.0203349 0.0184782 0.0277075 0.0015
0.0178115 0.0232242 0.0181458 0.0015
0.0236951 0.0187262 0.0273578 0.0015
0.017815 0.0178142 0.0290756 0.0015
0.0268862 0.0177484 0.0275311 0.0015
0.0293104 0.0293306 0.0320274 0.0015
0.0178224 0.0228895 0.0229322 0.0015
0.0229362 0.0182461 0.0233847 0.0015
0.0234661 0.0204362 0.0296891 0.0015
0.0308867 0.0228868 0.0282905 0.0015
0.0322099 0.0250677 0.0296246 0.0015
0.032281 0.0178211 0.0320448 0.0015
0.0322146 0.0204259 0.0245334 0.0015
0.0322253 0.0322509 0.0239898 0.0015
0.0279165 0.0228391 0.0279433 0.0015
0.0234598 0.0322574 0.0219894 0.0015
0.0202221 0.0215691 0.017819 0.0015
0.0292976 0.025252 0.0289125 0.0015
0.0178179 0.0322929 0.0207288 0.0015
0.0219679 0.0204761 0.0198587 0.0015
0.0219003 0.0322297 0.0244164 0.0015
0.0188566 0.0202206 0.0221634 0.0015
0.0276402 0.0177882 0.0232129 0.0015
0.0178161 0.0322694 0.0269258 0.0015
0.0295711 0.0280749 0.0290676 0.0015
0.0265758 0.0178165 0.0320975 0.0015
0.0321235 0.0295753 0.0253156 0.0015
0.0203762 0.0177426 0.0220801 0.0015
0.0292814 0.0231458 0.0251311 0.0015
0.0299286 0.0268797 0.0186235 0.0015
0.0288255 0.0202145 0.0243078 0.0015
0.0178049 0.0276979 0.0202425 0.0015
0.0322722 0.0256006 0.0178161 0.0015
0.0223008 0.0202683 0.0253642 0.0015
0.0255165 0.0266773 0.0206327 0.0015
0.0199502 0.0216179 0.0289218 0.0015
0.030126 0.0177624 0.0178698 0.0015
0.0254739 0.0197561 0.0231361 0.0015
0.0322638 0.0228734 0.0228553 0.0015
0.0265408 0.022283 0.0178242 0.0015
0.0254871 0.0259749 0.0258332 0.0015
0.0322915 0.0227056 0.0178061 0.0015
0.0319731 0.0202977 0.0214805 0.0015
0.0235946 0.0323112 0.0178428 0.0015
0.0250886 0.0203689 0.0321208 0.0015
0.0311899 0.0205841 0.0320759 0.0015
0.0293867 0.0323455 0.0178564 0.0015
0.017819 0.0319405 0.0320753 0.0015
0.0230816 0.0291808 0.0260803 0.0015
0.0322467 0.0233608 0.0320651 0.0015
0.027053 0.0279131 0.0274663 0.0015
0.0191108 0.0322681 0.0295038 0.0015
0.0298198 0.0309172 0.0294285 0.0015
0.0265891 0.027943 0.0320729 0.0015
0.0177748 0.0178067 0.0235421 0.0015
0.0226982 0.0292137 0.0291665 0.0015
0.0292801 0.0177808 0.0258092 0.0015
0.025091 0.0177539 0.0296773 0.0015
0.0322576 0.0321652 0.0178683 0.0015
0.0303121 0.0204239 0.0267807 0.0015
0.0263177 0.0252864 0.0286105 0.0015
0.0220065 0.032246 0.0292096 0.0015
0.0204973 0.0258364 0.0205884 0.0015
0.0228527 0.0303463 0.0198524 0.0015
0.0266579 0.029408 0.0204424 0.0015
0.0199349 0.0270645 0.0318538 0.0015
0.0207689 0.0322449 0.020817 0.0015
0.0177812 0.0248037 0.0206708 0.0015
0.0273755 0.0289692 0.0232743 0.0015
0.0232237 0.0229252 0.0245358 0.0015
0.0265182 0.0322593 0.0177995 0.0015
0.0195693 0.0213444 0.0248116 0.0015
0.0243073 0.0322565 0.0320575 0.0015
0.0236199 0.0178027 0.0321506 0.0015
0.0211121 0.0268755 0.0261824 0.0015
0.0322276 0.0276056 0.0203509 0.0015
0.0322252 0.0177805 0.0199996 0.0015
0.0229195 0.0277541 0.0178142 0.0015
0.0206611 0.0177697 0.0321174 0.0015
0.0272737 0.0322313 0.0232492 0.0015
0.0267728 0.0226499 0.0314472 0.0015
0.0177887 0.0256031 0.0246928 0.0015
0.0273974 0.0323373 0.0289861 0.0015
0.0295738 0.0219256 0.0222416 0.0015
0.0213171 0.0322629 0.0320744 0.0015
0.0206219 0.02938 0.0180342 0.0015
0.0184764 0.0280415 0.0267233 0.0015
0.0201655 0.0183195 0.0249349 0.0015
0.0239698 0.0272352 0.030993 0.0015
0.0187189 0.0227822 0.0321331 0.0015
0.0207101 0.0182969 0.0182606 0.0015
0.0259197 0.0300618 0.025721 0.0015
0.0235804 0.0177613 0.0177803 0.0015
0.0248667 0.0246848 0.0320612 0.0015
0.0191357 0.0322515 0.0233922 0.0015
0.0231734 0.0294893 0.0230771 0.0015
0.0322124 0.0178675 0.026089 0.0015
0.0321633 0.027037 0.0273948 0.0015
0.0302813 0.0217504 0.0195146 0.0015
0.0177592 0.0289692 0.0320756 0.0015
0.0263988 0.0204391 0.0294554 0.0015
0.029371 0.0296149 0.0182665 0.0015
0.020224 0.0298721 0.0308167 0.0015
0.017831 0.0194442 0.0263944 0.0015
0.0265363 0.0177864 0.0178349 0.0015
0.0203174 0.0275839 0.0289467 0.0015
0.0319785 0.0246858 0.0205816 0.0015
0.0177702 0.0298453 0.0221658 0.0015
0.0178166 0.0223711 0.0269294 0.0015
0.0300936 0.0322618 0.0320543 0.0015
0.0322475 0.0205852 0.0293348 0.0015
0.0322126 0.0297129 0.0223999 0.0015
0.0177868 0.0265145 0.02991 0.0015
0.0296558 0.0240756 0.0178264 0.0015
0.0231045 0.0251686 0.0188838 0.0015
0.0253767 0.0238163 0.0199777 0.0015
0.0276649 0.0261025 0.0239278 0.0015
0.0283892 0.0266703 0.0210978 0.0015
0.0322364 0.0298972 0.0282113 0.0015
0.0269041 0.0204408 0.0265127 0.0015
0.0295258 0.0293948 0.0212187 0.0015
0.0245398 0.0231523 0.0295862 0.0015
0.0178015 0.0261738 0.0177968 0.0015
0.026021 0.0322515 0.0206297 0.0015
0.0301032 0.0277903 0.0236731 0.0015
0.0322264 0.0278804 0.0303835 0.0015
0.0229634 0.0223551 0.0320091 0.0015
0.0307124 0.0259274 0.032048 0.0015
0.0177696 0.0301867 0.0249686 0.0015
0.0293013 0.0296542 0.0265791 0.0015
0.0283612 0.0200495 0.0181101 0.0015
0.0322158 0.0258758 0.0244254 0.0015
0.0256938 0.0230807 0.0260243 0.0015
0.0322614 0.0322903 0.0299867 0.0015
0.0271081 0.0279631 0.0178916 0.0015
0.0282175 0.0203153 0.0321007 0.0015
0.0178086 0.0204051 0.0305596 0.0015
0.0248368 0.0246643 0.0227298 0.0015
0.0207381 0.0246782 0.0294686 0.0015
0.0178079 0.0178202 0.0206456 0.0015
0.0296785 0.0259988 0.0260802 0.0015
0.0178222 0.0178226 0.0177958 0.0015
0.0322144 0.0232181 0.0257478 0.0015
0.0247606 0.0312801 0.0293061 0.0015
0.0269235 0.0223401 0.0234643 0.0015
0.0269121 0.0251292 0.0178316 0.0015
0.0242797 0.0215566 0.0213311 0.0015
0.0253235 0.0177877 0.0251117 0.0015
0.0235819 0.0321655 0.0267623 0.0015
0.0265927 0.0187846 0.0206085 0.0015
0.019697 0.0225662 0.0205688 0.0015
0.0321963 0.0178108 0.0230955 0.0015
0.0216489 0.0212353 0.0226878 0.0015
0.0225049 0.022332 0.0276505 0.0015
0.017783 0.0322525 0.0178251 0.0015
0.0295761 0.0232292 0.0309606 0.0015
0.020183 0.0246431 0.0232522 0.0015
0.0186716 0.025176 0.0274007 0.0015
0.0205473 0.0292455 0.0244887 0.0015
0.0178014 0.0296022 0.0291546 0.0015
0.0282425 0.0237411 0.0203954 0.0015
0.0206179 0.020632 0.031634 0.0015
0.0320111 0.0322371 0.0208441 0.0015
0.0206879 0.0322691 0.0178517 0.0015
0.0203723 0.0247275 0.0178577 0.0015
0.0227773 0.0275868 0.0207949 0.0015
0.0290156 0.0322597 0.02082 0.0015
0.0205505 0.030286 0.0273229 0.0015
0.0203694 0.0293112 0.0209934 0.0015
0.0177824 0.0235551 0.0296056 0.0015
0.030871 0.0322143 0.0267549 0.0015
0.0293854 0.017816 0.0207962 0.0015
# Here is the MWE for running the model. Please change the address for the location of the txt files (compacted.txt and BinSizeHP.txt).
from yade import pack, ymport, plot, utils, export, timing
import numpy as np
young=5e6
identifier = '-thm_coupling'
if not os.path.exists('VTK'+identifier):
os.mkdir('VTK'+identifier)
if not os.path.exists('txt'+identifier):
os.mkdir('txt'+identifier)
O.materials.append(FrictMat(young=young*100,poisson=0.5,frictionAngle=0,density=2600,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(30),density=2600,label='spheres'))
O.saveTmp('Init')
_sp = ymport.textExt('/home/zkhademian/THM2/12_DelayedInstability/compacted.txt',format='x_y_z_r', material='spheres')
sp = O.bodies.append(_sp)
minX=min([b.state.pos[0]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
maxX=max([b.state.pos[0]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
minY=min([b.state.pos[1]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
maxY=max([b.state.pos[1]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
minZ=min([b.state.pos[2]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
maxZ=max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
print ("minX:",minX,"maxX:",maxX,"minY:",minY,"maxY:",maxY,"minZ:",minZ,"maxZ:",maxZ)
Hsize=(minX,minY,minZ,maxX,maxY,maxZ)
output='\t%g\t%g\t%g\t%g\t%g\t%g'%tuple(Hsize[i] for i in range(6))
with open('/home/zkhademian/THM2/12_DelayedInstability/BinSizeHP.txt', 'w') as f:
for item in Hsize:
f.write("%s\n" % item)
O.loadTmp('Init')
with open('/home/zkhademian/THM2/12_DelayedInstability/BinSizeHP.txt') as f:
BSP2 = f.readlines()
f.close()
mn,mx=Vector3(float(BSP2[0]),float(BSP2[1]),float(BSP2[2])),Vector3(float(BSP2[3]),float(BSP2[4]),float(BSP2[5])) # corners of the initial packing
walls=aabbWalls([mn,mx],material='walls',thickness=0)#xx*.1)
wallIds=O.bodies.append(walls)
_sp = ymport.textExt('/home/zkhademian/THM2/12_DelayedInstability/compacted.txt',format='x_y_z_r', material='spheres')
sp = O.bodies.append(_sp)
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1,label='is2aabb'),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1,label='ss2sc'),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
#GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine(dead=1,label='thermal'),
VTKRecorder(iterPeriod=500,fileName='VTK'+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=0,label='VTKrec'),
NewtonIntegrator(damping=0.5)
]
O.dt=PWaveTimeStep()*.1
O.step()
#ss2sc.interactionDetectionFactor=-1
#is2aabb.aabbEnlargeFactor=-1
for b in O.bodies:
if isinstance(b.shape,Sphere):
b.dynamic=False
maxY=max([b.state.pos[1]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
maxX=max([b.state.pos[0]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
minY=min([b.state.pos[1]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
minX=min([b.state.pos[0]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
minZ=min([b.state.pos[2]-b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
maxZ=max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])
print(minX,minY,minZ)
print(maxX,maxY,maxZ)
dz=maxZ-minZ
dy=maxY-minY
dx=maxX-minX
flow.debug=False
# add flow
flow.permeabilityMap = False
flow.pZero = 10
flow.meshUpdateInterval=-1
flow.fluidBulkModulus=2.2e9
flow.useSolver=4
flow.permeabilityFactor=-1e-5
flow.viscosity= 0.001
flow.decoupleForces = False
flow.bndCondIsPressure=[0,0,0,0,1,1]
flow.bndCondValue=[0,0,0,0,0,10]
## Thermal Stuff
flow.bndCondIsTemperature=[0,0,0,0,1,1]
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,25,45]
flow.tZero=25
flow.dead=0
thermal.dead=1
thermal.conduction=True
thermal.fluidConduction=True
thermal.debug=0
thermal.thermoMech=False
thermal.solidThermoMech = False
thermal.fluidThermoMech = False
thermal.advection=True
thermal.useKernMethod=False
thermal.bndCondIsTemperature=[0,0,0,0,1,1]
thermal.thermalBndCondValue=[0,0,0,0,25,45]
thermal.fluidK = 0.65
thermal.fluidBeta = 2e-5 # 0.0002
thermal.particleT0 = 25
thermal.particleK = 2.0
thermal.particleCp = 710
thermal.particleAlpha = 3.0e-5
thermal.particleDensity = 2700
thermal.tsSafetyFactor = 0 #0.01
thermal.uniformReynolds =-1
thermal.minimumThermalCondDist=0
thermal.minimumFluidCondDist=0.0015
thermal.fluidConductionAreaFactor=.1
timing.reset()
O.dt=1e-5
O.dynDt=False
thermal.dead=0
flow.emulateAction()
def bodyByPos(x,y,z):
cBody = O.bodies[1]
cDist = Vector3(100,100,100)
for b in O.bodies:
if isinstance(b.shape, Sphere):
dist = b.state.pos - Vector3(x,y,z)
if np.linalg.norm(dist) < np.linalg.norm(cDist):
cDist = dist
cBody = b
return cBody
bodyOfInterest = bodyByPos((maxZ-dz/2.),(maxZ-dz/2.),(maxZ-dz/2.))
from yade import plot
def MaxTempInModel():
MaxFluidTemp=0
for i in range(0,flow.nCells()):
MaxFluidTemp=max(MaxFluidTemp,flow.getCellTemperature(i))
MaxTemp=0
for b in O.bodies:
if isinstance(b.shape,Sphere):
MaxTemp=max(MaxTemp,b.state.temp)
print("######### MAX SOLID TEMPERATURE IS:",MaxTemp,"##########")
print("######### MAX FLUID TEMPERATURE IS:",MaxFluidTemp,"##########")
O.engines=O.engines+[PyRunner(iterPeriod=100,command='MaxTempInModel()',label='MaxTempInModel')]
def history():
plot.addData(
ftemp1=flow.getPoreTemperature(((maxZ-dz/2.),(maxZ-dz/2.),(maxZ-dz/2.))),
t=O.time,
i = O.iter,
bodyOfIntTemp = O.bodies[bodyOfInterest.id].state.temp,
)
#plot.saveDataTxt('Record.txt',vars=('t','i','p','ftemp1','bodyOfIntTemp'))
O.engines=O.engines+[PyRunner(iterPeriod=200,command='history()',label='recorder')]
def pressureField():
flow.saveVtk('VTKPressure'+identifier+'/',withBoundaries=True)
O.engines=O.engines+[PyRunner(iterPeriod=500,command='pressureField()')]
plot.plots={'t':(('ftemp1','k-'),('bodyOfIntTemp','r-'))}
plot.plot(subPlots=False)
def ColorScaler():
for s in O.bodies:
s.shape.color=scalarOnColorScale(s.state.temp,25,45)
O.engines=O.engines+[PyRunner(command='ColorScaler()',iterPeriod=20)]
ColorScaler()
O.run(25000,0)
--
You received this question notification because your team yade-users is
an answer contact for Yade.