Closed HDFengChina closed 1 year ago
Hi, yes you can construct a CenteredGrid
from a math.Tensor
which you can create with wrap
or tensor
.
v_array = np.empty([64, 64, 2])
v_tensor = wrap(v_array, spatial('x,y'), channel('vector'))
grid = CenteredGrid(v_tensor, extrapolation.PERIODIC, bounds=Box(x=(0, 1), y=(0, 1)))
For constructing staggered grids, see here.
Thanks for your answer. Your suggestion is useful.
One more question. In fluid dynamics, we often set the Reynolds number (Re) or viscosity to control the performance of the fluid. Where can I set or change such numbers?
Simulations generally add some amount of numerical viscosity which you can measure. For explicit diffusion, you can use diffuse.explicit
.
Hi,
I hope to use PhiFlow as the env in my model. Thus, I need to calculate the next field with given the certain velocities and pressure.
I can transform the calculated field to array by values.native(), but I met a challenge when I want to transform the given field (array) to CenteredGrid or StaggeredGrid.
Is there any method can transform the numpy array to CeteredGrid in PhiFlow ?
Thank you.