Giter Site home page Giter Site logo

Comments (11)

najlkin avatar najlkin commented on June 12, 2024

Hi, the thing is that periodic meshes rely on discontinuous L2 maps (nodal function), which do the trick. The vertices are wrapped around while the map continues further, so you should not use vertices any longer and retrieve the coordinates only from the nodal function 👍 . You are right this is not mentioned in documentation anyhow, maybe we should fix it 🤔 , but if you look into the code of MakePeriodic, it is the line periodic_mesh.SetCurvature(nodal_order, true); which switches to the nodal function.

from mfem.

najlkin avatar najlkin commented on June 12, 2024

Ok, I made a PR for it #4302 . Please check if it makes sense to you 😉.

from mfem.

najlkin avatar najlkin commented on June 12, 2024

Btw, you may also use Mesh::GetNode() , which is safe with or without a nodal function 😉

from mfem.

Tomcat4891 avatar Tomcat4891 commented on June 12, 2024

I tried Mesh::GetNode and I have a different result from

ParGridFunction Answer // this was the answer to the solution of an elasticity problem
ParGridFunction nodes(Answer);
mesh->GetNodes(nodes);
mesh->GetElement(i)->GetVertices(tetra);
for(int j=0;j<4;j++)
{
vertex2[0]=nodes[3*tetra[j]];
vertex2[1]=nodes[3*tetra[j]+1];
vertex2[2]=nodes[3*tetra[j]+2];
}

If you remove MakePeriodic, the results are the same.

It's weird. Why is that? What is the correct result?

from mfem.

najlkin avatar najlkin commented on June 12, 2024

This is not right, this would work if you have H1 nodal function, but MakePeriodic() uses discontinuous L2 function, which does not have DOFs at the vertices. If you prefer to use the nodal grid function directly instead of GetNode, you should interpolate it as any other grid function through GetValue() or you may use the method GetNodalValues() to get values at the vertices 😉.

from mfem.

Tomcat4891 avatar Tomcat4891 commented on June 12, 2024

Thank you, for your answers. Unfortunately, I'm getting confused. I have a simple problem. Suppose I have calculated the solution of the elasticity problem on a periodic grid. I need to take a tetrahedron, get the coordinates of four points and the components of the solution for these four points (displacement vector).

Next I want to interpolate the solution inside the tetrahedron using barycentric coordinates. Seems simple, but because of the periodicity and what you said above, I am confused.

I want to do my own fast procedure. But I can't get the trivial values of the vertices of the tetrahedra and the solution at those vertices, I don't want to use interpolation as it is time consuming for large number of points.

from mfem.

najlkin avatar najlkin commented on June 12, 2024

What makes MFEM interpolation that slow? You may interpolate the solution using the builtin methods, which will work even with L2 nodal functions. However, if you insist you want to build it by yourself, I should correct myself, Mesh::SetCurvature() actually uses L2 elements with GaussLobatto basis, so the DOFs are actually at the vertices. You may access them through GridFunction::GetElementDofValues() without interpolation.

from mfem.

Tomcat4891 avatar Tomcat4891 commented on June 12, 2024

In general, the interpolation in the MFEM is quite fast. I need to interpolate the solution from a finite element mesh to a uniform mesh. In this case it is possible to take into account this particular feature of the problem and significantly speed up the calculations (about 50 - 100 times).

from mfem.

najlkin avatar najlkin commented on June 12, 2024

I see, so does it work with GridFunction::GetElementDofValues()?

from mfem.

Tomcat4891 avatar Tomcat4891 commented on June 12, 2024

Yes, it works ! Thank you very much for your help.

from mfem.

najlkin avatar najlkin commented on June 12, 2024

Perfect! 😉 I am closing this in favor of #4302 (and already merged mfem/web#264 ).

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.