Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## Re: [Libmesh-users] Explicit Runge-Kutta DG

 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-29 14:26:12 ```Hello I have written an explicit dg code using TransientExplicitSystem. If I want to solve Me*unew_e = Me*uold_e + dt*R My assemble class does this (1) Loop over elements and compute Me*uold_e + dt*R into system.rhs (2) Loop over elements and solve Me per element and update system.rhs. At this stage system.rhs contains uold_e + Me^(-1)*dt*R Then I call system.solve () But I find that the solution is not changing at all from the initial condition. I am confused as to what the solve function actually does. Thanks praveen ```

 [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-25 08:08:57 ```Hello I am writing an explicit RKDG code using libmesh. Having read some examples, I am thinking of using a TransientExplicitSystem. Is this the correct approach ? Since it is explicit, I only need to assemble mass matrix once. In the time stepping only the right hand side needs to be assembled. Being DG, the mass matrix is block diagonal and can be solved per element. Its not clear how to do this. Can you point to some existing examples ? Also I want to use a multi-stage RK like the 3-stage SSP RK scheme of Shu-Osher. Thanks praveen ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-28 13:57:32 ```Hello I found that TransientExplicitSystem does not have any mass matrix. I wrote my explicit dg code with TransientLinearImplicitSystem and it works. However I end up computing mass matrix every time step and I am not able to solve the matrices at element level. I want to use the TransientExplicitSystem. I want to store the mass matrix as std::vector< DenseMatrix > with one small mass matrix per element. I can then solve at element level using cholesky_solve function available in DenseMatrix. But where do I store this matrix ? Is it good to store it in the parameters and then access it in the assemble function ? Thanks praveen On Sun, Aug 25, 2013 at 1:38 PM, Praveen C wrote: > Hello > I am writing an explicit RKDG code using libmesh. Having read some > examples, I am thinking of using a TransientExplicitSystem. Is this the > correct approach ? > > Since it is explicit, I only need to assemble mass matrix once. In the > time stepping only the right hand side needs to be assembled. > > Being DG, the mass matrix is block diagonal and can be solved per element. > Its not clear how to do this. Can you point to some existing examples ? > > Also I want to use a multi-stage RK like the 3-stage SSP RK scheme of > Shu-Osher. > > Thanks > praveen > ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Roy Stogner - 2013-08-28 14:46:49 ```On Wed, 28 Aug 2013, Praveen C wrote: > I found that TransientExplicitSystem does not have any mass matrix. I wrote > my explicit dg code with TransientLinearImplicitSystem and it works. > However I end up computing mass matrix every time step Hmm... it would be easy enough for you to add an "already_computed" flag and then skip the mass matrix assembly after the first time it's turned on. > and I am not able to solve the matrices at element level. This, on the other hand, would not be so easy. Your proposed alternative looks uglier but is probably much more efficient. > I want to use the TransientExplicitSystem. I want to store the mass matrix > as > > std::vector< DenseMatrix > > > with one small mass matrix per element. I can then solve at element level > using cholesky_solve function available in DenseMatrix. But where do I > store this matrix? Personally, I'd make a subclass of TransientExplicitSystem with that as a member object; there are lots of good options though. > Is it good to store it in the parameters and then access it in the > assemble function ? Just as long as you keep the parameters access *out* of any inner loops, by getting a reference to it at the beginning of the assembly function. String manipulation once per assembly is cheap; once per quadrature point is not. --- Roy ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: John Peterson - 2013-08-28 15:02:07 ```On Wed, Aug 28, 2013 at 8:46 AM, Roy Stogner wrote: > > On Wed, 28 Aug 2013, Praveen C wrote: > > > I found that TransientExplicitSystem does not have any mass matrix. I > wrote > > my explicit dg code with TransientLinearImplicitSystem and it works. > > However I end up computing mass matrix every time step > > Hmm... it would be easy enough for you to add an "already_computed" > flag and then skip the mass matrix assembly after the first time it's > turned on. > > > and I am not able to solve the matrices at element level. > > This, on the other hand, would not be so easy. Your proposed > alternative looks uglier but is probably much more efficient. > > > I want to use the TransientExplicitSystem. I want to store the mass > matrix > > as > > > > std::vector< DenseMatrix > > > > > with one small mass matrix per element. I can then solve at element level > > using cholesky_solve function available in DenseMatrix. But where do I > > store this matrix? > > Personally, I'd make a subclass of TransientExplicitSystem with that > as a member object; there are lots of good options though. > Are you planning to do adaptivity ever? The indexing into this std::vector may get a bit tricky in that scenario... Also, when running in parallel, you probably don't have to store mass matrices for non-local elements, but if you use a vector you'll waste a lot of space storing empty mass matrices. -- John ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-28 15:42:26 ```On Wed, Aug 28, 2013 at 8:31 PM, John Peterson wrote: > Are you planning to do adaptivity ever? The indexing into this > std::vector may get a bit tricky in that scenario... > > Also, when running in parallel, you probably don't have to store mass > matrices for non-local elements, but if you use a vector you'll waste a lot > of space storing empty mass matrices. > Yes I want to do adaptive and parallel also. When I loop over mesh elements like this MeshBase::const_element_iterator el = mesh.active_local_elements_begin (); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end (); for( ; el != end_el; ++el) { this loops only over the elements local to the processor, right ? In that case I would assemble and store the mass matrix only for the locally held elements. Thanks praveen ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-28 15:38:54 ```Thank you. Are the codes discussed in the slides available ? praveen On Wed, Aug 28, 2013 at 7:43 PM, Kirk, Benjamin (JSC-EG311) < benjamin.kirk@...> wrote: > On Aug 28, 2013, at 8:57 AM, Praveen C > wrote: > > > > > with one small mass matrix per element. I can then solve at element level > > using cholesky_solve function available in DenseMatrix. But where do I > > store this matrix ? Is it good to store it in the parameters and then > > access it in the assemble function ? > > I am not sure how you are providing your assembly code to libmesh, but for > a few years now the best practice is for you to define an assembly class > that libMesh can call back to. This is much more flexible than the > function pointer approach, but because of inertia is not as well documented > in the examples. You can then store arbitrary data in your assembly class > and not have to shoehorn parameters. > > > For a good example, see pg. 104-123, > https://github.com/libMesh/libmesh/wiki/documents/presentations/2013/prace_shortcourse_2013.pdf > > -Ben > > ```
 Re: [Libmesh-users] Explicit Runge-Kutta DG From: Praveen C - 2013-08-29 14:26:12 ```Hello I have written an explicit dg code using TransientExplicitSystem. If I want to solve Me*unew_e = Me*uold_e + dt*R My assemble class does this (1) Loop over elements and compute Me*uold_e + dt*R into system.rhs (2) Loop over elements and solve Me per element and update system.rhs. At this stage system.rhs contains uold_e + Me^(-1)*dt*R Then I call system.solve () But I find that the solution is not changing at all from the initial condition. I am confused as to what the solve function actually does. Thanks praveen ```