<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 25, 2014 at 1:46 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">You are right. The Jacobian for the power grid application is indeed<br>
non-symmetric. Is that a problem for your application?<br></blockquote><div><br></div><div>If you need a symmetric Jacobian, you can use the BC facility in PetscSection, which eliminates the</div><div>variables completely. This is how the FEM examples, like ex12, work.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Shri<br>
<br>
From: Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com">salazardetroya@gmail.com</a>><br>
Date: Thu, 25 Sep 2014 12:57:53 -0500<br>
To: Shri <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
Cc: <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
Subject: Re: [petsc-users] DMPlex with spring elements<br>
<br>
<br>
>Why not? Wouldn't we have a row of zeros except for the diagonal term?<br>
>The column that corresponds to that degree of from doesn't have to be<br>
>zero, right?<br>
>Thanks<br>
>Miguel<br>
>On Sep 25, 2014 12:38 PM, "Abhyankar, Shrirang G." <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
>wrote:<br>
><br>
><br>
><br>
>From: Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com">salazardetroya@gmail.com</a>><br>
>Date: Thu, 25 Sep 2014 11:43:13 -0500<br>
>To: Shri <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
>Cc: <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
>Subject: Re: [petsc-users] DMPlex with spring elements<br>
><br>
><br>
><br>
>I see, and I guess I would have to assign a value of one to the diagonal<br>
>entry of that degree of freedom in the Jacobian right?<br>
><br>
><br>
><br>
>Yes.<br>
><br>
>Wouldn't this break the symmetry of the Jacobian (in case it were<br>
>symmetric)?<br>
><br>
><br>
>No.<br>
><br>
>Shri<br>
><br>
>Thanks<br>
>Miguel<br>
>On Sep 25, 2014 11:32 AM, "Abhyankar, Shrirang G." <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
>wrote:<br>
><br>
>The solver does not know anything about the boundary conditions. You<br>
>would have to specify it to the solver by describing the appropriate<br>
>equations. For e.g. in the power grid example, there is a part in the<br>
>residual evaluation<br>
><br>
> if (bus->ide == REF_BUS || bus->ide == ISOLATED_BUS) {<br>
> farr[offset] = 0.0;<br>
> farr[offset+1] = 0.0;<br>
> break;<br>
> }<br>
><br>
><br>
>This sets the residual at the nodes marked with REF_BUS or ISOLATED_BUS<br>
>to 0.0. You can do something similar.<br>
><br>
>Shri<br>
><br>
><br>
><br>
>From: Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com">salazardetroya@gmail.com</a>><br>
>Date: Thu, 25 Sep 2014 10:52:16 -0500<br>
>To: Shri <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
>Cc: "<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
>Subject: Re: [petsc-users] DMPlex with spring elements<br>
><br>
><br>
><br>
>Thanks. Once I have marked the nodes that are fixed nodes using the<br>
>component data structure, how can I process it later? I mean, at what<br>
>point does the solver know that those degrees of freedom are actually<br>
>fixed and how I can tell it that they<br>
> are fixed?<br>
><br>
>Miguel<br>
><br>
><br>
>On Thu, Sep 25, 2014 at 10:27 AM, Abhyankar, Shrirang G.<br>
><<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>> wrote:<br>
><br>
><br>
><br>
>>Thanks. I think the term "Component" was confusing me, I thought it was<br>
>>related to the components of a field. I think this would be useful to me<br>
>>if I wanted to assign coordinates to the vertices, wouldn't it?<br>
><br>
>Yes. You can put whatever data you want in the component data structure.<br>
><br>
>><br>
>>Also, I was wondering how to set up dirichlet boundary conditions,<br>
>>basically fixing certain nodes position.<br>
>><br>
><br>
>><br>
>><br>
>You can add a component at each node with a field marking whether the node<br>
>is a boundary node.<br>
><br>
>>Could I do it as the function SetInitialValues does it in the pflow<br>
>>example?<br>
>><br>
><br>
>No. You need to put in the component data structure before calling<br>
>DMNetworkAddComponent()<br>
><br>
><br>
>>These values are used to eliminate the zeroth-order energy modes of the<br>
>>stiffness matrix?<br>
>><br>
><br>
><br>
>><br>
>>Last question, in my case I have two degrees of freedom per node, when I<br>
>>grab the offset with DMNetworkVariableOffset, that's for the first degree<br>
>>of freedom in that node and the second degree of freedom would just be<br>
>>offset+1?<br>
>><br>
><br>
>Yes.<br>
><br>
>Shri<br>
><br>
>><br>
>>Miguel<br>
>><br>
>><br>
>>On Wed, Sep 24, 2014 at 9:52 PM, Abhyankar, Shrirang G.<br>
>><<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>> wrote:<br>
>><br>
>>If you have equations only at the nodes, with a part of it contributed by<br>
>>the edges (springs), then you can use DMNetwork. If you are planning to<br>
>>have equations for the beads in the future, or other higher layers, then<br>
>>DMPlex has better functionality<br>
>> to manage that.<br>
>><br>
>>Shri<br>
>><br>
>><br>
>>From: Miguel Angel Salazar de Troya <<a href="mailto:salazardetroya@gmail.com">salazardetroya@gmail.com</a>><br>
>>Date: Wed, 24 Sep 2014 17:38:11 -0500<br>
>>To: Shri <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>><br>
>>Cc: "<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
>>Subject: Re: [petsc-users] DMPlex with spring elements<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>>Thanks for your response. I'm attaching a pdf with a description of the<br>
>>model. The description of the PetscSection is necessary for the<br>
>>DMNetwork? It looks like DMNetwork does not use a PetscSection.<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>>Miguel<br>
>><br>
>><br>
>>On Wed, Sep 24, 2014 at 1:43 PM, Abhyankar, Shrirang G.<br>
>><<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>> wrote:<br>
>><br>
>><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<br>
>>>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>
>>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>
>><br>
>>>For example, why are they adding components to the edges?<br>
>>><br>
>>>475: DMNetworkAddComponent<br>
>>><<a href="http://www.mcs.anl.gov/petsc/petsc-as/petsc-current/docs/manualpages/DM" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/petsc-current/docs/manualpages/DM</a><br>
>>>/<br>
>>>D<br>
>>>MNetworkAddComponent.html#DMNetworkAddComponent>(networkdm,i,componentke<br>
>>>y<br>
>>>[<br>
>>>0],&pfdata.branch[i-eStart]);Miguel<br>
>><br>
>>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<br>
>>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<br>
>>write-up<br>
>>of your equations so that we can assist you better.<br>
>><br>
>>Shri<br>
>><br>
>><br>
>>><br>
>>><br>
>>>On Tue, Sep 23, 2014 at 11:13 PM, Abhyankar, Shrirang G.<br>
>>><<a href="mailto:abhyshr@mcs.anl.gov">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">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">salazardetroya@gmail.com</a>><br>
>>>Cc: "<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>" <<a href="mailto:petsc-users@mcs.anl.gov">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">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<br>
>>>>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<br>
>>>>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<br>
>>>>would<br>
>>>>not have shape functions whatsoever. My problem is discrete, I don't<br>
>>>>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<br>
>>>>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<br>
>>>>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">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>
>>><a href="tel:%28217%29%20550-2360" value="+12175502360">(217) 550-2360</a><br>
>>><a href="mailto:salaza11@illinois.edu">salaza11@illinois.edu</a><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>
>><a href="tel:%28217%29%20550-2360" value="+12175502360">(217) 550-2360</a><br>
>><a href="mailto:salaza11@illinois.edu">salaza11@illinois.edu</a><br>
>><br>
>><br>
>><br>
>><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>
>><a href="tel:%28217%29%20550-2360" value="+12175502360">(217) 550-2360</a><br>
>><a href="mailto:salaza11@illinois.edu">salaza11@illinois.edu</a><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>
><a href="tel:%28217%29%20550-2360" value="+12175502360">(217) 550-2360</a><br>
><a href="mailto:salaza11@illinois.edu">salaza11@illinois.edu</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</div></div>