[Trilinos-Users] optimal choice of maps for finite elements assembly and update
Kevin Long
kevin.long at ttu.edu
Sun Oct 26 11:05:47 MDT 2008
Riccardo,
This is a good question whose solution needs to be documented better. Epetra
handles it in a way that is very clean and clever, but not obvious.
What you do is build *two* Epetra maps, one like your option 1, the other like
your option 2. In the context of matrices, these two maps are distinguished
explicitly: there are a pair of maps (called range/domain maps) each
containing only locally owned dofs (your option 1), and another pair (called
row/column maps) containing both local and ghost dofs (your option 2). If you
build an Epetra CRS or VBR matrix, the FillComplete() function will build the
second map pair (row/column) for you automatically.
So as far as matrices go, you basically do your option 1 and then option 2
will be taken care of automatically. Vectors take a little more work.
Suppose you have a vector containing only locally owned rows, i.e., without
ghosts. In a nonlinear problem, you'll need to access the ghost rows when
evaluating coefficients. You can get them by explicitly doing an import from
the option 2 map.
I'm not sure where to send you for an example; the examples I know of in
packages/Sundance/src-solvers are probably pretty obscure as the Epetra code
is wrapped in a representation-independent interface. If you want to look
there, though, there are examples of dealing with ghosts and imports in
packages/Sundance/src-solvers/Concrete/TSFEpetraGhostImporter.cpp
and
packages/Sundance/src-solvers/Concrete/TSFEpetraGhostView.cpp.
Note that these are internal source files rather than examples, so they may
not be easy to figure out, but it's better than nothing.
Hope that helps. I'm sure Mike H or someone can point you to a more
appropriate example in Epetra.
Regards,
Kevin
On Sunday 26 October 2008 10:38:30 am rrossi at cimne.upc.edu wrote:
> Dear All
>
> I am trying to link my finite element code to the Trilinos and i would
> like to get some hint from the experts … on a quite standard subject:
>
> Let’s take a simple example with 6 nodes and two processors
>
> Nodes 1 2 3 are “owned” by processor 1 … but node 1 also has a copy of 4
> Nodes 4 5 6 are “owned” by processor 2 … but node 1 also has a copy of 3
>
>
> In our internal database nodes 3 and 4 exist in both domains. We wish of
> course that the nodal database is exactly replicated on the two nodes.
>
>
> Let’s suppose now I would like to define a map prior to assembling our
> Finite Element problem:
>
> We have two obvious options:
>
> OPTION1
> We define a linear map so that the first processor owns exclusively 1 2 3
> and the second 4 5 6
>
> OPTION 2
> We define a map so that
> Node 1  has nodes 1 2 3 4
> Node 2  has nodes 3 4 5 6
>
> my problem is the following:
>
> ---- if I decide to use OPTION 1 at the moment of updating I need to
> gather the value of 4 to do the update of node 1 and of 3 to do the update
> of node 2 … how do I do this? I expect to use the “ExtractCopy” but having
> a look to the documentation it looks like it is not possible to get a non
> local entry by its GID… how should I do this? Shall I define an extra map
> and use the export operator?
>
> ---- OPTION 2 on the other hand would make the update trivial for me (I
> would have a local copy of all of the entries I need) … however … can I
> trust that the assembly and linear system solution will be done correctly?
>
>
>
> I am sure that those questions were asked once and again but I could
> figure out a clear answer through the didasko examples nor through the
> user manual…
> If someone could give me a short answer…or even a pointer to the correct
> documentation it would be of great help
>
> Thanks in advance
> Riccardo
>
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
--
------------------------------------------------------
Kevin Long
Associate Professor
Department of Mathematics and Statistics
Texas Tech University
Lubbock, TX
Standardized tests are a great idea, provided
you only have standardized students.
------------------------------------------------------
More information about the Trilinos-Users
mailing list