flow.nCells() != "cell number" recorded by flow.saveVtk()
Hello,
One question for FlowEngine and DFNFlowEngine: why the flow.nCells() != "cell number" recorded by flow.saveVtk()?
I would like to record the Ids of initial fractured cells and then impose different pressures within them, but I find that the ids (and vertices) are not consistent given by these two ways.
Below is an example.
Thank you in advance for your help.
Best regards,
Lingran
from yade import pack, ymport
### material
def sphereMat(): return JCFpmMat(
def wallMat(): return JCFpmMat(
### bodies
mn,mx=Vector3(
O.bodies.
sps=SpherePack()
sp=pack.
sp.toSimulation
dim=utils.
xinf=dim[0][0]
xsup=dim[1][0]
X=xsup-xinf
yinf=dim[0][1]
ysup=dim[1][1]
Y=ysup-yinf
zinf=dim[0][2]
zsup=dim[1][2]
Z=zsup-zinf
### engines
flow=FlowEngine(
### choose solver to use (0: Gauss Seidel, 1: Taucs, 2: Pardiso, 3: CHOLMOD)
#debug=1
)
intR=1.1
O.engines=[
ForceResetter()
,InsertionSort
,InteractionLoop(
[Ig2_
[Ip2_
[Law2_
)
,flow
,GlobalStiffne
,NewtonIntegra
]
### simulation starts here
## to block the particles (better for permeability test)
for o in O.bodies:
o.state.
O.run(1,True)
## getBoundaryFlux get the total discharge [m3/s]
Qin = flow.getBoundar
Qout = flow.getBoundar
permeability = abs(Qout)
permeability2 = flow.averageVel
conductivity = permeability*
print "Qin=",Qin," Qout=",Qout," ARE THEY EQUAL? IF NOT-> NO FLOW!"
print "Permeability [m2]=",
flow.saveVtk() # to see the result in Paraview
for i in range(flow.
print i, flow.getVertices(i)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Lingran Zhang
- Solved:
- 2019-11-24
- Last query:
- 2019-11-24
- Last reply:
- 2019-11-23
Robert Caulk (rcaulk) said : | #1 |
Hello Lingran,
I am not sure I understand the question:
flow.nCells() returns the total number of finite cells in the triangulation [1].
flow.saveVTK() prints the individual cell IDs for each cell (the ones you can index with getVertices(i)).
flow.getVertices(i) gives the vertex IDs for the particles comprising cell i.
Are you trying to say the maximum ID printed by saveVTK is not equal to the single value returned by nCells()?
What makes you say the vertices are inconsistent? What are the vertices inconsistent with? The particle body IDs?
Cheers,
Robert
[1]https:/
Lingran Zhang (lingran) said : | #2 |
Hello Robert,
Thank you.
In my simulation, I get flow.nCells()=383; flow.getVertice
It means that the particle ids comprising the the cell id=0 are 5, 68, 69, 71, right?
While when I open the VTK file printed by flow.saveVTK(), I read the following lines:
CELLS 242 1210
4 38 41 37 39
4 31 28 36 11
…
From my understanding, the VTK file tells me that I have 242 cells, each cell include 4 vertices, the particle ids comprising the cell id=0 are 38, 41, 37, 39. Am I wrong?
So my questions are: how many finite cells are produced by the triangulation, 383 or 242? What are the particle ids comprising each cell, shall I find the answer from flow.getVertices(i) or flow.saveVTK()?
Cheers,
Lingran
Robert Caulk (rcaulk) said : | #3 |
Thanks for the clarification.
> how many finite cells are produced by the triangulation, 383 or 242?
242 withoutBoundaries (default). Try using flow.saveVTK(
>the particle ids comprising the cell id=0 are 38, 41, 37, 39. Am I wrong?
Yes, you are wrong :-) Those are not the particle IDs. Those are redirected IDs for paraview since it needs zero based vertex IDs [1]
[1]https:/
Lingran Zhang (lingran) said : | #4 |
Hi Robert,
Great, you have answered exactly my questions.
Now I should update my source code to include ‘withBoundaries’ in flow.saveVTK().
Thank you very much.
Cheers,
Lingran