← Back to team overview

dolfin team mailing list archive

[Question #146882]: gradient operation for either a scalar or vector field

 

New question #146882 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/146882

Hi all, 
   This should be a naive question since I am about 14 days new to Dolfin at this point. 
    I want to calculate gradients for either a scalar or a vector field. Both scalar or vector fields are read from external files. The mesh below refers to a triangulated surface. 
 
    V = FunctionSpace(mesh, "CG", 1)
    scalar1 = Function(V, "1.xml")
    c = grad(scalar1)
    
   I want to have c as a vector so that I can save that to a vtk file for visualization or do some further operations on that. 
   outfile = File("example.pvd")
   outfile << c
  Alternatively, I could convert c to 3 different scalar functions. Is there anyway to do such operation in Dolfin.  

  For a vector field v(x,y,z), the gradient operation will create a tensor/matrix. How can I manipulate them? For instance, I only need dv/dx, dv/dy and dv/dz. Thanks so much for your help.

Best regards,
--JJ  
   

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups