How to set different coefficients for different physicalCells?

27 views Asked by At

I generated a 2D model with gmsh and set up different physics groups. When I try to

coeff = CellVariable(mesh=mesh)
coeff.constrain(k_Au,where=mesh.physicalCells == 'ring')

I get the error

if numerix.shape(value.where)[-1] == self.mesh.numberOfFaces:

IndexError: tuple index out of range

How can I set different coefficients for my different physicalCells?

1

There are 1 answers

0
jeguyer On

You don't have the syntax quite right. Try

coeff.constrain(k_Au,where=mesh.physicalCells['ring'])

Also, .constrain() is intended for boundary conditions. To set different values of a coefficient, I would do

coeff.setValue(k_Au, where=mesh.physicalCells['ring'])