[Getdp] gradient of a user defined function in getdp
Benjamin Vial
b.vial at qmul.ac.uk
Thu May 10 13:57:33 CEST 2018
Dear all,
I have defined a scalar function in 2D that depends on spatial variables
x and y, for example
Function{
F[] =X[]^2 + Y[]^2 ;
}
*Is there a way to compute its gradient in getdp?* (I know I can do this
analytically but eventually I would get
more complex expressions and it would be great to have a way to
automatically do that)
As far as I understand, the Grad/d syntax only works for discretized
quantities
represented between braces |{}|
This is with the aim to use Grad F in the weak formulation at some point.
Could this be done during the postprocessing/postoperation steps?
Some thoughts at the minute:
- export F[X,Y] to a .pos file, compute the gradient using gmsh plugin,
write back to a .pos file
and load it in getdp using gmshread.
- do the same thing described here:
http://onelab.info/wiki/Tutorial/Coupled_problems
i.e. solve a dummy auxiliary problem to copy F into a field F_aux
and then use {Grad F_aux}
to postprocess the gradient
Both ideas look really hacky and I wonder if there is a simpler solution.
Having read the doc and the forums I cannot find a way to do this, I
must be missing something.
Finally, I also spotted this in the changelog:
2.5.0 (March 12, 2015): added option to embed Octave and Python interpreters;
*extended "Field" functions with gradient;*
I think this might be helping but I there is no other mention of this in
the doc.
Thanks in advance for your help.
Best,
Ben
--------------------
BENJAMIN VIAL
Postdoctoral research assistant
Antennas & Electromagnetics research group
<http://antennas.eecs.qmul.ac.uk/>
Queen Mary, University of London <http://www.qmul.ac.uk/>
b.vial at qmul.ac.uk <mailto:b.vial at qmul.ac.uk> | +44 784 00 29
744 | benjaminvial.org <https://benjaminvial.org/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/getdp/attachments/20180510/0e352b72/attachment.html>
More information about the getdp
mailing list