Hi,

I have a problem with understanding how the boundary conditions can be modified. I am trying to apply the potentialFlux solver on a unit rectangular domain of which I have created a mesh using Gmsh. First I applied a uniform pressure difference between two opposing sides (labeled as "inflow" and "outflow") as boundary condition (uniform fixedValue ), while a zeroGradient boundary condition was applied on the two other sides. This case runs ok, but when I tried to apply a nonuniform fixedValue boundary condition on the "inflow" side, I get a weird result. Using the face centre coordinates of the "inflow" patch, I tried to apply a linearly varying pressure over the "inflow" patch. But when I look at the result, the pressure does not vary linearly over the "inflow" patch and the values don't match with my input values. I manipulated the boundary condition as follow:

{ in_bnd = p.ext_boundaryField()[inflow_ind] in_centres = foam_vector2numpy(in_bnd.patch().Cf()) in_inds = numpy.argsort(in_centres[:,1]) ref_coords = np.linspace(0.0,1.0,51) ref_vals = np.linspace(0.0,5.0,51) new_in_vals = numpy.interp(numpy.sort(in_centres[:,1]),ref_coords,ref_vals)[in_inds] for ind in range(in_bnd.size()): in_bnd[ind] = 10.0 + new_in_vals[ind] }

where 'foam_vector2numpy' is a function that I wrote to transfer an OpenFOAM vector List to a numpy array. I must be modifying the boundary conditions wrongly, otherwise I don't know how to explain the results. Is this a legitimated way of accessing and modifying the boundary conditions?

thanks,

Hon Fai