[dune-pdelab] [SPOOFED?] Fast evaluation of solution at a general point in the domain.

Muething, Dr. Steffen steffen.muething at iwr.uni-heidelberg.de
Wed Apr 17 10:43:18 CEST 2019


Hi Tim,

> Am 16.04.2019 um 10:13 schrieb Dodwell, Timothy <T.Dodwell at exeter.ac.uk>:
> 
> Hi All,
> 
> I have a very clunky implementation of evaluating a solution at a general point in a domain. With recent developments in dune-functions is there a nice way of doing this, using some sort of tree?
> 
> Best
> 
> Tim
> 
> Ps. To be clear I would ideally want a way of doing the following without writing some local operator like I do currently!
> 
> I.e. I have
> 
> typedef Dune::PDELab::Backend::Vector<GFS,RF> V;
>         V u(gfs,0.0);
> 
> ## Some code
> 
> typedef Dune::PDELab::StationaryLinearProblemSolver<GO,LS,V> SLP;
>       SLP slp(go,ls,u,1e-10);
>       slp.apply();
> 
> ## then I would like to do something like
> Dune::FieldVector<double,dim> x(0.5);
> RF point_val = u(x);

you never needed to write a LocalOperator for that. If you know the cell that contains the coordinate at which
you want to evaluate, you can use either a DiscreteGridFunction or a DiscreteGridViewFunction. The former
uses the old PDELab interface, where you have to call gf.evaluate(entity,x,y), the latter inherits the dune-functions
interface, so you need to first create a LocalFunction, bind it to the cell and then do y = local_function(x).

If you want to directly evaluate global coordinates, the easiest way is to create a DiscreteGridFunction and wrap
it in a GridFunctionToFunctionAdapter. That adapter will use the HierarchicSearch utility from dune-grid to find
the cell containing the global coordinate and then call the wrapped DiscreteGridFunction with that information.
This does not work in parallel code, however.

Cheers
Steffen

> 
> 
> 
> Dr Tim Dodwell
> Fellow of the Alan Turing Institute,
> Senior Lecturer in Engineering Mathematics,
> Education Lead Mechanical Engineering
> 
> Rm 221 - Harrison Building
> College of Engineering, Mathematics & Physical Sciences
> University of Exeter
> Exeter
> Devon
> EX4 4PY
> 
> mail: t.dodwell(at)exeter.ac.uk
> tel: +44 (0)1392 725899
> mob: +44 (0)7745 622870
> web: http://emps.exeter.ac.uk/engineering/staff/td336
> Papers and Pre-prints: @Research-Gate
> Citations: @Google-Scholar
> 
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune-pdelab

--------------------------------
Steffen Müthing
Interdisciplinary Center for Scientific Computing
Heidelberg University

Im Neuenheimer Feld 205
69120 Heidelberg
Germany

+49 6221 54 14516
steffen.muething at iwr.uni-heidelberg.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20190417/c17b916c/attachment.sig>


More information about the dune-pdelab mailing list