Re: [Yade-users] [Question #703208]: Problem with using blockCell command in flow/thermal engine

2022-10-10 Thread Zoheir Khademian
Question #703208 on Yade changed:
https://answers.launchpad.net/yade/+question/703208

Zoheir Khademian posted a new comment:
Thanks Robert and no problem. Looking forward to your response. I will
post my progress on the issue, if any, here.

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #703208]: Problem with using blockCell command in flow/thermal engine

2022-09-17 Thread Zoheir Khademian
New question #703208 on Yade:
https://answers.launchpad.net/yade/+question/703208

Hello Robert,

In order to increase timestep in advection simulation, I would like to block 
cells with volume less than a min volume.
I tried blockCell command [1] in your flowScenario.py example and blocked cells 
located on the top (z>0.04); here is what happens:
1- Temperature in the blocked cells remained as initiated; that makes sense, 
right? but the problem is that the heat transfer between hot flow and solid 
stops working. I mean, the solid does not get heat up and remain at initial 
temperature
2- Pressure gradient in blocked and non-blocked cells are the same. So, it 
seems like flow calculations still occur in all cells.

Please let me know if I am not applying blockCell  in the right way.

Thanks
Zoheir


Here is what I added to the flowScenario.py example:
# Blocking cells in the upper part of the model
#+
flow.emulateAction()
flow.updateTriangulation=1
for i in range(0,flow.nCells()):
  coords = flow.getCellCenter(i)
  if coords[2]>.04:
flow.blockCell(i,1)
#++

Here is the entire MWE:

# -*- encoding=utf-8 -*-
#*
#  Copyright (C) 2019 by Robert Caulk*
#  rob.ca...@gmail.com   *
#*
#  This program is free software; it is licensed under the terms of the  *
#  GNU General Public License v2 or later. See file LICENSE for details. *
#*/
#
# Script demonstrating the use of ThermalEngine by permeating warm fluid
# through a cold packing. Also serves as a validation script for comparison
# with ANSYS CFD. See details in 
# Caulk, R., Scholtes, L., Kraczek, M., Chareyre, B. (In Print) A 
# pore-scale Thermo-Hydro-Mechanical coupled model for particulate systems.
# Computer Methods in Applied Mechanics and Engineering. Accepted July 2020.
#
# note: warnings for inifiniteK and Reynolds numbers = nan for boundary
# cells in regular packings are expected. It does not interfere with the 
# physics


from yade import pack, ymport
from yade import timing
import numpy as np
import shutil
timeStr = time.strftime('%m-%d-%Y')
num_spheres=1000# number of spheres
young=1e9
rad=0.003

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05) # corners of the initial packing

thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity

identifier = '-flowScenario'

if not os.path.exists('VTK'+timeStr+identifier):
os.mkdir('VTK'+timeStr+identifier)
else:
shutil.rmtree('VTK'+timeStr+identifier)
os.mkdir('VTK'+timeStr+identifier)

if not os.path.exists('txt'+timeStr+identifier):
os.mkdir('txt'+timeStr+identifier)
else:
shutil.rmtree('txt'+timeStr+identifier)
os.mkdir('txt'+timeStr+identifier)

shutil.copyfile(sys.argv[0],'txt'+timeStr+identifier+'/'+sys.argv[0])

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp = O.bodies.append(ymport.textExt('5cmEdge_1mm.spheres', 
'x_y_z_r',color=(0.1,0.1,0.9), material='spheres'))

print('num bodies ', len(O.bodies))

triax=TriaxialStressController(
maxMultiplier=1.+2e4/young, 
finalMaxMultiplier=1.+2e3/young, 
thickness = 0,
stressMask = 7,
internalCompaction=True,
)

ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,

VTKRecorder(iterPeriod=500,fileName='VTK'+timeStr+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=1,label='VTKrec'),
newton
]

#goal = -1e5
#triax.goal1=triax.goal2=triax.goal3=goal

for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

flow.dead=0
flow.defTolerance=-1 #0.3
flow.meshUpdateInterval=-1
flow.useSolver=4
flow.permeabilityFactor= 1
flow.viscosity= 

Re: [Yade-users] [Question #702133]: How to implement temperature-dependent pressure calcs in Thermal and Flow Engines

2022-06-17 Thread Zoheir Khademian
Question #702133 on Yade changed:
https://answers.launchpad.net/yade/+question/702133

Zoheir Khademian posted a new comment:
Hey Robert,

Sorry for the late response. I was trying to make a weak coupling
between pressure and temperature.  I ended up slightly modifying [1] in
thermal.cpp to allow changes in dV rates due to temperature changes. I
know this function is for considering fluid expansion in the pressure
calculations, but I set beta=1 and then divide [2] by the current
temperature of the cell (cell->info().temp()). This way I assumed I have
an ideal gas with linear relationship between temperature and volume
changes. I recompiled and it seams to be working. I need to find a way
to validate the results though. What do you think?

Here is the modified function:
void ThermalEngine::computeCellVolumeChangeFromDeltaTemp(CellHandle& cell, Real 
/*cavDens*/)
{
Real beta;
if (tempDependentFluidBeta) beta = 7.5e-6 * cell->info().temp() + 
5.7e-5; // linear model for thermal expansion
else
beta = fluidBeta;
Real poreVolume;
if (porosityFactor > 0) poreVolume = cell->info().volume() * 
porosityFactor; // allows us to simulate low porosity matrices
else
poreVolume = (1. / cell->info().invVoidVolume());
//  else K = flow->fluidBulkModulus;
if (!cell->info().isCavity) {
cell->info().dv() += -poreVolume * cell->info().dtemp()/ 
cell->info().temp() / thermalDT;
} else if (cell->info().isCavity) {
cell->info().dv() += -(cell->info().volume()) * beta * 
cell->info().dtemp()
/ thermalDT; // ignore the particles used for fluid 
discretization in the pore (i.e. use volume())
}
}


>>If you wanted a strong coupling, I could advise you or implement it for you - 
>>but it would require significant development hours, and therefore, I would 
>>have little choice but to charge for that kind of software development.
Thanks for the offer. I shared this with Ryan. We might end up going that route 
at the end but for preliminary results a weak coupling should do. 

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L739
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L751

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #702133]: How to implement temperature-dependent pressure calcs in Thermal and Flow Engines

2022-06-09 Thread Zoheir Khademian
New question #702133 on Yade:
https://answers.launchpad.net/yade/+question/702133

Hello Robert,

I am simulating gas flow in ThermalEngine and was wondering if there is a way 
to make the pore pressure a function of the pore temperature.

Thanks
Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #701507]: Does thermal engine support MPI?

2022-05-02 Thread Zoheir Khademian
Question #701507 on Yade changed:
https://answers.launchpad.net/yade/+question/701507

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thank you, Robert, for the references. I am going through the steps to
get started on GPU parallelization.

Thanks again

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #701507]: Does thermal engine support MPI?

2022-04-24 Thread Zoheir Khademian
New question #701507 on Yade:
https://answers.launchpad.net/yade/+question/701507

Hi Robert,

Hope all is well!
I was wondering if ThermalEngine is upgraded with MPI [1] support and if not, 
could you give me some hints on how to do so?

Thanks
Zoheir

[1] https://yade-dem.org/doc/mpy.html#mpi-parallelization

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699917]: "noFlowscenario.py" example not working

2021-12-24 Thread Zoheir Khademian
Question #699917 on Yade changed:
https://answers.launchpad.net/yade/+question/699917

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hi Robert and happy Christmas!

>When do solid and fluid temps go to nan? 
>From the very beginning. I reduced the timestep but it was not the cause.

>You should be testing yadedaily instead. I tested yadedaily too but got
the same results.

>Is it possible for you to try with Ubuntu 18.04? 
I finally got a chance to try noFlowScenario.py on Ubuntu 18.04 and was able to 
successfully run it. 

I wish you a happy new year

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699917]: "noFlowscenario.py" example not working

2021-12-18 Thread Zoheir Khademian
Question #699917 on Yade changed:
https://answers.launchpad.net/yade/+question/699917

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hi Robert,

I did not check this noFlowScenario example [1] before and after we closed [2]. 
The MWE in [2] worked and still works after fixing the delT issue in [3] but 
there I had some flow in the model but in [1], there is no flow. In [1], if I I 
change the fluid boundaries to:
flow.bndCondIsPressure=[1,1,0,0,0,0]
flow.bndCondValue=[10,0,0,0,0,0]
and thus allow some flow in the model, it works, meaning fluid and solid temps 
start evolving.

So in summary, in [1], fluid and solid temperatures go "nan" unless I
allow some flow in the model.


[1] 
https://gitlab.com/yade-dev/trunk/-/blob/d81270ce696546a6d8ae551d6b9c1ba41659ebf9/examples/ThermalEngine/noFlowScenario.py
[2] https://answers.launchpad.net/yade/+question/698948
[3] 
]https://gitlab.com/yade-dev/trunk/-/commit/5d2339619da8779793e3a9c5e52d55e7bbed665b

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #699917]: "noFlowscenario.py" example not working

2021-12-18 Thread Zoheir Khademian
New question #699917 on Yade:
https://answers.launchpad.net/yade/+question/699917

Hi Robert,

The thermal engine example [1] does not update the body and fluid temperatures. 
I checked the advection and conduction schemes with debug=True and they seam to 
be working but printing or plotting temperatures gives "nan".

I tried the development version [2] and released version  yade_2021.01a but 
still no chance. My Ubuntu version is 20.04.3.
Would you please try this example and let me know if I m missing something.

Thanks
Zoheir

[1] 
https://gitlab.com/yade-dev/trunk/-/blob/d81270ce696546a6d8ae551d6b9c1ba41659ebf9/examples/ThermalEngine/noFlowScenario.py

[2] https://gitlab.com/yade-dev/trunk

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699421]: Advection stops working in ThermalEngine when decoupleForces in FlowEngine is True

2021-11-12 Thread Zoheir Khademian
Question #699421 on Yade changed:
https://answers.launchpad.net/yade/+question/699421

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Hi Robert,
Thanks for very nice explanation. 

>>  Please confirm if it works for you or not.

Yes, decoupleForces works well now.

Thank you!

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699421]: Advection stops working in ThermalEngine when decoupleForces in FlowEngine is True

2021-11-12 Thread Zoheir Khademian
Question #699421 on Yade changed:
https://answers.launchpad.net/yade/+question/699421

Zoheir Khademian confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698778]: Problem with imposing flux in a cavity in flow engine

2021-11-11 Thread Zoheir Khademian
Question #698778 on Yade changed:
https://answers.launchpad.net/yade/+question/698778

Zoheir Khademian posted a new comment:
Sorry Robert, I noticed that I have not closed this thread yet. I
double-checked the units again and noticed that there seems to be an
arithmetic error here:

>> q = np.linalg.norm(v)/totalVolume # m^4/s divided by m^3 -> m^3/s

m^4/s divided by m^3  should be m/s, which is the average of the
velocity vectors. I guess we are missing the external area of cavity for
calculating the flux (average velocity vectors * area =flux). What am I
missing?

Thanks
Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699421]: Advection stops working in ThermalEngine when decoupleForces in FlowEngine is True

2021-11-11 Thread Zoheir Khademian
Question #699421 on Yade changed:
https://answers.launchpad.net/yade/+question/699421

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hi Robert and thanks!

>>To start, do you need any body movement? Or can you simply set all
O.bodies[i].dynamic=False?

I dont need any movement so I set all body dynamic to false but still
the viscus and pressure forces are calculated in the FlowEngine, which
adds to the runtime. To avoid this calculations, I tried setting
decoupleForces=True but advection and fluid convection stopped working.
I think the calculation of cell temperatures is somehow dependent on the
decoupleForces option.

>>Does decoupleForces work on the standard oedometer.py example script
[1]?

