<div dir="ltr">Thanks. I think the term "Component" was confusing me, I thought it was related to the components of a field. I think this would be useful to me if I wanted to assign coordinates to the vertices, wouldn't it?<div><br></div><div>Also, I was wondering how to set up dirichlet boundary conditions, basically fixing certain nodes position. Could I do it as the function <strong style="color:rgb(0,0,0)"><font color="#4169E1">SetInitialValues </font></strong>does it in the pflow example? These values are used to eliminate the zeroth-order energy modes of the stiffness matrix?</div><div><br></div><div>Last question, in my case I have two degrees of freedom per node, when I grab the offset with DMNetworkVariableOffset, that's for the first degree of freedom in that node and the second degree of freedom would just be offset+1?</div><div><br></div><div>Miguel</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 24, 2014 at 9:52 PM, Abhyankar, Shrirang G. <span dir="ltr"><<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Helvetica,sans-serif">
<div>
<div>If you have equations only at the nodes, with a part of it contributed by the edges (springs),  then you can use DMNetwork. If you are planning to have equations for the beads in the future, or other higher layers, then DMPlex has better functionality
 to manage that.</div>
<div><br>
</div>
<div>Shri</div>
</div>
<div><br>
</div>
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Wed, 24 Sep 2014 17:38:11 -0500<br>
<span style="font-weight:bold">To: </span>Shri <<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>><div><div class="h5"><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [petsc-users] DMPlex with spring elements<br>
</div></div></div><div><div class="h5">
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div dir="ltr">Thanks for your response. I'm attaching a pdf with a description of the model. The description of the PetscSection is necessary for the DMNetwork? It looks like DMNetwork does not use a PetscSection.</div>
</blockquote>
</div></div></span><div><div class="h5"><span>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div dir="ltr">
<div><br>
</div>
<div>Miguel</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Sep 24, 2014 at 1:43 PM, Abhyankar, Shrirang G. <span dir="ltr">
<<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
>Thanks for your response. My discretization is based on spring elements.<br>
>For the linear one dimensional case in which each spring has a<br>
>coefficient k, their jacobian would be this two by two matrix.<br>
>[  k    -k ]<br>
>[ -k     k ]<br>
><br>
>and the internal force<br>
><br>
>[ k ( Ui - Uj) ]<br>
>[ k ( Uj - Ui) ]<br>
><br>
>where Ui and Uj are the node displacements (just one displacement per<br>
>node because it's one dimensional)<br>
><br>
>For the two dimensional case, assuming small deformations, we have a<br>
>four-by-four matrix. Each node has two degrees of freedom. We obtain it<br>
>by performing the outer product of the vector (t , -t) where "t" is the<br>
>vector that connects both nodes in a spring. This is for the case of<br>
>small deformations. I would need to assemble each spring contribution to<br>
>the jacobian and the residual like they were finite elements. The springs<br>
>share nodes, that's how they are connected. This example is just the<br>
>linear case, I will have to implement a nonlinear case in a similar<br>
>fashion.<br>
><br>
>Seeing the DMNetwork example, I think it's what I need, although I don't<br>
>know much of power electric grids and it's hard for me to understand<br>
>what's going on. Do you have a good reference to be able to follow the<br>
>code?<br>
<br>
><br>
</span>Please see the attached document which has more description of DMNetwork<br>
and the equations for the power grid example. I don't have anything that<br>
describes how the power grid example is implemented.<br>
<span><br>
>For example, why are they adding components to the edges?<br>
><br>
>475:     DMNetworkAddComponent<br>
</span>><<a href="http://www.mcs.anl.gov/petsc/petsc-as/petsc-current/docs/manualpages/DM/D" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/petsc-current/docs/manualpages/DM/D</a><br>
>MNetworkAddComponent.html#DMNetworkAddComponent>(networkdm,i,componentkey[<br>
<span>>0],&pfdata.branch[i-eStart]);Miguel<br>
<br>
</span>Each edge or node can have several components (limited to 10) attached to<br>
it. The term components, taken from the circuit terminology, refers to the<br>
elements of a network. For example, a component could be a resistor,<br>
inductor, spring, or even edge/vertex weights (for graph problems). For<br>
code implementation, component is a data structure that holds the data<br>
needed for the residual, Jacobian, or any other function evaluation. In<br>
the case of power grid, there are 4 components: branches or transmission<br>
lines connecting nodes, buses or nodes, generators that are incident at a<br>
subset of the nodes, and loads that are also incident at a subset of the<br>
nodes. Each of the these components are defined by their data structures<br>
given in pf.h.<br>
<br>
DMNetwork is a wrapper class of DMPlex specifically for network<br>
applications that can be solely described using nodes, edges, and their<br>
associated components. If you have a PDE, or need FEM, or need other<br>
advanced features then DMPlex would be suitable. Please send us a write-up<br>
of your equations so that we can assist you better.<br>
<br>
Shri<br>
<div>
<div><br>
<br>
><br>
><br>
>On Tue, Sep 23, 2014 at 11:13 PM, Abhyankar, Shrirang G.<br>
><<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>> wrote:<br>
><br>
>You may also want to take a look at the DMNetwork framework that can be<br>
>used for general unstructured networks that don't use PDEs. Its<br>
>description is given in the manual and an example is in<br>
>src/snes/examples/tutorials/network/pflow.<br>
><br>
>Shri<br>
><br>
>From:  Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
>Date:  Tue, 23 Sep 2014 22:40:52 -0400<br>
>To:  Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>><br>
>Cc:  "<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
>Subject:  Re: [petsc-users] DMPlex with spring elements<br>
><br>
><br>
>>On Tue, Sep 23, 2014 at 4:01 PM, Miguel Angel Salazar de Troya<br>
>><<a href="mailto:salazardetroya@gmail.com" target="_blank">salazardetroya@gmail.com</a>> wrote:<br>
>><br>
>>Hi all<br>
>>I was wondering if it could be possible to build a model similar to the<br>
>>example snes/ex12.c, but with spring elements (for elasticity) instead of<br>
>>simplicial elements. Spring elements in a grid, therefore each element<br>
>>would have two nodes and each node two components. There would be more<br>
>>differences, because instead of calling the functions f0,f1,g0,g1,g2 and<br>
>>g3 to build the residual and the jacobian, I would call a routine that<br>
>>would build the residual vector and the jacobian matrix directly. I would<br>
>>not have shape functions whatsoever. My problem is discrete, I don't have<br>
>>a PDE and my equations are algebraic. What is the best way in petsc to<br>
>>solve this problem? Is there any example that I can follow? Thanks in<br>
>>advance<br>
>><br>
>><br>
>><br>
>><br>
>>Yes, ex12 is fairly specific to FEM. However, I think the right tools for<br>
>>what you want are<br>
>>DMPlex and PetscSection. Here is how I would proceed:<br>
>><br>
>>  1) Make a DMPlex that encodes a simple network that you wish to<br>
>>simulate<br>
>><br>
>>  2) Make a PetscSection that gets the data layout right. Its hard from<br>
>>the above<br>
>>      for me to understand where you degrees of freedom actually are.<br>
>>This is usually<br>
>>      the hard part.<br>
>><br>
>>  3) Calculate the residual, so you can check an exact solution. Here you<br>
>>use the<br>
>>      PetscSectionGetDof/Offset() for each mesh piece that you are<br>
>>interested in. Again,<br>
>>      its hard to be more specific when I do not understand your<br>
>>discretization.<br>
>><br>
>>  Thanks,<br>
>><br>
>>    Matt<br>
>><br>
>><br>
>>Miguel<br>
>><br>
>><br>
>><br>
>>--<br>
>>Miguel Angel Salazar de Troya<br>
>>Graduate Research Assistant<br>
>>Department of Mechanical Science and Engineering<br>
>>University of Illinois at Urbana-Champaign<br>
><br>
><br>
>>(217) 550-2360 <tel:%28217%29%20550-2360><br>
>><a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>>--<br>
>>What most experimenters take for granted before they begin their<br>
>>experiments is infinitely more interesting than any results to which<br>
>>their experiments lead.<br>
>>-- Norbert Wiener<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
>--<br>
>Miguel Angel Salazar de Troya<br>
>Graduate Research Assistant<br>
>Department of Mechanical Science and Engineering<br>
>University of Illinois at Urbana-Champaign<br>
>(217) 550-2360<br>
><a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a><br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr"><font face="verdana,sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br>
<font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>
Department of Mechanical Science and Engineering<br>
</font>University of Illinois at Urbana-Champaign<br>
(217) 550-2360<br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span>
<div><br>
</div>
</div>
</div>
</blockquote>
</span>
</div></div></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font face="verdana, sans-serif"><b>Miguel Angel Salazar de Troya</b></font><span><font color="#888888"><br><font face="arial,helvetica,sans-serif">Graduate Research Assistant<br>Department of Mechanical Science and Engineering<br></font>University of Illinois at Urbana-Champaign<br>(217) 550-2360<br>
<a href="mailto:salaza11@illinois.edu" target="_blank">salaza11@illinois.edu</a></font></span><div><br></div></div>
</div>