On Sat, Aug 19, 2017 at 6:15 PM, James Strother <james.a.strot...@gmail.com>
wrote:

> Hello,
>
> I'm working on a program where I would like to find values and gradients
> for variables that are specified on a mesh. I was hoping to do this using
> libmesh. I've gone through the documentation but it is a lot to take in. I
> would really appreciate it if someone could point me in the right
> direction.
>
> Here is a quick test case I put together:
>
> ----
>
>    /* create mesh */
>    libMesh::Mesh mesh(init.comm());
>
>    mesh.set_spatial_dimension(2);
>
>    libMesh::Node* n0 = new libMesh::Node(0, 0);
>    libMesh::Node* n1 = new libMesh::Node(1, 0);
>    libMesh::Node* n2 = new libMesh::Node(0, 1);
>
>    mesh.add_node(n0);
>    mesh.add_node(n1);
>    mesh.add_node(n2);
>
>    libMesh::Tri3* e1 = new libMesh::Tri3();
>    e1->set_node(0) = n0;
>    e1->set_node(1) = n1;
>    e1->set_node(2) = n2;
>
>    mesh.add_elem(e1);
>
>    mesh.prepare_for_use();
>
>    /* create system */
>    libMesh::EquationSystems eq_sys(mesh);
>
>    libMesh::ExplicitSystem& sys =
> eq_sys.add_system<libMesh::ExplicitSystem>("Interp System");
>
>    sys.add_variable("u", libMesh::FIRST, libMesh::LAGRANGE);
>
> ----
>
> But I couldn't figure out what to do next.


You need to call eq_sys.init() once you are done adding variables.



> How would I set the type of the
> vector, for example a vector?


Not sure what this question is asking...


> How do I assign values to the variable?


In this simple example, you can assign values directly to the solution
vector if you want.

sys.solution->set(/*dof=*/0, /*value=*/10.);


> How
> do I evaluate the variables at specific points? I saw the "point_value"
> function in the System class, but when I use that I receive an error that
> it is deprecated. What should I do instead?
>

System::point_value() is not deprecated as far as I know, and even if it
was, it should not produce an error message unless you are also using it
incorrectly. What did you try to call, exactly?

-- 
John
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to