Yes, in the oedometer.py example script, I set decoupleForces true and it 
prevented the viscus and pressure force calculations. The engine time table 
that is printed in the terminal showed that time spent on force calculation is  
zero. From the plots when running the example, the vertical strain was not 
affected by the pore pressure changes during the test.
So, I think decoupleForces works fine but advection and fluid conduction does 
not if decoupleForces is true.

Another question is where cell temperature is updated in the source
code? I think cell->info().temp() is not updated when decoupleForces is
true.

Thanks
Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #699421]: Advection stops working in ThermalEngine when decoupleForces in FlowEngine is True

2021-11-09 Thread Zoheir Khademian
Question #699421 on Yade changed:
https://answers.launchpad.net/yade/+question/699421

Description changed to:
Hello

I took the example flowScenario.py [1] and turned decoupleForces  [2] true to 
avoid applying viscus and pressure forces on particles. My goal is to speed up 
the simulation as I am not interested in mechanical responses. However, it 
seems fluid conduction and advection stop working when this option is on.  This 
is the only change I made to [1] but put the MWE here as well. 
My question is if there is a way to get fluid conduction and advection work 
without having the flow engine calculate the forces on the particles, assuming 
I am not missing anything here.

Thanks

Zoheir


[1] 
https://gitlab.com/yade-dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py
[2] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngine.decoupleForces


from yade import pack, ymport
from yade import timing
import numpy as np
import shutil
timeStr = time.strftime('%m-%d-%Y')
num_spheres=1000# number of spheres
young=1e9
rad=0.003

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05) # corners of the initial
packing

thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity

identifier = '-flowScenario'

if not os.path.exists('VTK'+timeStr+identifier):
os.mkdir('VTK'+timeStr+identifier)
else:
shutil.rmtree('VTK'+timeStr+identifier)
os.mkdir('VTK'+timeStr+identifier)

if not os.path.exists('txt'+timeStr+identifier):
os.mkdir('txt'+timeStr+identifier)
else:
shutil.rmtree('txt'+timeStr+identifier)
os.mkdir('txt'+timeStr+identifier)

shutil.copyfile(sys.argv[0],'txt'+timeStr+identifier+'/'+sys.argv[0])

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp = O.bodies.append(ymport.textExt('5cmEdge_1mm.spheres',
'x_y_z_r',color=(0.1,0.1,0.9), material='spheres'))

print('num bodies ', len(O.bodies))

triax=TriaxialStressController(
maxMultiplier=1.+2e4/young, 
finalMaxMultiplier=1.+2e3/young, 
thickness = 0,
stressMask = 7,
internalCompaction=True,
)

ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,

VTKRecorder(iterPeriod=500,fileName='VTK'+timeStr+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=1,label='VTKrec'),
newton
]

#goal = -1e5
#triax.goal1=triax.goal2=triax.goal3=goal

for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

flow.dead=0
flow.defTolerance=-1 #0.3
flow.meshUpdateInterval=-1
flow.useSolver=4
flow.permeabilityFactor= 1
flow.viscosity= 0.001
flow.bndCondIsPressure=[1,1,0,0,0,0]
flow.bndCondValue=[10,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 997
flow.fluidCp = 4181.7
flow.getCHOLMODPerfTimings=True
flow.bndCondIsTemperature=[1,0,0,0,0,0]
flow.thermalEngine=True
flow.thermalBndCondValue=[343.15,0,0,0,0,0]
flow.tZero=t0
flow.pZero=0
flow.maxKdivKmean=1
flow.minKdivmean=0.0001;
flow.decoupleForces = True

thermal.dead=0
thermal.debug=False
thermal.fluidConduction=True
thermal.ignoreFictiousConduction=True
thermal.conduction=True
thermal.thermoMech=False
thermal.solidThermoMech = False
thermal.fluidThermoMech = False
thermal.advection=True
thermal.bndCondIsTemperature=[0,0,0,0,0,0]
thermal.thermalBndCondValue=[0,0,0,0,0,0]
thermal.fluidK = 0.6069 #0.650
thermal.fluidConductionAreaFactor=1.
thermal.particleT0 = t0
thermal.particleDensity=2600.
thermal.particleK = thermalCond
thermal.particleCp = heatCap
thermal.useKernMethod=True
#thermal.useHertzMethod=False
timing.reset()

O.dt=0.1e-3
O.dynDt=False

O.run(1,1)
flow.dead=0

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
  

[Yade-users] [Question #699421]: Advection stops working in ThermalEngine when decoupleForces in FlowEngine is True

2021-11-09 Thread Zoheir Khademian
New question #699421 on Yade:
https://answers.launchpad.net/yade/+question/699421

Hello

I took the example flowScenario.py [1] and turned decoupleForces  true to avoid 
applying viscus and pressure forces on particles. My goal is to speed up the 
simulation as I am not interested in mechanical responses. However, it seems 
fluid conduction and advection stop working when this option is on.  This is 
the only change I made to [1] but put the MWE here as well. 
My question is if there is a way to get fluid conduction and advection work 
without having the flow engine calculate the forces on the particles, assuming 
I am not missing anything here.

Thanks

Zoheir


[1] 
https://gitlab.com/yade-dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py



from yade import pack, ymport
from yade import timing
import numpy as np
import shutil
timeStr = time.strftime('%m-%d-%Y')
num_spheres=1000# number of spheres
young=1e9
rad=0.003

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05) # corners of the initial packing

thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity

identifier = '-flowScenario'

if not os.path.exists('VTK'+timeStr+identifier):
os.mkdir('VTK'+timeStr+identifier)
else:
shutil.rmtree('VTK'+timeStr+identifier)
os.mkdir('VTK'+timeStr+identifier)

if not os.path.exists('txt'+timeStr+identifier):
os.mkdir('txt'+timeStr+identifier)
else:
shutil.rmtree('txt'+timeStr+identifier)
os.mkdir('txt'+timeStr+identifier)

shutil.copyfile(sys.argv[0],'txt'+timeStr+identifier+'/'+sys.argv[0])

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp = O.bodies.append(ymport.textExt('5cmEdge_1mm.spheres', 
'x_y_z_r',color=(0.1,0.1,0.9), material='spheres'))

print('num bodies ', len(O.bodies))

triax=TriaxialStressController(
maxMultiplier=1.+2e4/young, 
finalMaxMultiplier=1.+2e3/young, 
thickness = 0,
stressMask = 7,
internalCompaction=True,
)

ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,

VTKRecorder(iterPeriod=500,fileName='VTK'+timeStr+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=1,label='VTKrec'),
newton
]

#goal = -1e5
#triax.goal1=triax.goal2=triax.goal3=goal

for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

flow.dead=0
flow.defTolerance=-1 #0.3
flow.meshUpdateInterval=-1
flow.useSolver=4
flow.permeabilityFactor= 1
flow.viscosity= 0.001
flow.bndCondIsPressure=[1,1,0,0,0,0]
flow.bndCondValue=[10,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 997
flow.fluidCp = 4181.7
flow.getCHOLMODPerfTimings=True
flow.bndCondIsTemperature=[1,0,0,0,0,0]
flow.thermalEngine=True
flow.thermalBndCondValue=[343.15,0,0,0,0,0]
flow.tZero=t0
flow.pZero=0
flow.maxKdivKmean=1
flow.minKdivmean=0.0001;
flow.decoupleForces = True

thermal.dead=0
thermal.debug=False
thermal.fluidConduction=True
thermal.ignoreFictiousConduction=True
thermal.conduction=True
thermal.thermoMech=False
thermal.solidThermoMech = False
thermal.fluidThermoMech = False
thermal.advection=True
thermal.bndCondIsTemperature=[0,0,0,0,0,0]
thermal.thermalBndCondValue=[0,0,0,0,0,0]
thermal.fluidK = 0.6069 #0.650
thermal.fluidConductionAreaFactor=1.
thermal.particleT0 = t0
thermal.particleDensity=2600.
thermal.particleK = thermalCond
thermal.particleCp = heatCap
thermal.useKernMethod=True
#thermal.useHertzMethod=False
timing.reset()

O.dt=0.1e-3
O.dynDt=False

O.run(1,1)
flow.dead=0

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
print('found closest body ', cBody.id, ' at ', cBody.state.pos)
return cBody


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-21 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-21 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
I am glad we were able to fix this after all.

Thanks

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-20 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
BTW, my Ubuntu version is: 20.04.3

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-20 Thread Zoheir Khademian
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.0322250.0197924   0.0178472   0.0015
0.0322266   0.0291739   0.0178539   0.0015
0.0279236   0.0322490.0261029   0.0015
0.0322118   0.0302264   0.0320853   0.0015
0.0272061   0.0316643   0.0320534   0.0015
0.0293610.0178245   0.0290514   0.0015
0.0223492   0.0237293   0.0212975   0.0015
0.0322662   0.0177355   0.0290630.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.0299960.0247971   0.0227321   0.0015
0.0231086   0.0224061   0.0178694   0.0015
0.0237889   0.0267710.0280437   0.0015
0.0271796   0.0296372   0.0298686   0.0015
0.0293275   0.0207069   0.0294883   0.0015
0.0297280.0307252   0.0238577   0.0015
0.0294550.0177438   0.03204 0.0015
0.0220291   0.0251347   0.0320876   0.0015
0.0228457   0.0177657   0.0205171   0.0015
0.0247976   0.0201580.0187476   0.0015
0.0221528   0.0177930.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.0231820.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.0178150.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.0322810.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.0178190.0015
0.0292976   0.0252520.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.0301260.0177624   0.0178698   0.0015
0.0254739   0.0197561   0.0231361   0.0015
0.0322638   0.0228734   0.0228553   0.0015
0.0265408   0.0222830.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

Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-19 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
Hey Robert,
Sorry for my delays. I try to give your comments enough thoughts and do 
investigation before replying.

I tried both released version [1] and development version [2] and still
observed the instabilities meaning the particle temp goes above the max
boundary temp while cell temp is still within the range.


Regarding the diffusivity coefficient kA/L, in the MWE I uploaded last, I have 
reduced  kA/L by reducing fluidk and fluidConductionAreaFactor to arbitrarily 
low values. I also tried your values (thermal.minimumFluidCondDist=rMean and 
thermal.fluidConductionAreaFactor=0.1) but still the particle temp is unstable. 

Finally I looked at the thermal.cpp and noticed that
applyTempDeltaToSolids [3] adds pore temp differences to the solid temp
for no apparent reason (particle temp is updated here [4]). I
deactivated applyTempDeltaToSolids and recompiled the source. I ran the
MWE and the results are stable now.

Let me know if applyTempDeltaToSolids must not be deactivated or I am
missing something here

Thanks
Zoheir


[1] https://launchpad.net/yade/+download

[2] https://gitlab.com/yade-dev/trunk

[3] https://gitlab.com/yade-
dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L94

[4] https://gitlab.com/yade-
dev/trunk/-/blob/master/pkg/pfv/Thermal.cpp#L605

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-12 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
Hi Robert,

I updated my Yade version to yade-2021.01a and tried the  script above
with rMean=0.001. The particle temperature still goes up to 1000 K after
2 iterations. I even tried the script on other machines but got the
same results.  Please note that with rMean=0.0015, the temp range is OK
(under 45 K) but once I change the mean size to rMean=0.001, the
particle temperature exceeds the boundary temp and goes to 1000 K.

Would you be able to try this one more time with rMean=0.001 on your
machine? I would really appreciate your help


Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-10 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
Hey Robert,

I ran it in both Yadedaily 20201215-4510~714a723~bionic1 Using python version: 
3.6.9
and "eraseBodyThermalEngine" [1] trunk version.

Of 10 times of running the model, I get 8 stable results and 2 unstable results 
(after 1 iterations)
If I change the sphere size to rMean=0.001 from 0.0015, all tries lead to 
instability. Please reduce the mean sphere size to 0.001 and let me know if you 
can still get stable results.

[1]https://gitlab.com/yade-dev/trunk/-/tree/eraseBodyThermalEngine

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-10 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
Thanks Robert!
I went through a trial and error process using a more traditional BC as you 
suggested:

low.bndCondIsTemperature=[0,0,0,0,1,1]
flow.thermalBndCondValue=[0,0,0,0,25,45]
thermal.bndCondIsTemperature=[0,0,0,0,1,1]
thermal.thermalBndCondValue=[0,0,0,0,25,45]

and avoid mesh updating by meshUpdateInterval=-1

- First, I turned off the compaction and ran the model. Temperature
ranges seemed to be within expected range 25-45 K. Turning on the
compaction made the model unstable in a way that solid and fluid temp
goes above the assigned boundary condition (45 K).

- I tried to minimize the particle-pore and pore-pore resistivities by 
assigning very small numbers to thermal.fluidConductionAreaFactor[1] and 
thermal.fluidK[2]. I also made sure that the distance between cells wont be 
zero by assigning thermal.minimumFluidCondDist[3] of 0.001. I tried different 
numbers but the particle temp still goes up to 1e3 very quickly while cell temp 
stays below 45 K. 
- I also tried avoiding fictious cells by 
thermal.ignoreFictiousConduction[4]=True but still no chance. I also tried 
using HertzMethod [5] for area calculation. The cell temp was in the range but 
particle temp went to negative. 
- I also limited the Reynolds (thermal.uniformReynolds[6]) to 10 to make sure 
Nusselt number calc is not the reason.

[1] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.fluidConductionAreaFactor
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.fluidK
[3] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.minimumFluidCondDist
[4] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.ignoreFictiousConduction
[5] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.useHertzMethod
[6] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.uniformReynolds
Here is the MWE for reference:
###
from yade import pack, ymport, plot, utils, export, timing
import numpy as np

young=5e6

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)

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'))

walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=.333,num=200,seed=11)
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(

  maxMultiplier=0,
  finalMaxMultiplier=0,
  thickness = 0,
  goal1=-5,
  goal2=-5,
  goal3=-5,
  max_vel=0.1,
  stressMask = 7,
  internalCompaction=False,
  dead=True,
)

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),
 triax,
 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()*.3
O.step()
ss2sc.interactionDetectionFactor=-1
is2aabb.aabbEnlargeFactor=-1
triax.dead=False

while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(triax.goal3-triax.meanStress)/-triax.goal3<0.001:
break
for b in O.bodies:
 if isinstance(b.shape,Sphere):
  b.dynamic=False
triax.internalCompaction=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
flo

Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-07 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Zoheir Khademian posted a new comment:
Thanks so much Robert for the great suggestions. I forgot to mention
that the example I am basing the MWE on is [1] but I added the wall
compaction and made the particles dynamic false after compaction.

I am going through the trial and error approach you suggested, but I had
a question about what you said earlier in this thread: "The one issue we
may run into is when two tetrahedra centers occur on top of one
another". How can this be an issue? I mean how the alignment of two
meshes on the top of each other can contribute to the instability of TH?
Could you direct me to the section in the source code that may be
sensitive to this specific configuration of meshes?

I will get back to you about the results of the trial and error
exercise.

Thank again

Zoheir

[1] https://gitlab.com/yade-
dev/trunk/-/blob/07085490a7a47f24aa962f914b6ba062ea11a026/examples/ThermalEngine/thermoHydroMechanical_coupling.py

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-06 Thread Zoheir Khademian
Question #698948 on Yade changed:
https://answers.launchpad.net/yade/+question/698948

Status: Answered => Open

Zoheir Khademian is still having a problem:
Hi Robert and thanks for the response.

>>What changes have you made in comparison to the example script? 
1- Turning internal compaction off in the triaxial engine and compacted the 
sample by inwards-moving walls.
2- Reducing the particle density from 2600e10 to 2600 to run the triaixal 
engine. 
3- Setting bodies dynamic false after compaction so there is no movement.
4- Turning off the thermo-mechanical analyses in thermal engine.
5- flow.bndCondIsPressure=[0,0,0,0,1,1] ; flow.bndCondValue=[0,0,0,0,0,10]
6- changing rRelFuzz from 0.333 to 0.33 #Small changes in the packing can make 
the model unstable like changing (mn,mx) a bit.

After making these changes, when I run, the model maximum body and fluid
temp exceed the boundary temp after 2 s.

>> I would apply more traditional boundary conditions a bit to confirm that you 
>> can reach stable states for your setup:
I changed the boundary conditions to the traditional ones as you suggested but 
it did not make any difference in stability.


>>You can take some manual control with thermal.minimumFluidCondDist[1].
I tried assigning different values (0.0015 to 0.015) to minimumFluidCondDist[1] 
but it did not make any difference.


>>However, you should also be able to figure out if that is the issue by simply 
>>turning on and off thermal.fluidConduction.
I turned off thermal.fluidConduction  and it solved the instability. I checked 
the centers of neighboring cells and some of them had pretty close X or Y or Z 
coordinates (less than 1e-5). Is this the issue? If so, could you give me some 
hint on how to avoid this issue. 


[1]https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.minimumFluidCondDist

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #698948]: Stability of advection modeling by ThermalEngine

2021-10-03 Thread Zoheir Khademian
New question #698948 on Yade:
https://answers.launchpad.net/yade/+question/698948

Hello,

I am working on the advection through a spherical packing. The problem is when 
thermal advection is on in the model, after about 3 steps or about 2 s the 
body and cell temperatures exceed the target temp (by several orders of 
magnitudes) and thus the model becomes unstable. When I reduce the timestep to 
1e-5 (from 1e-4), the same problem comes up but after 8 s into the simulation.  

So, my question is the origin of this instability if it is not merely me 
missing something in the model. If not, is it correct that there may be some 
polyhedral mesh with bad geometries somewhere in the model away from the heat 
source so it takes a couple thousand steps before the flow reaches these bad 
geometries and model crashes? If this is the case, how can I identify these 
"bad" geometries and remove them from calculations? Any other reasons for this 
delayed instability?

Here is the MWE:


from yade import pack, ymport, plot, utils, export, timing
import numpy as np

young=5e6

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)

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'))


walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=.33,num=200,seed=11) 
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(

  maxMultiplier=0, 
  finalMaxMultiplier=0, 
  thickness = 0,
  goal1=-5,
  goal2=-5,
  goal3=-5,
  max_vel=0.1,
  stressMask = 7,
  internalCompaction=False, 
  dead=True,
)


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),
 triax,
 FlowEngine(dead=1,label="flow",multithread=False),
 ThermalEngine(dead=1,label='thermal'),
 
VTKRecorder(iterPeriod=500,fileName='VTK'+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=1,label='VTKrec'),
 NewtonIntegrator(damping=0.5)
]
O.dt=PWaveTimeStep()*.3
O.step()
ss2sc.interactionDetectionFactor=-1
is2aabb.aabbEnlargeFactor=-1
triax.dead=False

while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(triax.goal3-triax.meanStress)/-triax.goal3<0.001:
break
for b in O.bodies:
if isinstance(b.shape,Sphere):
b.dynamic=False
triax.internalCompaction=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=5
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,0,0] 
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,0,0] 
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,0,1]
thermal.thermalBndCondValue=[0,0,0,0,0,45]
thermal.fluidK = 0.650
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 =10
thermal.minimumThermalCondDist=0


timing.reset()
O.dt=1e-4
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 

Re: [Yade-users] [Question #698778]: Problem with imposing flux in a cavity in flow engine

2021-09-23 Thread Zoheir Khademian
Question #698778 on Yade changed:
https://answers.launchpad.net/yade/+question/698778

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698778]: Problem with imposing flux in a cavity in flow engine

2021-09-23 Thread Zoheir Khademian
Question #698778 on Yade changed:
https://answers.launchpad.net/yade/+question/698778

Zoheir Khademian posted a new comment:
Thanks so much Robert. After checking the VTK output for pressure, I
noticed the cell I was injecting to was not registered as a cavity. So,
simply applying the flux to one of the cavity cells in the cavity list
solved the problem. Now, the influx and outflux are the same.

One more question though:
In your flux calculation above, the unit of q the flux  seams to be m/s. Do we 
need to have the area of the cavity boundary to obtain the flux in m3/s? if so, 
what is the easiest way to get that area?

Thanks again for the help!

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #698778]: Problem with imposing flux in a cavity in flow engine

2021-09-22 Thread Zoheir Khademian
Question #698778 on Yade changed:
https://answers.launchpad.net/yade/+question/698778

Status: Answered => Open

Zoheir Khademian is still having a problem:
Thanks Robert for the detailed information. I followed your comments and
made changes to the MWE. I injected 1e-4 m3/s into the cavity but the
output of flow.getCavityFlux() [1] is about 8e-18 m3/s. Would you please
let me know what I am missing? By the way, does flow.imposeFlux apply
volumetric flux or mass flux?

[1] https://yade-
dev.gitlab.io/trunk/yade.wrapper.html#yade.wrapper.FlowEngineT.getCavityFlux

Here is the updated MWE:

from yade import pack, ymport, plot, utils, export, timing
import numpy as np

young=5e6

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)


O.materials.append(FrictMat(young=young*100,poisson=0.5,frictionAngle=0,density=2600e10,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(30),density=2600e10,label='spheres'))


walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=0.333,num=200,seed=11) 
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(
 maxMultiplier=1.+2e4/young,
 finalMaxMultiplier=1.+2e3/young,
 thickness = 0,
 stressMask = 7,
 internalCompaction=True,
)

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),
 triax,
 FlowEngine(dead=1,label="flow",multithread=False),
 NewtonIntegrator(damping=0.5)
]

O.step()
ss2sc.interactionDetectionFactor=-1
is2aabb.aabbEnlargeFactor=-1

tri_pressure = 1000
triax.goal1=triax.goal2=triax.goal3=-tri_pressure
triax.stressMask=7
while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(-tri_pressure-triax.meanStress)/tri_pressure<0.001:
break

triax.internalCompaction=False
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)])
dz=maxZ-minZ
dy=maxY-minY
dx=maxX-minX
print 
("minX:",minX,"maxX:",maxX,"minY:",minY,"maxY:",maxY,"minZ:",minZ,"maxZ:",maxZ)
CavityList=[]
for b in O.bodies:
if isinstance(b.shape,Sphere):
if 
np.linalg.norm(b.state.pos-(maxX-dx/2.,maxY-dy/2.,maxZ-dz/2.))https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #698778]: Problem with imposing flux in a cavity in flow engine

2021-09-18 Thread Zoheir Khademian
New question #698778 on Yade:
https://answers.launchpad.net/yade/+question/698778

I am trying to define a cavity at the center of a sphere pack. I remove some 
spheres at the center before making the cells at the center part of the cavity 
[1]. Then, I assign a cavity flux using [2]. However, when I run the model, I 
dont get any outflow. I monitor outflow both at the model boundary and cavity 
boundaries [3]. 

[1] 
https://yade-dev.gitlab.io/trunk/yade.wrapper.html#yade.wrapper.FlowEngine.imposeCavity
 
[2] 
https://yade-dev.gitlab.io/trunk/yade.wrapper.html#yade.wrapper.FlowEngineT.cavityFlux
[3] 
https://yade-dev.gitlab.io/trunk/yade.wrapper.html#yade.wrapper.FlowEngineT.getCavityFlux


Here is the MWE: 


from yade import pack, ymport, plot, utils, export, timing
import numpy as np

young=5e6

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)


O.materials.append(FrictMat(young=young*100,poisson=0.5,frictionAngle=0,density=2600e10,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(30),density=2600e10,label='spheres'))


walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=0.333,num=200,seed=11) 
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(
 maxMultiplier=1.+2e4/young,
 finalMaxMultiplier=1.+2e3/young,
 thickness = 0,
 stressMask = 7,
 internalCompaction=True,
)

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),
 triax,
 FlowEngine(dead=1,label="flow",multithread=False),
 NewtonIntegrator(damping=0.5)
]

O.step()
ss2sc.interactionDetectionFactor=-1
is2aabb.aabbEnlargeFactor=-1

tri_pressure = 1000
triax.goal1=triax.goal2=triax.goal3=-tri_pressure
triax.stressMask=7
while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(-tri_pressure-triax.meanStress)/tri_pressure<0.001:
break

triax.internalCompaction=False
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)])
dz=maxZ-minZ
dy=maxY-minY
dx=maxX-minX
print 
("minX:",minX,"maxX:",maxX,"minY:",minY,"maxY:",maxY,"minZ:",minZ,"maxZ:",maxZ)
CavityList=[]
for b in O.bodies:
if isinstance(b.shape,Sphere):
if 
np.linalg.norm(b.state.pos-(maxX-dx/2.,maxY-dy/2.,maxZ-dz/2.))https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-17 Thread Zoheir Khademian
Question #695542 on Yade changed:
https://answers.launchpad.net/yade/+question/695542

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thanks, Robert. This solved my problem.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-16 Thread Zoheir Khademian
Question #695542 on Yade changed:
https://answers.launchpad.net/yade/+question/695542

Zoheir Khademian posted a new comment:
Thanks, Robert.

Could you give some hints or direct me to a reference on the
relationship between timestep and heat transfer properties? What factors
effects maximum allowable timestep?

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-15 Thread Zoheir Khademian
Question #695542 on Yade changed:
https://answers.launchpad.net/yade/+question/695542

Zoheir Khademian posted a new comment:
Thanks, Robert

>What does that mean? Is there an error? 
There is no error but temperature of spheres goes up to 1e200 in a few 
timestep. I 

>Are you sure? When I use those parameters and decrease the timestep
proportionally to viscosity, the model is stable. Please provide an MWE
[1] ;).

I put the MWE here, which is basically this example [1] but viscosity,
fluid density, and heat capacity are reduced to match those of gas. I
also reduced the time step from 1e-4 to 1e-6. If you run this MWE, you
see that both fluid and solid temperature go up to 1e200 after afew
timesteps.

> I am happy to answer this question but please open a separate thread. 
Sorry, I will open another question

[1] https://gitlab.com/yade-
dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

from yade import pack, ymport
from yade import timing
import numpy as np
import shutil
num_spheres=1000# number of spheres
young=1e9
rad=0.003

mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05) # corners of the initial
packing

thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity

identifier = '-flowScenario'

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp = O.bodies.append(ymport.textExt('5cmEdge_1mm.spheres',
'x_y_z_r',color=(0.1,0.1,0.9), material='spheres'))

print('num bodies ', len(O.bodies))

triax=TriaxialStressController(
maxMultiplier=1.+2e4/young, 
finalMaxMultiplier=1.+2e3/young, 
thickness = 0,
stressMask = 7,
internalCompaction=True,
)

ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,

newton
]

#goal = -1e5
#triax.goal1=triax.goal2=triax.goal3=goal

for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

