[Getdp] Evaluate a scalar field at some points, print values on terminal and use them in PostOperation

michael.asam at infineon.com michael.asam at infineon.com
Tue May 24 09:53:54 CEST 2016


Hi Gilles,

you can evaluate the value at a specified point in a PostOperation like this:
Print[ u, OnPoint {xp, yp, zp} , File "MyResult" , Format SimpleTable];

You can also find the min/max value and/or the corresponding coordinates and store them
in a register for later use in another PostProcessing (search in the manual for StoreMinInRegister
and StoreMinXinRegister):
Print[ u, OnElementsOf TotalDomain, StoreMaxInRegister 1, Format SimpleTable, File "Result_Dummy.txt"];

There are various examples in the folder benchmarks in the source code showing the usage
of registers and how to print number results directly in Gmsh’s sidebar.

Cheers,
Michael



From: getdp [mailto:getdp-bounces at ace20.montefiore.ulg.ac.be] On Behalf Of gilles quemener
Sent: Monday, May 23, 2016 2:30 PM
To: getdp at onelab.info
Subject: [Getdp] Evaluate a scalar field at some points, print values on terminal and use them in PostOperation

Hi,

Currently I am trying to evaluate a scalar field solution at some given points
and to evaluate the min and max of this scalar field. Once this is done I would
like to print these quantities on the terminal window as well as to use them for
further PostOperation.

Assume GetDP has solved my problem and is able to compute scalar fieldsu
and utotm as described in the GetDP script below.

How can I get the following quantities at Point {xp, yp, zp}:
u1 = u(xp, yp, zp)
u2 = utotm(xp, yp, zp)
and:
umin = min(u) over a region
umax = max(u) over a region
utotmmin = min(utotm) over a region
utotmmax = max(utotm) over a region

I have tried several syntaxes for the different quantities above, but none passed the parsing phase w/o error.
Therefore if someone has clues or a solution, it would be very helpful !

//Post Processing
//===============

PostProcessing{
  {Name CubicCavity; NameOfFormulation CubicCavity;
    Quantity{
      {Name u;     Value {Local{[{u}];           In TotalDomain; Jacobian JVol;}}}
      {Name utotm; Value {Local{[{u}-scalpot[]]; In TotalDomain; Jacobian JVol;}}}
    }
  }
}

//Post Operation
//==============

PostOperation{
  {Name Map_u; NameOfPostProcessing CubicCavity;
    Operation{
      Print [ u,     OnElementsOf GammaInner, File "uIIsur_3D.pos" ];// works !
      Print [ utotm, OnElementsOf GammaInner, File "uIImuI_3D.pos" ];// works !

      Print [ utotm, OnElementsOf GammaInner, Iso {0.65}, Sort Position, Format SimpleTable, File "out.txt" ];// works !

      // Note: Be carefull, in order to visualize the .pos file below in Gmsh, it does not work w/ option "Iso-values"
      // even if it is a single iso-contour/iso-value, I have to use option "Continuous Map" (?!?!)
      Print [ utotm, OnElementsOf GammaInner, Iso {0.65}, Format Gmsh, File "toto.pos" ];// works !

      // How to print the value of scalar field u or utotm at a specific point (e.g. (0,0,1.3)) on terminal ?
      Printf [ "U=%g", u(0, 0, 1.3) ];
      Printf [ "Utotm=%g", utotm(0, 0, 1.3) ];

      // How to get min and max values on some region and use them in other PostOperation ?

      umin = Min(u[]) OnElementsOf GammaInner;
      umax = Max(u[]) OnElementsOf GammaInner;

      N = 10;
      du = (umax - umin) / N;
      For i In (1, N)
        uval = umin + (i - 0.5) * du;

        Print[ utotm, OnElementsOf GammaInner, Iso { uval }, Sort Position, Format SimpleTable, File >> "out.txt" ];
      EndFor
    }
  }
}

Thanks a lot for any help,

             Gilles


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/getdp/attachments/20160524/e6168b06/attachment-0001.html>


More information about the getdp mailing list