This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Assign a discrete vector of solution to the VectorFunctionSpace

+2 votes

I need to use fenics to do some processing on my solution field. I solve my PDE with Abaqus and extract the displacement for all the nodes and I can put it in vector D. I am using the same mesh for both Abaqus and Fenics. so is there any way that I can assign the vector of my solution which is an array of number to U so I can have the solution function ?

from __future__ import division
from dolfin import *
import numpy
mesh=UnitSquareMesh(10, 10)
    #D is the displacment obtained from Abaqus
V = VectorFunctionSpace(mesh, "Lagrange", 1)
U = Function(V)

Thanks.

asked Jan 23, 2014 by BrianB FEniCS Novice (190 points)

1 Answer

+3 votes

There is

U.vector()[:] = my_vector_from_abaqus

This assumes that the order of the basis functions in V is the same though.

answered Jan 23, 2014 by nschloe FEniCS User (7,120 points)

Thank you for your help.

...