How to form a tensor from scalar functions (for output to VTK file)
Hello:
I have a possibly unique problem, we are solving a PDE with a symmetric+traceless 2-rank tensor as the dependent variable. My understanding is that FEniCS implements symmetric tensor operations, but not traceless. Thus we formulation the variational form using the components of the tensor.
The problem now is that we cannot use standard FEniCS I/O to output the data to a VTK file. While we could output the individual components and work with them in that way, it would be much more simple for us to somehow project the 5 scalar functions to a single tensor function. Here is a summary of what we are doing:
SS = FunctionSpace(mesh, 'CG', degree)
MS = MixedFunctionSp
# Define trial and test functions
dQ = TrialFunction(MS)
v = TestFunction(MS)
# Define functions
Q0 = Function(MS) # past/known solution
Q = Function(MS) # current solution
q110,q220,
q11,q22,q21,q31,q32 = Q
v11,v22,v21,v31,v32 = v
...
file1 << (Q.split()[0],t)
file2 << (Q.split()[1],t)
file3 << (Q.split()[3],t)
# we would like to replace this with a single line file<<(Q,t)
Thanks for any help or suggestions.
Nasser
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Nasser Mohieddin Abukhdeir for more information if necessary.