volume averaging between tree + tensor with different number of cells
lheagy opened this issue · comments
I am running into an
ValueError: operands could not be broadcast together with shapes (33,) (29,)
When I am trying to perform the volume averaging between a tensor mesh and a tree mesh. The extent of the TreeMesh is smaller than the tensor, so I am not entirely sure where things are going awry
Here is a minimal example to reproduce the error:
import numpy as np
import discretize
pf = 1.3
npad = 5
nc = 20
cs = 5
nc_tree = 32
mesh_tensor = discretize.TensorMesh([
[(cs, npad, -pf), (cs, nc-2), (cs, npad, pf)],
[(cs, npad, -pf), (cs, nc-2), (cs, npad, pf)],
[(cs, npad, -pf), (cs, nc-2), (cs, npad, pf)],
],
x0 = "CCC"
)
mesh_tree = discretize.TreeMesh([
[(cs, nc_tree)], [(cs, nc_tree)], [(cs, nc_tree)],
],
x0 = "CCC"
)
mesh_tree = discretize.utils.refine_tree_xyz(
mesh_tree, np.c_[0, 0, 0], octree_levels=[8, 4, 2], method="radial", finalize=True
)
sigma = np.random.rand(mesh_tensor.nC)
sigma_tree = discretize.utils.volume_average(mesh_tensor, mesh_tree, sigma)