Just an idea: for "pulling" another solution I'd write a boundary-condition (timeVaryingMappedFixedValueFvPatchField might be similar to what you're trying to achieve)

OR

the functionObject directly writes the values to the patch (I assume that after sending the external program calculates and then can send back a solution)

Bernhard

__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

Do you have any links to any code using timeVaryingMappedFixedValueFvPatchField?
So I can try to understand what it is, and how it is used?
From the name I can see that it is some kind of mapping between a patch, that varies in time...

From my functionObject, how can I modify a patch? Or where can I find some code to look at that does it?

timeVaryingMappedFixedValueFvPatchField is found in $FOAM_SRC/finiteVolue/fields/fvPatchFields/derived (quoting from memory). Or you can look it up in the Doxygen.

A quick and dirty-approach to writing the patch field in the function-object would be the reverse of what you're already doing: just put the "fld.boundaryField()[index]" (that is an example from the simpleFunctionObjects onto the left side of an = and voila you're writting to the patch.

Bernhard

__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

A quick and dirty-approach to writing the patch field in the function-object would be the reverse of what you're already doing: just put the "fld.boundaryField()[index]" (that is an example from the simpleFunctionObjects onto the left side of an = and voila you're writting to the patch.

After two days trying with the compiler, I'm still stuck.

If I don't missunderstand it, fld is constant and thus cannot be modified.

1) Is it possible to write to fld anyway?
2) Or, how could I get a writtable reference to U?

All examples I've found on the forum modify U and p from within the solver (the main function), and we are trying to avoid modifying the solvers.

@2: Don't tell anyone, that I said this: google for const_cast. But beware: this operator allows you to violate the encapsulation mechanisms and therefor using it is similar to running with an open knife
@1: what I would suggest is writing a boundary-condition and provide it with an interface to change the boundary values. In the functionObject dynamicCast the general patch field to that type (maybe use a isA to guard that cast) to your type and use your methods to set the value (Look thorough the doxygen for isA and dynamicCast and grep the sources for example usages)

Bernhard

__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request