Giter Club home page Giter Club logo

Comments (4)

pazner avatar pazner commented on June 13, 2024 1

The differences you're encountering are because of the differences between "local vectors" (L-vectors) and "true vectors" (T-vectors).

A (Par)GridFunction is a "local vector" — it contains all the degrees of freedom for all the elements in the mesh partition. This means that degrees of freedom that lie on the boundary of the mesh partitions are shared (duplicated) among the MPI ranks of those partitions.

"True vectors" are vectors that contain only true DOFs (TDOFs). These are de-duplicated: every true DOF belongs to exactly one MPI rank.

When you call FormSystemMatrix, the resulting matrix will act on true DOFs, so the dimensions will be less than the dimensions of the grid functions or linear forms.

To get a true DOF vector corresponding to a ParLinearForm, call the function ParLinearForm::ParallelAssemble.

To extract a true DOF vector corresponding to a ParGridFunction, call the function ParGridFunction::ParallelProject.

To covert a true DOF vector into a ParGridFunction, call the function ParGridFunction::Distribute (or ParGridFunction::SetFromTrueDofs — they are synonymous).

This diagram might help explain things:

image

There is also some documentation here.

from mfem.

Wayne901 avatar Wayne901 commented on June 13, 2024 1

It's clear now. Thank you @pazner .

from mfem.

Wayne901 avatar Wayne901 commented on June 13, 2024

Thank you @pazner, my current source is correct now with ParallelAssemble(). I have 2 last questions.

  1. Is there something special about HypreParVector? I assume it's same as a Vector with true dofs size.
  2. ParallelProject and ParallelAssemble calls
    pfes->GetRestrictionMatrix()->Mult() and pfes->GetProlongationMatrix()->Mult()Transpose, respectively. Are they
    equivalent?

from mfem.

pazner avatar pazner commented on June 13, 2024
  1. Is there something special about HypreParVector? I assume it's same as a Vector with true dofs size.

HypreParVector is a Vector with size equal to the number of true DOFs. It also wraps a hypre_ParVector, which is an object from the hypre library that allows it to easily interface with hypre matrices and preconditioners. In most MFEM code, you can use Vector instead of HypreParVector.

  1. ParallelProject and ParallelAssemble calls
    pfes->GetRestrictionMatrix()->Mult() and pfes->GetProlongationMatrix()->Mult()Transpose, respectively. Are they
    equivalent?

ParallelAssemble will perform assembly, in other words it will add contributions from shared processors. This is the right thing to do for dual vectors like linear forms. ParallelProject will restrict the vector, meaning it will just take one of the shared values (if the code is consistent, all of the shared values will be equal, and it won't matter which one you take).

from mfem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.