Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of vector-valued coupling data #26

Closed
RafalKulaga opened this issue Feb 22, 2019 · 6 comments
Closed

Handling of vector-valued coupling data #26

RafalKulaga opened this issue Feb 22, 2019 · 6 comments
Assignees

Comments

@RafalKulaga
Copy link
Contributor

RafalKulaga commented Feb 22, 2019

For structural solver handling of vector function space is required, however this is currently not supported by the fenicsadapter.py . At first it seemed that it can be fixed easily, as there are Vector equivalents of Scalar functions in PySolverInterface.py (e.g. writeBlockScalarData() and writeBlockVectorData()), but actually there is no difference in the body of these functions, hence it does not help.

Anyway, I am first going to change from 'PySolverInterface.py' to 'precice' and then try to cope with this issue (#25).

@uekerman uekerman changed the title Handling of Vector Function Space Handling of vector-valued coupling data Feb 25, 2019
@uekerman
Copy link
Member

I changed the name of the issue. Did I get it right, is that what you want to do?

What do you mean by?

... but actually there is no difference in the body of these functions, hence it does not help.

@RafalKulaga
Copy link
Contributor Author

RafalKulaga commented Feb 25, 2019

Yes.

I should now refer to precice.pyx functions and not PySolverInterface due to #25. I just mean that simple changing from e.g. write_block_scalar_data() to write_block_vector_data() in fenicsadapter.py does not help. Using vector-valued functions yields the same error in both cases. This is understandable as the implementation of "scalar" and "vector" version of read and write does not differ (it is the same code). Please compare
https://github.com/precice/precice/blob/develop/src/precice/bindings/python/precice.pyx#L259-L281 and https://github.com/precice/precice/blob/develop/src/precice/bindings/python/precice.pyx#L300-L322

I will push the draft of structural solver, so the error (TypeError: only size-1 arrays can be converted to Python scalars) can be reproduced.

@uekerman
Copy link
Member

uekerman commented Feb 27, 2019

This is understandable as the implementation of "scalar" and "vector" version of read and write does not differ (it is the same code)

Well, it does call two different preCICE methods that do different things. Probably, I understand better what you mean when you push the draft of the structural solver.

Also for the vector-valued case: len(value_indices) != len(values).

Still values needs to be one-dimensional array (of size numberOfVertices times dimensions). Maybe you are looking for the method ravel ?

@RafalKulaga
Copy link
Contributor Author

@uekerman Thanks, I did not know that it must be one-dim array. Using ravel helped, but just to make sure: from [ [u1, v1], [u2, v2] ...] form we want [ u1, v1, u2, v2, ...] and not [ u1, u2, ... v1, v2, ... ], right?

The issue cannot be closed yet though, there are further modifications in fenicsadapter.py required.

@uekerman
Copy link
Member

but just to make sure: from [ [u1, v1], [u2, v2] ...] form we want [ u1, v1, u2, v2, ...] and not [ u1, u2, ... v1, v2, ... ], right?

Exactly! See also the API documentation

@BenjaminRodenberg
Copy link
Member

Closed. Vector valued data is supported since #38 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants