Search code examples
pythonfipy

Setting non-uniform boundary values


I'm working on a coupled simulation with a CFD solver for the flow domain (e.g. OpenFOAM) and a FiPy setup for the structural domain. In this case, I have non-uniform boudaries and want to set a fixed temperature on the exterior faces. As far as I know the standard fipy-way would be to set a fixed value via a constraint for each face. Unfortunately, this requires a boundary mask for each face and I'd expect an excess in RAM usage when using larger meshes.

In the python API I found the description for the constrain-method of a variable:

Constrain the Variable to have a value at an index or mask location specified by where.

Though, I could not constrain a variable by giving one or more indices.

Is there a possibility to do this in a more elegant way? I think about some kind of "fixed value array" instead of the "boolean mask". Each face has an ID so that the boundary mask can be interpreted correctly. Subsequently, it could theoretically be possible to set a fixed value array on the indices for the respective faces? The question remains how internal faces are treated in this case. Where there any attempts of doing this? I couldn't find similar problems within the FiPy publications as well as here on stack overflow.

Thanks in advance!


Solution

  • It doesn't look to me like constraining by index has worked for at least thirteen years (if ever). It could probably be made to work, and you're welcome to file an issue requesting such a feature.

    Frankly, though, if you cannot afford the memory of the full mask, FiPy is probably not the tool for you. In order to gain what performance we can within Python, we are rather profligate with mesh variables.