flow.dead=0
flow.defTolerance=-1 #0.3
flow.meshUpdateInterval=-1
flow.useSolver=4
flow.permeabilityFactor= 1
flow.viscosity= 0.00013#0.001
flow.bndCondIsPressure=[1,1,0,0,0,0]
flow.bndCondValue=[10,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 0.013#997
flow.fluidCp = 1996#4181.7
flow.getCHOLMODPerfTimings=True
flow.bndCondIsTemperature=[1,0,0,0,0,0]
flow.thermalEngine=True
flow.thermalBndCondValue=[343.15,0,0,0,0,0]
flow.tZero=t0
flow.pZero=0
flow.maxKdivKmean=1
flow.minKdivmean=0.0001;


thermal.dead=0
thermal.debug=False
thermal.fluidConduction=True
thermal.ignoreFictiousConduction=True
thermal.conduction=True
thermal.thermoMech=False
thermal.solidThermoMech = False
thermal.fluidThermoMech = False
thermal.advection=True
thermal.bndCondIsTemperature=[0,0,0,0,0,0]
thermal.thermalBndCondValue=[0,0,0,0,0,0]
thermal.fluidK = 0.6069 #0.650
thermal.fluidConductionAreaFactor=1.
thermal.particleT0 = t0
thermal.particleDensity=2600.
thermal.particleK = thermalCond
thermal.particleCp = heatCap
thermal.useKernMethod=True
#thermal.useHertzMethod=False
timing.reset()

O.dt=0.1e-5#0.1e-3
O.dynDt=False

O.run(1,1)
flow.dead=0

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
print('found closest body ', cBody.id, ' at ', cBody.state.pos)
return cBody

#bodyOfInterest = bodyByPos(15.998e-3,0.0230911,19.5934e-3)
bodyOfInterest = bodyByPos(0.025,0.025,0.025)

# find 10 bodies along x axis
axis = np.linspace(mn[0], mx[0], num=5)
axisBodies = [None] * len(axis)
axisTrue = np.zeros(len(axis))
for i,x in enumerate(axis):
axisBodies[i] = bodyByPos(x, mx[1]/2, mx[2]/2)
axisTrue[i] = axisBodies[i].state.pos[0]

print("found body of interest at", bodyOfInterest.state.pos)

from yade i

Re: [Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-14 Thread Zoheir Khademian
Question #695542 on Yade changed:
https://answers.launchpad.net/yade/+question/695542

Description changed to:
I am trying to simulate advection with a hot gas flowing though a cold packing. 
I used this example [1] and only modified the fluid properties to represent 
vapor. I used fluid density of 0.013 kg/m3 and heat capacity of 1996 J/kgK and 
viscosity of 0.00013 pa.s. The problem is the model becomes unstable. 
I reduced the timestep by two orders of magnitude and still no luck. So, I was 
wondering if there is any other parameters I should modify to make the model 
stable. 

One more question: How can I specify different thermal properties (like
conductivity) to different spheres in the model?

Thanks - Zoheir

[1] https://gitlab.com/yade-
dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-14 Thread Zoheir Khademian
Question #695542 on Yade changed:
https://answers.launchpad.net/yade/+question/695542

Description changed to:
I am trying to simulate advection with a hot gas flowing though a cold packing. 
I used this example [1] and only modified the fluid properties to represent 
vapor. I used fluid density of 0.013 kg/m3 and heat capacity of 1996 J/kgK and 
viscosity of 0.00013 pa.s. The model becomes unstable. 
I reduced the timestep by two orders of magnitude and still no luck. So, I was 
wondering if there is any other parameters I should modify to make the model 
stable. 

One more question: How can I specify different thermal properties (like
conductivity) to different spheres in the model?

Thanks - Zoheir

[1] https://gitlab.com/yade-
dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #695542]: Unstable advection simulaton for gas flow

2021-02-14 Thread Zoheir Khademian
New question #695542 on Yade:
https://answers.launchpad.net/yade/+question/695542

I am trying to simulate advection with a hot gas flowing though a cold packing. 
I used this example [1] and only modified the fluid properties to represent 
vapor. I used fluid density of 0.013 kg/m3 and heat capacity of 1996 J/kgK and 
viscosity of 0.00013 pa.s. The model becomes unstable. 
I reduced the timestep by two orders of magnitude and still no luck. So, I was 
wondering if there is any other parameters I should modify to make the model 
stable.

Thanks - Zoheir

[1] 
https://gitlab.com/yade-dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-25 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Zoheir Khademian posted a new comment:
> You are describing a lot of things that are not represented in your
MWE. So perhaps your implentation is wrong. No way to know without an
MWE: it would just be pure speculation for me to comment on this.

This is a fair point. I will make a more representative MWE and post it
here.

Thanks, Robert

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-25 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Zoheir Khademian posted a new comment:
Hi Robert,

> TwoPhaseFlowEngine.minimumPorosity, that you are referencing, is part
of TwoPhaseFlowEngine, not ThermalEngine. So it will not change your
results.

The documentation says the minimumPorosity [1] is also included in the
flowEngine [2] and apparently it makes the model stable at the beginning
although after a while it gets unstable again.

- Thanks for the offer for including alpha boundary in the
ThermalEngine. I will get back to you on that.

 I should also clarify two points: 
- When I remove the bonds between my grains (clusters of spheres) and compact 
my sample in a cube, TH (thermo-hydro) analysis works just fine. I guess this 
is because the packing is normal (cubic) in this case and boundaries are pretty 
smooth due to the fact that clusters are dissembled and I am left with a 
packing of poly-disperse spheres instead of a packing of irregular-shaped, 
bonded grains.

- If I dont remove the bonds between my grains but still compact them in
a cube, the packing is normal but the TH analysis gets unstable. This
may be because the boundaries are not as smooth as the first case, owing
to the irregularity in the shape of my bonded grains. Solving this case
is what I am looking for.

Do you think alpha boundary can solve the issue in the second case?

Thanks for the help,


[1] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngine.minimumPorosity

[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngine

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-24 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hey Robert,

Sorry for deviating from the forum rules again. Will make sure to follow
them in the future.

I tried a normal shape packing and all works just fine but for the
problem I am studying I have irregular-shape grains and the boundaries
cannot be really smooth or normal. I tired limiting the minimum porosity
to 0.01 by [1]. By doing this, temperatures start updating at the
beginning very nicely but after a few timestep,  it gets unstable and
temps keep rising indefinitely. I tried reducing timesteps but the same
issue repeated. Can you think of any other way around except for making
boundaries normal?

Thanks,

[1] https://yade-
dem.org/doc/yade.wrapper.html#yade.wrapper.TwoPhaseFlowEngine.minimumPorosity

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Description changed to:
Hello,

I am trying to run a TH analysis with warm fluid going through a cold
pack of polydisperse particles using the provided example in [1].

When I use a previously compacted, poly-disperse-particle sample for
this analysis, the temperature of all particles remains constant at
first and then turns to "nan". I was wondering what needs to be adjusted
in the thermal and flow engines following the features of the granular
sample  under study.


[1] 
https://gitlab.com/yade-dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

The MWE follows:

Thanks - Zoheir

from yade import pack, ymport
from yade import timing
import numpy as np
import shutil

young=1e9
rad=0.003


mn,mx=Vector3(0.0005944,0.0005596,0.00099759),Vector3(0.00119,0.00119,0.0016) # 
corners of the initial packing
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity


O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

#sp = O.bodies.append(ymport.textExt('ShCube', 'x_y_z_r',color=(0.1,0.1,0.9), 
material='spheres'))
O.bodies.append([
sphere((0.000945595,0.000784186,0.00149986),0.875846,material='spheres'),
sphere((0.000778022,0.000753066,0.00145943),0.875846,material='spheres'),
sphere((0.000888722,0.000810072,0.00133622),0.875846,material='spheres'),
sphere((0.000903823,0.000647224,0.00139896),0.875846,material='spheres'),
sphere((0.00105629,0.000841192,0.00137666),0.875846,material='spheres'),
sphere((0.00101452,0.00070423,0.00127576),0.875846,material='spheres'),
sphere((0.00084695,0.00067311,0.00123532),0.875846,material='spheres'),
sphere((0.000999422,0.000867078,0.00121301),0.875846,material='spheres'),
sphere((0.00103358,0.00108745,0.0011483),0.815788,material='spheres'),
sphere((0.000902032,0.00103675,0.00153707),0.735711,material='spheres'),
sphere((0.000986413,0.00091621,0.00153692),0.735711,material='spheres'),
sphere((0.00111325,0.000915283,0.00146233),0.735711,material='spheres'),
sphere((0.00108202,0.000666186,0.00154242),0.665643,material='spheres'),
sphere((0.00111005,0.000740653,0.00132599),0.665643,material='spheres'),
sphere((0.00080908,0.00109404,0.0014756),0.499888,material='spheres'),
sphere((0.000751015,0.00103522,0.00153186),0.499888,material='spheres'),
sphere((0.000670623,0.00108745,0.00150348),0.499888,material='spheres'),
sphere((0.000687866,0.00108202,0.00126569),0.459731,material='spheres'),
sphere((0.000703081,0.00107221,0.00135584),0.459731,material='spheres'),
sphere((0.00110443,0.00083307,0.00156066),0.420579,material='spheres'),
sphere((0.00112293,0.000765198,0.00151454),0.420579,material='spheres'),
sphere((0.00106475,0.000819695,0.0014877),0.420579,material='spheres'),
sphere((0.0011389,0.000814544,0.00144832),0.420579,material='spheres'),
sphere((0.00112143,0.000746581,0.00109922),0.439814,material='spheres'),
sphere((0.00105308,0.000800634,0.0023),0.439814,material='spheres'),
sphere((0.00110668,0.000870009,0.00110401),0.439814,material='spheres'),
sphere((0.00112389,0.000807084,0.00116302),0.439814,material='spheres'),
sphere((0.00103833,0.000924061,0.00111603),0.439814,material='spheres'),
sphere((0.000792443,0.000977976,0.00151641),0.220555,material='spheres'),
sphere((0.000760407,0.000979304,0.00148612),0.220555,material='spheres'),
sphere((0.000836178,0.000937735,0.0014684),0.220555,material='spheres'),
sphere((0.000775855,0.00092188,0.00146726),0.220555,material='spheres'),
sphere((0.000798293,0.000958519,0.00147726),0.220555,material='spheres'),
sphere((0.00073797,0.000942664,0.00147612),0.220555,material='spheres'),
sphere((0.000766257,0.000959847,0.00144696),0.220555,material='spheres'),
sphere((0.000728372,0.000980632,0.00145582),0.220555,material='spheres'),
sphere((0.00081374,0.000901096,0.0014584),0.220555,material='spheres'),
sphere((0.000842027,0.000918279,0.00142924),0.220555,material='spheres'),
sphere((0.000781704,0.000902424,0.00142811),0.220555,material='spheres'),
sphere((0.000804142,0.000939063,0.0014381),0.220555,material='spheres'),
sphere((0.000772106,0.000940391,0.00140781),0.220555,material='spheres'),
sphere((0.000734221,0.000961175,0.00141667),0.220555,material='spheres'),
sphere((0.000809991,0.000919607,0.00139895),0.220555,material='spheres'),
sphere((0.00113905,0.00100891,0.00119864),0.235576,material='spheres'),
sphere((0.000698534,0.000815074,0.00126433),0.765702,material='spheres'),

Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Zoheir Khademian gave more information on the question:
Sorry for the confusion.

The script [1] works perfectly but when I replace the packing with my
own packing, the body temperatures do not get calculated ("nan").

Comparing to [1], I changed the wall dimensions to fit the sample and
removed post-processing fictions ("pressureField" and "endFlux") .

Thanks for the help

Zoheir

[1] https://gitlab.com/yade-
dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Description changed to:
Hello,

I am trying to run a TH analysis with warm fluid going through a cold
pack of polydisperse particles using the provided example in [1].

When I use a previously compacted, poly-disperse-particle sample for
this analysis, the temperature of all particles remains constant at
first and then turns to "nan". I was wondering what needs to be adjusted
in the thermal and flow engines following the features of the granular
sample  under study.


[1] 
https://gitlab.com/yade-dev/trunk/-/blob/master/examples/ThermalEngine/flowScenario.py

The MWE follows:

Thanks - Zoheir

from yade import pack, ymport
from yade import timing
import numpy as np
import shutil

young=1e9
rad=0.003


mn,mx=Vector3(0.0005944,0.0005596,0.00099759),Vector3(0.00119,0.00119,0.0016) # 
corners of the initial packing
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity


O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

#sp = O.bodies.append(ymport.textExt('ShCube', 'x_y_z_r',color=(0.1,0.1,0.9), 
material='spheres'))
O.bodies.append([
sphere((0.000945595,0.000784186,0.00149986),0.875846),
sphere((0.000778022,0.000753066,0.00145943),0.875846),
sphere((0.000888722,0.000810072,0.00133622),0.875846),
sphere((0.000903823,0.000647224,0.00139896),0.875846),
sphere((0.00105629,0.000841192,0.00137666),0.875846),
sphere((0.00101452,0.00070423,0.00127576),0.875846),
sphere((0.00084695,0.00067311,0.00123532),0.875846),
sphere((0.000999422,0.000867078,0.00121301),0.875846),
sphere((0.00103358,0.00108745,0.0011483),0.815788),
sphere((0.000902032,0.00103675,0.00153707),0.735711),
sphere((0.000986413,0.00091621,0.00153692),0.735711),
sphere((0.00111325,0.000915283,0.00146233),0.735711),
sphere((0.00108202,0.000666186,0.00154242),0.665643),
sphere((0.00111005,0.000740653,0.00132599),0.665643),
sphere((0.00080908,0.00109404,0.0014756),0.499888),
sphere((0.000751015,0.00103522,0.00153186),0.499888),
sphere((0.000670623,0.00108745,0.00150348),0.499888),
sphere((0.000687866,0.00108202,0.00126569),0.459731),
sphere((0.000703081,0.00107221,0.00135584),0.459731),
sphere((0.00110443,0.00083307,0.00156066),0.420579),
sphere((0.00112293,0.000765198,0.00151454),0.420579),
sphere((0.00106475,0.000819695,0.0014877),0.420579),
sphere((0.0011389,0.000814544,0.00144832),0.420579),
sphere((0.00112143,0.000746581,0.00109922),0.439814),
sphere((0.00105308,0.000800634,0.0023),0.439814),
sphere((0.00110668,0.000870009,0.00110401),0.439814),
sphere((0.00112389,0.000807084,0.00116302),0.439814),
sphere((0.00103833,0.000924061,0.00111603),0.439814),
sphere((0.000792443,0.000977976,0.00151641),0.220555),
sphere((0.000760407,0.000979304,0.00148612),0.220555),
sphere((0.000836178,0.000937735,0.0014684),0.220555),
sphere((0.000775855,0.00092188,0.00146726),0.220555),
sphere((0.000798293,0.000958519,0.00147726),0.220555),
sphere((0.00073797,0.000942664,0.00147612),0.220555),
sphere((0.000766257,0.000959847,0.00144696),0.220555),
sphere((0.000728372,0.000980632,0.00145582),0.220555),
sphere((0.00081374,0.000901096,0.0014584),0.220555),
sphere((0.000842027,0.000918279,0.00142924),0.220555),
sphere((0.000781704,0.000902424,0.00142811),0.220555),
sphere((0.000804142,0.000939063,0.0014381),0.220555),
sphere((0.000772106,0.000940391,0.00140781),0.220555),
sphere((0.000734221,0.000961175,0.00141667),0.220555),
sphere((0.000809991,0.000919607,0.00139895),0.220555),
sphere((0.00113905,0.00100891,0.00119864),0.235576),
sphere((0.000698534,0.000815074,0.00126433),0.765702),
sphere((0.000695882,0.00071517,0.00138037),0.765702),
sphere((0.000670978,0.000701228,0.00116568),0.765702),
sphere((0.000683566,0.000664341,0.00153398),0.481936),
sphere((0.00113412,0.000910585,0.00138428),0.40366),
sphere((0.00112752,0.00102435,0.0013913),0.40366),
sphere((0.0011135,0.000914201,0.0013063),0.40366),
sphere((0.00100741,0.000944425,0.00133576),0.40366),
sphere((0.00108155,0.000966389,0.00135897),0.40366),
sphere((0.0011069,0.00102797,0.00131333),0.40366),
sphere((0.00102898,0.00102219,0.00133366),0.40366),
sphere((0.00107495,0.00108015,0.00136599),0.40366),
sphere((0.00112847,0.00110573,0.00131123),0.40366),
sphere((0.00113885,0.000975778,0.00126066),0.40366),
sphere((0.00106093,0.000970005,0.001281),0.40366),
sphere((0.00105433,0.00108377,0.00128802),0.40366),

Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Description changed to:
Hello,

I am trying to run a TH analysis with warm fluid going through a cold
pack of polydisperse particles using the provided example in [1].

When I use a previously compacted, poly-disperse-particle sample for
this analysis, the temperature of all particles remains constant at
first and then turns to "nan". I was wondering what needs to be adjusted
in the thermal and flow engines following the features of the granular
sample  under study.


[1] 
https://gitlab.com/yade-dev/trunk/-/commit/f0c96c63937a666d1fa1529173b554ac74b04456

The MWE follows:

Thanks - Zoheir

from yade import pack, ymport
from yade import timing
import numpy as np
import shutil

young=1e9
rad=0.003


mn,mx=Vector3(0.0005944,0.0005596,0.00099759),Vector3(0.00119,0.00119,0.0016) # 
corners of the initial packing
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity


O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

#sp = O.bodies.append(ymport.textExt('ShCube', 'x_y_z_r',color=(0.1,0.1,0.9), 
material='spheres'))
O.bodies.append([
sphere((0.000945595,0.000784186,0.00149986),0.875846),
sphere((0.000778022,0.000753066,0.00145943),0.875846),
sphere((0.000888722,0.000810072,0.00133622),0.875846),
sphere((0.000903823,0.000647224,0.00139896),0.875846),
sphere((0.00105629,0.000841192,0.00137666),0.875846),
sphere((0.00101452,0.00070423,0.00127576),0.875846),
sphere((0.00084695,0.00067311,0.00123532),0.875846),
sphere((0.000999422,0.000867078,0.00121301),0.875846),
sphere((0.00103358,0.00108745,0.0011483),0.815788),
sphere((0.000902032,0.00103675,0.00153707),0.735711),
sphere((0.000986413,0.00091621,0.00153692),0.735711),
sphere((0.00111325,0.000915283,0.00146233),0.735711),
sphere((0.00108202,0.000666186,0.00154242),0.665643),
sphere((0.00111005,0.000740653,0.00132599),0.665643),
sphere((0.00080908,0.00109404,0.0014756),0.499888),
sphere((0.000751015,0.00103522,0.00153186),0.499888),
sphere((0.000670623,0.00108745,0.00150348),0.499888),
sphere((0.000687866,0.00108202,0.00126569),0.459731),
sphere((0.000703081,0.00107221,0.00135584),0.459731),
sphere((0.00110443,0.00083307,0.00156066),0.420579),
sphere((0.00112293,0.000765198,0.00151454),0.420579),
sphere((0.00106475,0.000819695,0.0014877),0.420579),
sphere((0.0011389,0.000814544,0.00144832),0.420579),
sphere((0.00112143,0.000746581,0.00109922),0.439814),
sphere((0.00105308,0.000800634,0.0023),0.439814),
sphere((0.00110668,0.000870009,0.00110401),0.439814),
sphere((0.00112389,0.000807084,0.00116302),0.439814),
sphere((0.00103833,0.000924061,0.00111603),0.439814),
sphere((0.000792443,0.000977976,0.00151641),0.220555),
sphere((0.000760407,0.000979304,0.00148612),0.220555),
sphere((0.000836178,0.000937735,0.0014684),0.220555),
sphere((0.000775855,0.00092188,0.00146726),0.220555),
sphere((0.000798293,0.000958519,0.00147726),0.220555),
sphere((0.00073797,0.000942664,0.00147612),0.220555),
sphere((0.000766257,0.000959847,0.00144696),0.220555),
sphere((0.000728372,0.000980632,0.00145582),0.220555),
sphere((0.00081374,0.000901096,0.0014584),0.220555),
sphere((0.000842027,0.000918279,0.00142924),0.220555),
sphere((0.000781704,0.000902424,0.00142811),0.220555),
sphere((0.000804142,0.000939063,0.0014381),0.220555),
sphere((0.000772106,0.000940391,0.00140781),0.220555),
sphere((0.000734221,0.000961175,0.00141667),0.220555),
sphere((0.000809991,0.000919607,0.00139895),0.220555),
sphere((0.00113905,0.00100891,0.00119864),0.235576),
sphere((0.000698534,0.000815074,0.00126433),0.765702),
sphere((0.000695882,0.00071517,0.00138037),0.765702),
sphere((0.000670978,0.000701228,0.00116568),0.765702),
sphere((0.000683566,0.000664341,0.00153398),0.481936),
sphere((0.00113412,0.000910585,0.00138428),0.40366),
sphere((0.00112752,0.00102435,0.0013913),0.40366),
sphere((0.0011135,0.000914201,0.0013063),0.40366),
sphere((0.00100741,0.000944425,0.00133576),0.40366),
sphere((0.00108155,0.000966389,0.00135897),0.40366),
sphere((0.0011069,0.00102797,0.00131333),0.40366),
sphere((0.00102898,0.00102219,0.00133366),0.40366),
sphere((0.00107495,0.00108015,0.00136599),0.40366),
sphere((0.00112847,0.00110573,0.00131123),0.40366),
sphere((0.00113885,0.000975778,0.00126066),0.40366),
sphere((0.00106093,0.000970005,0.001281),0.40366),
sphere((0.00105433,0.00108377,0.00128802),0.40366),

Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Thanks, Robert. I revised the question following the forum code.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
Question #695065 on Yade changed:
https://answers.launchpad.net/yade/+question/695065

Description changed to:
Hello,

I am trying to run a TH analysis with warm fluid going through a cold
pack of polydisperse particles using the provided example in [1].

When I use a previously compacted, poly-disperse-particle sample for
this analysis, the temperature of all particles remains constant at
first and then turns to "nan". I was wondering what needs to be adjusted
in the thermal and flow engines following the features of the granular
sample  under study.


[1] 
https://gitlab.com/yade-dev/trunk/-/commit/f0c96c63937a666d1fa1529173b554ac74b04456

The MWE follows:

Thanks - Zoheir

from yade import pack, ymport
from yade import timing
import numpy as np
import shutil

young=1e9
rad=0.003


mn,mx=Vector3(0.0005944,0.0005596,0.00099759),Vector3(0.00119,0.00119,0.0016) # 
corners of the initial packing
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity


O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

#sp = O.bodies.append(ymport.textExt('ShCube', 'x_y_z_r',color=(0.1,0.1,0.9), 
material='spheres'))
O.bodies.append([
sphere((0.000945595,0.000784186,0.00149986),0.875846),
sphere((0.000778022,0.000753066,0.00145943),0.875846),
sphere((0.000888722,0.000810072,0.00133622),0.875846),
sphere((0.000903823,0.000647224,0.00139896),0.875846),
sphere((0.00105629,0.000841192,0.00137666),0.875846),
sphere((0.00101452,0.00070423,0.00127576),0.875846),
sphere((0.00084695,0.00067311,0.00123532),0.875846),
sphere((0.000999422,0.000867078,0.00121301),0.875846),
sphere((0.00103358,0.00108745,0.0011483),0.815788),
sphere((0.000902032,0.00103675,0.00153707),0.735711),
sphere((0.000986413,0.00091621,0.00153692),0.735711),
sphere((0.00111325,0.000915283,0.00146233),0.735711),
sphere((0.00108202,0.000666186,0.00154242),0.665643),
sphere((0.00111005,0.000740653,0.00132599),0.665643),
sphere((0.00080908,0.00109404,0.0014756),0.499888),
sphere((0.000751015,0.00103522,0.00153186),0.499888),
sphere((0.000670623,0.00108745,0.00150348),0.499888),
sphere((0.000687866,0.00108202,0.00126569),0.459731),
sphere((0.000703081,0.00107221,0.00135584),0.459731),
sphere((0.00110443,0.00083307,0.00156066),0.420579),
sphere((0.00112293,0.000765198,0.00151454),0.420579),
sphere((0.00106475,0.000819695,0.0014877),0.420579),
sphere((0.0011389,0.000814544,0.00144832),0.420579),
sphere((0.00112143,0.000746581,0.00109922),0.439814),
sphere((0.00105308,0.000800634,0.0023),0.439814),
sphere((0.00110668,0.000870009,0.00110401),0.439814),
sphere((0.00112389,0.000807084,0.00116302),0.439814),
sphere((0.00103833,0.000924061,0.00111603),0.439814),
sphere((0.000792443,0.000977976,0.00151641),0.220555),
sphere((0.000760407,0.000979304,0.00148612),0.220555),
sphere((0.000836178,0.000937735,0.0014684),0.220555),
sphere((0.000775855,0.00092188,0.00146726),0.220555),
sphere((0.000798293,0.000958519,0.00147726),0.220555),
sphere((0.00073797,0.000942664,0.00147612),0.220555),
sphere((0.000766257,0.000959847,0.00144696),0.220555),
sphere((0.000728372,0.000980632,0.00145582),0.220555),
sphere((0.00081374,0.000901096,0.0014584),0.220555),
sphere((0.000842027,0.000918279,0.00142924),0.220555),
sphere((0.000781704,0.000902424,0.00142811),0.220555),
sphere((0.000804142,0.000939063,0.0014381),0.220555),
sphere((0.000772106,0.000940391,0.00140781),0.220555),
sphere((0.000734221,0.000961175,0.00141667),0.220555),
sphere((0.000809991,0.000919607,0.00139895),0.220555),
sphere((0.00113905,0.00100891,0.00119864),0.235576),
sphere((0.000698534,0.000815074,0.00126433),0.765702),
sphere((0.000695882,0.00071517,0.00138037),0.765702),
sphere((0.000670978,0.000701228,0.00116568),0.765702),
sphere((0.000683566,0.000664341,0.00153398),0.481936),
sphere((0.00113412,0.000910585,0.00138428),0.40366),
sphere((0.00112752,0.00102435,0.0013913),0.40366),
sphere((0.0011135,0.000914201,0.0013063),0.40366),
sphere((0.00100741,0.000944425,0.00133576),0.40366),
sphere((0.00108155,0.000966389,0.00135897),0.40366),
sphere((0.0011069,0.00102797,0.00131333),0.40366),
sphere((0.00102898,0.00102219,0.00133366),0.40366),
sphere((0.00107495,0.00108015,0.00136599),0.40366),
sphere((0.00112847,0.00110573,0.00131123),0.40366),
sphere((0.00113885,0.000975778,0.00126066),0.40366),
sphere((0.00106093,0.000970005,0.001281),0.40366),
sphere((0.00105433,0.00108377,0.00128802),0.40366),

[Yade-users] [Question #695065]: ThermoHydro analyses

2021-01-18 Thread Zoheir Khademian
New question #695065 on Yade:
https://answers.launchpad.net/yade/+question/695065

Hello,

I am trying to run a TH analysis with warm fluid going through a cold pack of 
polydisperse particles using the provided example in [1]. 

When I use a previously compacted, poly-disperse-particle sample for this 
analysis, the temperature of all particles remains constant at first and then 
turns to "nan". I was wondering what needs to be adjusted in the thermal and 
flow engines following the features of the granular sample  under study. The 
compacted sample can be found here:
https://drive.google.com/file/d/1Bg-TxgnM4DNe_7t8_QOghIxuspoZiY5T/view?usp=sharing

[1] 
https://gitlab.com/yade-dev/trunk/-/commit/f0c96c63937a666d1fa1529173b554ac74b04456

The MWE follows:

Thanks - Zoheir

###--TH analyses###
from yade import pack, ymport
from yade import timing
import numpy as np
import shutil

young=1e9
rad=0.003

mn,mx=Vector3(0.0003548178,0.0003386574,0.0007729061),Vector3(0.0014559856,0.0013972314,0.00188235628)
 # corners of the initial packing
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 333.15 #K

# micro properties
r = rad
k = 2.0   # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp = O.bodies.append(ymport.textExt('ShCube', 'x_y_z_r',color=(0.1,0.1,0.9), 
material='spheres'))


ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
newton
]


for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

flow.dead=0
flow.defTolerance=-1#0.3
flow.meshUpdateInterval=200
flow.useSolver=4
flow.permeabilityFactor= 1
flow.viscosity= 0.001
flow.bndCondIsPressure=[1,1,0,0,0,0]
flow.bndCondValue=[10,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 997
flow.fluidCp = 4181.7
flow.getCHOLMODPerfTimings=True
flow.bndCondIsTemperature=[1,0,0,0,0,0]
flow.thermalEngine=True
flow.thermalBndCondValue=[343.15,0,0,0,0,0]
flow.tZero=t0
flow.pZero=0
#flow.clampKValues=False
flow.maxKdivKmean=1
flow.minKdivmean=0.0001;


thermal.dead=0
thermal.debug=False
thermal.fluidConduction=True
thermal.ignoreFictiousConduction=False#True
#thermal.minimumFluidCondDist=1.89e-5
thermal.conduction=True
thermal.thermoMech=False
thermal.solidThermoMech = False
thermal.fluidThermoMech = False
thermal.advection=True
thermal.bndCondIsTemperature=[0,0,0,0,0,0]
thermal.thermalBndCondValue=[0,0,0,0,0,0]
thermal.fluidK = 0.6069#0.650
thermal.fluidConductionAreaFactor=1.
thermal.particleT0 = t0
thermal.particleDensity=2600.
thermal.particleK = thermalCond
thermal.particleCp = heatCap
thermal.useKernMethod=True
#thermal.useHertzMethod=False
timing.reset()

O.dt=0.1e-5
O.dynDt=False

O.run(1,1)
flow.dead=0

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
print('found closest body ', cBody.id, ' at ', cBody.state.pos)
return cBody
# Finding a body at the X flow boundary
bodyOfInterest = bodyByPos(0.00035,0.001,0.001)

from yade import plot
def history():
print(bodyOfInterest.state.temp)
plot.addData(
ftemp1=flow.getPoreTemperature((0.00035,0.001,0.001)),
t=O.time,
i = O.iter,
bodyOfIntTemp = O.bodies[bodyOfInterest.id].state.temp
)

O.engines=O.engines+[PyRunner(iterPeriod=5,command='history()',label='recorder')]

plot.plots={'t':(('ftemp1','k-'),('bodyOfIntTemp','r-'))} #
plot.plot()
O.saveTmp()
def ColorScaler():
for s in O.bodies:

s.shape.color=scalarOnColorScale(s.state.temp,333,343)

O.engines=O.engines+[PyRunner(command='ColorScaler()',iterPeriod=1)]
ColorScaler()

O.run(1000)


-- 
You received this question notification because your team yade-users is
an answer 

Re: [Yade-users] [Question #694506]: Removing particles during thermal cycling

2021-01-18 Thread Zoheir Khademian
Question #694506 on Yade changed:
https://answers.launchpad.net/yade/+question/694506

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
This solved my problem

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #694506]: Removing particles during thermal cycling

2020-12-14 Thread Zoheir Khademian
Question #694506 on Yade changed:
https://answers.launchpad.net/yade/+question/694506

Status: Answered => Open

Zoheir Khademian is still having a problem:
Robert, thank you so much for the quick reply. I truly appreciate it. I
will recompile it and report back to you after trying the MWE.

> updateTriangulation = 1 Does nothing inside yade. I will let you
brainstorm why that is the case and how to fix it.

Is it because I did not associate it with the engine? like: 
"flow.updateTriangulation=1"?
If so, Is "flow.updateTriangulation=1" the same as [1], using 
flow.meshUpdateInterval=1 after removing the particle and then return it to 
flow.meshUpdateInterval=-1?


[1] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngine.meshUpdateInterval

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #694506]: Removing particles during thermal cycling

2020-12-13 Thread Zoheir Khademian
New question #694506 on Yade:
https://answers.launchpad.net/yade/+question/694506

Hello All,

I would like to remove a particle from an assembly after a few 
Hydro-thermo-mechanical cycles (using thermal and flow engines) and then 
continue cycling the model.  After removing the particle, I enforce 
re-triangulation [1] and then use [2] but I get this error and Yade crushes 
once I continue running the model:

python3.6: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename 
boost::detail::sp_member_access::type boost::shared_ptr::operator->() 
const [with T = yade::Body; typename boost::detail::sp_member_access::type = 
yade::Body*]: Assertion `px != 0' failed.
Aborted (core dumped)

I am wondering what I am missing here and would appreciate your help.

Thanks

[1] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngineT.updateTriangulation
[2] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FlowEngine.emulateAction

Here is the MWE:

from yade import pack, ymport, plot, utils, export, timing
import numpy as np

young=5e6
mn,mx=Vector3(0,0,0),Vector3(0.05,0.05,0.05)
O.materials.append(FrictMat(young=young*100,poisson=0.5,frictionAngle=0,density=2600e10,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(30),density=2600e10,label='spheres'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)
sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=0.333,num=200,seed=11) 
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(
 maxMultiplier=1.+2e4/young,
 finalMaxMultiplier=1.+2e3/young,
 thickness = 0,
 stressMask = 7,
 internalCompaction=True,
)

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),
 triax,
 FlowEngine(dead=1,label="flow",multithread=False),
 ThermalEngine(dead=1,label='thermal'),
 NewtonIntegrator(damping=0.5)
]

O.step()
ss2sc.interactionDetectionFactor=-1
is2aabb.aabbEnlargeFactor=-1

tri_pressure = 1000
triax.goal1=triax.goal2=triax.goal3=-tri_pressure
triax.stressMask=7
while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(-tri_pressure-triax.meanStress)/tri_pressure<0.001:
break

triax.internalCompaction=False

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,10,10]

## Thermal Stuff
flow.bndCondIsTemperature=[0,0,0,0,0,0] 
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,0,0] 
flow.tZero=25

flow.dead=0
thermal.dead=1

thermal.conduction=True
thermal.fluidConduction=True
thermal.debug=0
thermal.thermoMech=True
thermal.solidThermoMech = True
thermal.fluidThermoMech = True
thermal.advection=True
thermal.useKernMethod=False
thermal.bndCondIsTemperature=[0,0,0,0,0,1]
thermal.thermalBndCondValue=[0,0,0,0,0,45]
thermal.fluidK = 0.650
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 =10
thermal.minimumThermalCondDist=0


timing.reset()
O.dt=1e-4
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(0.025,0.025,0.025)


from yade import plot

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,
)


O.engines=O.engines+[PyRunner(iterPeriod=200,command='history()',label='recorder')]

plot.plots={'t':(('ftemp1','k-'),('bodyOfIntTemp','r-'))} 

plot.plot(subPlots=False)
O.run(5,1)

#Removing one particle
Removedbody = bodyByPos(0.,0.,0.)
O.bodies.erase(Removedbody.id)
updateTriangulation=1
O.run()


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : 

Re: [Yade-users] [Question #693739]: Energy conservation in thermal and flow Engines

2020-11-02 Thread Zoheir Khademian
Question #693739 on Yade changed:
https://answers.launchpad.net/yade/+question/693739

Zoheir Khademian posted a new comment:
Hi Robert,

Thanks for the response.

>You should be able to verify this by running your model with
thermal.fluidConduction=False. If my suspicion is correct, you should
end up with consistent numbers.

Yes, I tried it and the numbers are the same, meaning the fluid
conduction is not implemented in the thermal flux calculation in
thermalBndFlux [1].

[1]https://yade-
dem.org/doc/yade.wrapper.html#yade.wrapper.ThermalEngine.thermalBndFlux

>As for adding the fluidConduction flux to the total thermalBndFlux, it
will need to be done through the source, I will have a look today and
try to make a merge request for you.

Thanks and looking forward to it

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #693739]: Energy conservation in thermal and flow Engines

2020-10-30 Thread Zoheir Khademian
New question #693739 on Yade:
https://answers.launchpad.net/yade/+question/693739

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(0,0,0),Vector3(0.1,0.1,0.1)


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'))


walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.0015,rRelFuzz=0.333,num=400,seed=11) 
sp.toSimulation(color=(0.752, 0.752, 0.752),material='spheres')

triax=TriaxialStressController(
 maxMultiplier=1.+2e4/young,
 finalMaxMultiplier=1.+2e3/young,
 thickness = 0,
 stressMask = 7,
 internalCompaction=True,
)

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),
 triax,
 FlowEngine(dead=1,label="flow",multithread=False),
 ThermalEngine(dead=1,label='thermal'),
 NewtonIntegrator(damping=0.5)
]

O.step()

ss2sc.interactionDetectionFactor=-1# double check
is2aabb.aabbEnlargeFactor=-1#double check

tri_pressure = 1000
triax.goal1=triax.goal2=triax.goal3=-tri_pressure
triax.stressMask=7
while 1:
  O.run(1000, True)
  unb=unbalancedForce()
  print('unbalanced force:',unb,' mean stress: ',triax.meanStress)
  if unb<0.1 and abs(-tri_pressure-triax.meanStress)/tri_pressure<0.001:
break

triax.internalCompaction=False
#-
for b in O.bodies:
if isinstance(b.shape, Sphere): 
b.dynamic=False # mechanically static

#-
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#for calculating or assigning conductivity; 
negetive allows you to assign conductivity
flow.viscosity= 0.001
flow.decoupleForces =  False# double check
flow.bndCondIsPressure=[0,0,0,0,0,0]
flow.bndCondValue=[0,0,0,0,0,0]

## Thermal Stuff
flow.bndCondIsTemperature=[0,0,0,0,0,1] 
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,0,25] 
flow.tZero=t0

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,0,1]
thermal.thermalBndCondValue=[0,0,0,0,0,25]
thermal.fluidK = 0.650
thermal.fluidBeta = 2e-5 # 0.0002
thermal.particleT0 = t0
thermal.particleK = 2.0
thermal.particleCp = 710
thermal.particleAlpha = 3.0e-5
thermal.particleDensity = 2600.
thermal.tsSafetyFactor = 0 #0.01
thermal.uniformReynolds =10
thermal.minimumThermalCondDist=0
#-

timing.reset()
O.dt=1.
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(0.025,0.025,0.025)
#-
from yade import plot

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,
)


O.engines=O.engines+[PyRunner(iterPeriod=200,command='history()',label='recorder')]



plot.plots={'t':(('ftemp1','k-'),('bodyOfIntTemp','r-'))} 

plot.plot(subPlots=False)
def ColorScaler():
for s in 

Re: [Yade-users] [Question #692174]: Thermal conduction in clumps

2020-08-04 Thread Zoheir Khademian
Question #692174 on Yade changed:
https://answers.launchpad.net/yade/+question/692174

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thanks, Robert

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #692174]: Thermal conduction in clumps

2020-08-03 Thread Zoheir Khademian
Question #692174 on Yade changed:
https://answers.launchpad.net/yade/+question/692174

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hi Robert and thanks for the reference and explanation.

 I would like to model a soil grain as an assembly of spheres and study
thermal-mechanical characteristics of the modeled soil. Using a cluster
of spheres bonded together as an agglomerate works well but is
computationally expensive. So, generating a clump representing a grain
can be a good alternative.  Please let me know of  any better
alternatives you can think of.

So based on your response, clumps cannot transfer heat between their members 
but can be homogeneously heated. 
In the code I posted, only the clump member that is in contact with the 400K  
stand-alone sphere shows temperature change and the rest stay at 100K.

So I guess my question is if clumps are meant to behave  homogeneously
in both mechanical and thermal modes, why only one member is heated and
the rest stay at 100K? Am I missing something in the thermal engine?


Thanks

Zoheir

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #692174]: Thermal conduction in clumps

2020-08-01 Thread Zoheir Khademian
New question #692174 on Yade:
https://answers.launchpad.net/yade/+question/692174

Hello

I am trying to use the thermal conduction scheme in clump particles. I have a 
column of 6 spheres. The top  sphere is stand alone with 400 K fixed 
temperature boundary condition but the remaining 5 spheres make up two clumps 
with initial temperature of 100 K. When running the model, heat is transferred 
from the top sphere to its neighboring sphere belonging to a clump. However, 
there is no conduction within the clump itself so the rest of spheres in the 
model remain at 100 K temperature. 

My question is how to get the thermal engine to conduct heat within clumps 
themselves? Here is the code:

from yade import pack
from numpy import arange
import itertools
import random
import numpy as np
import shutil
from yade import plot
thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 100. #K
rad=0.003
intRadius=1

mn,mx=Vector3(0,0,0),Vector3(0.01,0.01,0.06) # corners of the initial packing

O.materials.append(FrictMat(young=6e6,poisson=.4,frictionAngle=0,density=2600,label='frictionless'))

walls=aabbWalls([mn,mx],material='frictionless')
wallIds=O.bodies.append(walls)

SPack=pack.regularOrtho(pack.inAlignedBox(mn,mx),radius=rad,gap=-1.e-5,material='frictionless')
O.bodies.appendClumped([SPack[0],SPack[1]])
O.bodies.appendClumped([SPack[2],SPack[3],SPack[4]])
O.bodies.append([SPack[5]])


ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(damping=0.2)
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.1),
newton
]
for o in O.bodies:
o.dynamic=False

flow.dead=0
flow.defTolerance=0.3#-1 #
flow.meshUpdateInterval=200#-1 
flow.useSolver=4
flow.permeabilityFactor=-0.7e-7 #1
flow.viscosity=10
flow.bndCondIsPressure=[0,0,0,0,0,0]
flow.bndCondValue=[0,0,0,0,0,0]
flow.boundaryUseMaxMin=[0,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 1000
flow.fluidCp = 4184
flow.fluidK = 0.650
flow.bndCondIsTemperature=[0,0,0,0,0,1]
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,0,400]

flow.tZero=t0
flow.pZero=0
thermal.dead=0
thermal.conduction=True
thermal.thermoMech=False
thermal.advection=False
thermal.fluidThermoMech = False
thermal.solidThermoMech = False
thermal.fluidConduction= False

thermal.bndCondIsTemperature=[0,0,0,0,0,1]
thermal.thermalBndCondValue=[0,0,0,0,0,400]
thermal.tsSafetyFactor=0
thermal.particleDensity=2600
thermal.particleT0=t0
thermal.particleCp=heatCap
thermal.particleK=thermalCond
thermal.particleAlpha =11.6e-3
thermal.useKernMethod=False

flow.updateTriangulation=True

O.run(1,1)
flow.dead=1

def ColorScaler():
for s in O.bodies:
s.shape.color=scalarOnColorScale(s.state.temp,100,400)

O.engines=O.engines+[PyRunner(command='ColorScaler()',iterPeriod=100)]
def history():
plot.addData(
t=O.time,
i = O.iter,
Particle1 = SPack[0].state.temp,
Particle2 = SPack[1].state.temp,
Particle3 = SPack[2].state.temp,
Particle4 = SPack[3].state.temp,
Particle5 = SPack[4].state.temp,
Particle6 = SPack[5].state.temp,
)

O.engines=O.engines+[PyRunner(iterPeriod=500,command='history()',label='recorder')]
plot.plots={'t':(('Particle1','b-'),('Particle2','b--'),('Particle3','k-'),('Particle4','r-'),('Particle5','g-'),('Particle6','k--'))}
 #
#VTKrec.dead=0



plot.plot()

O.run(10,1)



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #691922]: Running thermal engine with different initial temperatures

2020-07-21 Thread Zoheir Khademian
Question #691922 on Yade changed:
https://answers.launchpad.net/yade/+question/691922

Status: Needs information => Solved

Zoheir Khademian confirmed that the question is solved:
Thank you Robert. I cleaned up the script and everything worked as
expected.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #691922]: Running thermal engine with different initial temperatures

2020-07-17 Thread Zoheir Khademian
Question #691922 on Yade changed:
https://answers.launchpad.net/yade/+question/691922

Status: Needs information => Open

Zoheir Khademian gave more information on the question:

Thanks Robert for the explanation.  I assigned temperature values of 700 for 
the right half and 100 for the left half of the pack as shown above.

When I run the script after initializing , the temperature of spheres
does not change as if there is no conduction between spheres. It seems I
am fixing the temperature but I only wanted to  initialize them and let
the model predict final temperature values. Am I missing some thing?Is
there a way to initialize temperature values instead of fixing them?

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #691922]: Running thermal engine with different initial temperatures

2020-07-17 Thread Zoheir Khademian
New question #691922 on Yade:
https://answers.launchpad.net/yade/+question/691922

I am trying to re-assign different temperature values after one cycle of 
thermal engine by "body.state.temp". However, the conduction scheme stops 
working and newly assigned body temperature does not change by the boundary 
conditions. Here is the script:

#*
#  Copyright (C) 2019 by Robert Caulk*
#  rob.ca...@gmail.com   *
#*
#  This program is free software; it is licensed under the terms of the  *
#  GNU General Public License v2 or later. See file LICENSE for details. *
#*/
#
# Script demonstrating the use of ThermalEngine by comparing conduction
# scheme to analytical solution to Fourier (rod cooling with constant 
# boundary conditions). See details in:
#
# Caulk, R., Scholtes, L., Kraczek, M., Chareyre, B. (In Print) A 
# pore-scale Thermo-Hydro-Mechanical coupled model for particulate systems. 
# Computer Methods in Applied Mechanics and Engineering. Accepted July 2020.
#

from yade import pack
from yade import timing
import numpy as np
import shutil
timeStr = time.strftime('%m-%d-%Y')
num_spheres=1000# number of spheres
young=1e6
rad=0.003

mn,mx=Vector3(0,0,0),Vector3(1.0,0.008,0.008) # corners of the initial packing

thermalCond = 2. #W/(mK)
heatCap = 710. #J(kg K) 
t0 = 400. #K

r = rad
k = 2*2.0*r  # 2*k*r 
Cp = 710.
rho = 2600.
D = 2.*r
m = 4./3.*np.pi*r**2/rho
# macro diffusivity
thermalDiff = 6.*k/(D*np.pi*Cp*rho)

identifier = '-conductionVerification'

if not os.path.exists('VTK'+timeStr+identifier):
os.mkdir('VTK'+timeStr+identifier)
else:
shutil.rmtree('VTK'+timeStr+identifier)
os.mkdir('VTK'+timeStr+identifier)

if not os.path.exists('txt'+timeStr+identifier):
os.mkdir('txt'+timeStr+identifier)
else:
shutil.rmtree('txt'+timeStr+identifier)
os.mkdir('txt'+timeStr+identifier)

shutil.copyfile(sys.argv[0],'txt'+timeStr+identifier+'/'+sys.argv[0])

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(3),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
#walls=aabbWalls([mn,mx],thickness=0,material='walls')
#wallIds=O.bodies.append(walls)

O.bodies.append(pack.regularOrtho(pack.inAlignedBox(mn,mx),radius=rad,gap=-1e-8,material='spheres'))

print('num bodies ', len(O.bodies))

ThermalEngine = ThermalEngine(dead=1,label='thermal');

newton=NewtonIntegrator(gravity=(0,0,-10), damping=0.2)
intRadius = 1
O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow",multithread=False),
ThermalEngine,  
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
#triax,

VTKRecorder(iterPeriod=500,fileName='VTK'+timeStr+identifier+'/spheres-',recorders=['spheres','thermal','intr'],dead=1,label='VTKrec'),
newton
]



#goal = -1e5
#triax.goal1=triax.goal2=triax.goal3=goal

#for b in O.bodies:
#if isinstance(b.shape, Sphere): 
#b.dynamic=False


# we only need flow engine to detect boundaries, there is no flow computed for 
this 
flow.dead=0
flow.defTolerance=-1 #0.3
flow.meshUpdateInterval=-1 #200
flow.useSolver=4
flow.permeabilityFactor=-0.7e-7 #1
flow.viscosity=10
flow.bndCondIsPressure=[0,0,0,0,0,0]
flow.bndCondValue=[0,0,0,0,0,0]
flow.boundaryUseMaxMin=[0,0,0,0,0,0]
flow.thermalEngine=True
flow.debug=False
flow.fluidRho = 1000
flow.fluidCp = 4184
flow.fluidK = 0.650
flow.bndCondIsTemperature=[1,1,0,0,0,0]
flow.thermalEngine=True
flow.thermalBndCondValue=[0,0,0,0,0,0]

flow.tZero=t0
flow.pZero=0
thermal.dead=0
thermal.conduction=True
thermal.thermoMech=False
thermal.advection=False
thermal.fluidThermoMech = False
thermal.solidThermoMech = False
thermal.fluidConduction= False

thermal.bndCondIsTemperature=[1,1,0,0,0,0]
thermal.thermalBndCondValue=[0,0,0,0,0,0]
thermal.tsSafetyFactor=0
thermal.particleDensity=2600
thermal.particleT0=t0
thermal.particleCp=heatCap
thermal.particleK=thermalCond
thermal.particleAlpha =11.6e-3
thermal.useKernMethod=False

timing.reset()
#ThermalEngine.dead=0

flow.updateTriangulation=True
O.dt=1.
O.dynDt=False

O.run(1,1)
flow.dead=1

for b in O.bodies:
if isinstance(b.shape,Sphere) and b.state.pos[1]>.5:
b.state.temp=700.
else:
b.state.temp=100.

Re: [Yade-users] [Question #691921]: Setting particle initial temperatures in thermalEngine

2020-07-17 Thread Zoheir Khademian
Question #691921 on Yade changed:
https://answers.launchpad.net/yade/+question/691921

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #691885]: thermo-hydro-mechanical modeling

2020-07-17 Thread Zoheir Khademian
Question #691885 on Yade changed:
https://answers.launchpad.net/yade/+question/691885

Status: Answered => Solved

Zoheir Khademian confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #691921]: THM modeling

2020-07-17 Thread Zoheir Khademian
New question #691921 on Yade:
https://answers.launchpad.net/yade/+question/691921



I am working on thermal hydraulic mechanical modeling. Can we assign different 
initial temperature values to different bodies (spheres) in a packing? Does 
"thermal.particleT0" or "body.state.temp" do the trick for initializing 
temperature gradient across a model? Or only boundaries can be thermally 
initialized?

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #691885]: thermo-hydro-mechanical modeling

2020-07-16 Thread Zoheir Khademian
Question #691885 on Yade changed:
https://answers.launchpad.net/yade/+question/691885

Status: Answered => Open

Zoheir Khademian is still having a problem:
Thank you Robert for the codes and notes.

Can we assign different initial temperature values to different bodies
(spheres) in a packing? Does "thermal.particleT0" or "body.state.temp"
do the trick for initializing  temperature gradient across a model? Or
only boundaries can be thermally initialized?

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #691885]: thermo-hydro-mechanical modeling

2020-07-15 Thread Zoheir Khademian
New question #691885 on Yade:
https://answers.launchpad.net/yade/+question/691885

I’m interested in the THM modeling by Yade and was wondering if someone could 
post a version of codes used for this paper [1].

And also, can we do THM with any kind of body in Yade like box elements, walls, 
or clumps?

Thanks
Zoheir

[1] R. Caulk, B. Chareyre, 2019. An open framework for the simulation of 
coupled Thermo-Hydro-Mechanical processes in Discrete Element Systems. 
https://www.researchgate.net/publication/335272631_An_open_framework_for_the_simulation_of_coupled_Thermo-Hydro-Mechanical_processes_in_Discrete_Element_Systems


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #688485]: Cycling AddToClump example fails

2020-02-04 Thread Zoheir Khademian
Question #688485 on Yade changed:
https://answers.launchpad.net/yade/+question/688485

Zoheir Khademian posted a new comment:
Thank you Jan and Jerome. That was a version issue.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #688485]: Cycling AddToClump example fails

2020-02-04 Thread Zoheir Khademian
Question #688485 on Yade changed:
https://answers.launchpad.net/yade/+question/688485

Status: Open => Solved

Zoheir Khademian confirmed that the question is solved:
Thank you Jan and Jerome. That was a version issue.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #688485]: Cycling AddToClump example fails

2020-02-03 Thread Zoheir Khademian
Question #688485 on Yade changed:
https://answers.launchpad.net/yade/+question/688485

Status: Needs information => Open

Zoheir Khademian gave more information on the question:
Hi Jan,

Thanks for the quick reply.
My Yade version is 20191220-2907
and Ubuntu version is  18.04.3
and Python version is 2.7.17
Here is the MWE, which is only a "O.run()" different from the trunk example.

from __future__ import print_function

from builtins import range
from yade import pack,export,qt

#define material for all bodies:


#define engines:
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(damping=0.7,gravity=[0,0,-10])
]

#create a box:
id_box = O.bodies.append(box((0,0,0),(2,2,.1),fixed=True))


 show how to use appendClumped():


#create 2 clumps:
clump1=O.bodies.appendClumped([\
sphere([0,0,1], radius=0.5),\
sphere([0.2,0,1], radius=0.5)\
])
clump2=O.bodies.appendClumped([\
sphere([3,1,2], radius=0.5),\
sphere([3.2,1,2], radius=0.5)\
])

#get clump ids:
id_clump1 = clump1[0]
id_clump2 = clump2[0]

#definition for getting informations from all clumps:
def getClumpInfo():
for b in O.bodies:
if b.isClump:
print('Clump ',b.id,' has following members:')
keys = list(b.shape.members.keys())
for ii in range(0,len(keys)):
print('- Body ',keys[ii])
print('inertia:',b.state.inertia)
print('mass:',b.state.mass,'\n')


 show how to use addToClump():


#create a new sphere:
id_new=O.bodies.append(sphere([0,0.2,1], radius=0.5))

print('\nSTATE before adding sphere to clump ')
getClumpInfo()

#add a sphere to the clump:
O.bodies.addToClump([id_new],id_clump1)

print('\nSTATE after adding sphere to clump ')
getClumpInfo()

#add a clump to a clump:
O.bodies.addToClump([id_clump2],id_clump1)

print('\nSTATE after adding the second clump to clump ')
getClumpInfo()

#try to add clump member to a clump (should give error message):
#O.bodies.addToClump(1,id_clump1)
#try to add clump to the same clump (should give error message):
#O.bodies.addToClump(id_clump1,id_clump1)

O.dt=1e-6

print('\nPress Play button ... ')
renderer = qt.Renderer()
qt.View()
O.run()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #688485]: Cycling AddToClump example fails

2020-02-03 Thread Zoheir Khademian
New question #688485 on Yade:
https://answers.launchpad.net/yade/+question/688485

Hello all,
I was able to successfully run  addToClump-example.py example at 
"https://github.com/yade/trunk/blob/master/examples/clumps/addToClump-example.py
 "

Hopwver, when I try to settle the clumps under gravity, I get this error:
python3.6: /builds/yade-dev/trunk/deb/yadedaily/core/Clump.cpp:61: void 
yade::Clump::addForceTorqueFromMembers(const yade::State*, yade::Scene*, 
yade::Vector3r&, yade::Vector3r&): Assertion `member->isClumpMember()' failed.
Aborted (core dumped)

Your help in this would be appreciated

Zoheir

 



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp