- Thank you received: 0
Iterating over all elements
5 years 3 months ago #1750
by Jon
Iterating over all elements was created by Jon
Hello,
To find my CFL condition I have to iterate over all elements in my domain and I was wondering if there is a more efficient way to do this other than what I have.
for i, en in enumerate(fes.Elements()):
trafo = en.GetTrafo()
id0 = int(i)
value_I_need = gfu.vec[id0][1]
To find my CFL condition I have to iterate over all elements in my domain and I was wondering if there is a more efficient way to do this other than what I have.
for i, en in enumerate(fes.Elements()):
trafo = en.GetTrafo()
id0 = int(i)
value_I_need = gfu.vec[id0][1]
- Guosheng Fu
- Offline
- Elite Member
Less
More
- Thank you received: 6
5 years 3 months ago #1751
by Guosheng Fu
Replied by Guosheng Fu on topic Iterating over all elements
I will use
where h0 is your estimated minimal mesh size, and vel_max is the estimated maximum velocity magnitude.
I will use a DG-P0 space to calculate vel_max as follows:
Code:
dt = h0/vel_max*cfl
I will use a DG-P0 space to calculate vel_max as follows:
Code:
fes_vest = L2(mesh, order=0)
gf_vel = GridFunction(fes_vest)
gf_vel.Set((vel*vel)**0.5) # vel shall be your velocity grid function
vel_max = max(gf_vel.vec)
Time to create page: 0.102 seconds