Energy conservation in thermal and flow Engines
I am evaluating the conservation of energy within a cubic box of spheres with voids filled by a fluid. There is no flow in the model and thermal boundary condition forces transfer of heat at only one boundary. The initial temperature of solid and fluid is 45 K and boundary temperature of both solid and fluid is fixed at 25 K. I calculate the change in the internal energy of solid and fluid phases and compare it with the total thermal flux * time.
The difference between them implies "thermalBndFlux" excludes calculation of flux of energy by the fluid cells. Is this true?
If so, how can I calculate the boundary thermal flux through fluid? I have difficulty finding the throat index relating two neighboring cells so that I can use "getDiffusionCoeff" and cell temperatures to estimate thermal flux between the cells.
Thanks-Zoheir
Here is a MWE:
from yade import pack, ymport, plot, utils, export, timing
import numpy as np
t0=45
young=5e6
mn,mx=Vector3(
O.materials.
O.materials.
walls=aabbWalls
wallIds=
sp=pack.
sp.makeCloud(
sp.toSimulation
triax=TriaxialS
maxMultiplier=
finalMaxMultip
thickness = 0,
stressMask = 7,
internalCompac
)
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
GlobalStiffnes
triax,
FlowEngine(
ThermalEngine(
NewtonIntegrat
]
O.step()
ss2sc.interacti
is2aabb.
tri_pressure = 1000
triax.goal1=
triax.stressMask=7
while 1:
O.run(1000, True)
unb=unbalance
print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
if unb<0.1 and abs(-tri_
break
triax.internalC
#------
for b in O.bodies:
if isinstance(b.shape, Sphere):
b.dynamic=False # mechanically static
#------
flow.debug=False
# add flow
flow.permeabili
#flow.pZero = 10
flow.meshUpdate
flow.fluidBulkM
flow.useSolver=4
flow.permeabili
flow.viscosity= 0.001
flow.decoupleForces = False# double check
flow.bndCondIsP
flow.bndCondVal
## Thermal Stuff
flow.bndCondIsT
flow.thermalEng
flow.thermalBnd
flow.tZero=t0
flow.dead=0
thermal.dead=1
thermal.
thermal.
thermal.debug=0
thermal.
thermal.
thermal.
thermal.
thermal.
thermal.
thermal.
thermal.fluidK = 0.650
thermal.fluidBeta = 2e-5 # 0.0002
thermal.particleT0 = t0
thermal.particleK = 2.0
thermal.particleCp = 710
thermal.
thermal.
thermal.
thermal.
thermal.
#------
timing.reset()
O.dt=1.
O.dynDt=False
thermal.dead=0
flow.emulateAct
def bodyByPos(x,y,z):
cBody = O.bodies[1]
cDist = Vector3(
for b in O.bodies:
if isinstance(b.shape, Sphere):
dist = b.state.pos - Vector3(x,y,z)
if np.linalg.
cDist = dist
cBody = b
return cBody
bodyOfInterest = bodyByPos(
#------
from yade import plot
def history():
plot.addData(
ftemp1=
p=flow.
t=O.time,
i = O.iter,
bodyOfIntTemp = O.bodies[
)
O.engines=
plot.plots=
plot.plot(
def ColorScaler():
for s in O.bodies:
s.shape.
O.engines=
f= open("RecordedD
f.close()
def Recorder():
Q=(abs(
f= open("RecordedD
f.write('%f %f' % (Q,O.iter))
f.write('\n')
f.close()
O.engines=
#------
#Finding Initial IE
cellsHit = []
numPoints = 40
mnx=0.
mxx=0.1
mny=0.
mxy=0.1
mnz=0.
mxz=0.1
xs = np.linspace(
ys = np.linspace(
zs = np.linspace(
v = np.array([0,0,0])
O.step()
O.step()
PM1=0.;
for b in O.bodies:
if isinstance(b.shape, Sphere):
PM1+=
cellId=0
for x,y,z in itertools.
cellId = flow.getCell(x,y,z) #getCell return cell id for a point position xyz
if cellId in cellsHit: continue #this prevents counting a cell multiple times
#print("Initial Solid IE is",PM1, "Initial Fluid IE is",PM2,"Total Volume is:",VV)
#------
O.run(1000,
#------
dQsolid=0.
for b in O.bodies:
if isinstance(b.shape, Sphere):
dQsolid+
VV=0;VVv=0.; CellNo=0; dQfluid=
for x,y,z in itertools.
cellId = flow.getCell(x,y,z) #getCell return cell id for a point position xyz
if cellId in cellsHit: continue #this prevents counting a cell multiple times
if (t0-flow.
dQtotal=
FluxTotal=0.
infile = open("RecordedD
lines = infile.readlines()
infile.close()
ret=[]
for line in lines:
data = line.split()
FluxTotal+
print("Fluid Internal Energy Change is", dQfluid-PM2,", Solid Internal Energy Change is:",dQsolid-PM1,", Total Internal Energy Change is",dQtotal)
print("Total flux is",FluxTotal, ", and error is",(FluxTotal-
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Zoheir Khademian for more information if necessary.