# Problem in 3D discontinuous Galerkin computation

**URL:** <https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015>\
**Category:** General Discussion\
**Created:** [September 19, 2022, 4:24pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015 "2022-09-19T16:24:08Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [September 23, 2022, 4:07pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/5 "2022-09-23T16:07:01Z")

</div>

if it is urgent then you can compute the RHS by a matrix product

use a couple Finite element

```auto
fespace Wh(Th,[P1dc,P1dc,P1dc]; ); 
Vh [ux, uy,uz],[uu1, uu2,uu3], [dux,duy,duz], [vx, vy, vz];
varf vM([uu1, uu2,uu3],[vx, vy, vz]) = -intallfaces(Th)(
				((1./dt)*k *(mean(dx(uu1))*N.x*jump(vx)+mean(dy(uu1))*N.y*jump(vx)+mean(dz(uu1))*N.z*jump(vx)+mean(dx(uu2))*N.x*jump(vy)+mean(dy(uu2))*N.y*jump(vy)+mean(dz(uu2))*N.z*jump(vy)+mean(dx(uu3))*N.x*jump(vz)+mean(dy(uu3))*N.y*jump(vz)+mean(dz(uu3))*N.z*jump(vz)
			+mean(dx(vx))*N.x*jump(uu1)+mean(dy(vx))*N.y*jump(uu1)+mean(dz(vx))*N.z*jump(uu1)+mean(dx(vy))*N.x*jump(uu2)+mean(dy(vy))*N.y*jump(uu2)+mean(dz(vy))*N.z*jump(uu2)+mean(dx(vz))*N.x*jump(uu3)+mean(dy(vz))*N.y*jump(uu3)+mean(dz(vz))*N.z*jump(uu3)
			+ (pena*NN)*(jump(uu1)*jump(vx)+jump(uu2)*jump(vy)+jump(uu3)*jump(vz))
				))/ nElementonB
				        )
matrix M(Wh,Wh); 
real[int] RHS = M*uu1[]; 

```

use RHS as you rhs of you equation !  
like in [Time dependent schema optimization for heat equations](https://doc.freefem.org/tutorials/heatEquationOptimization.html#time-dependent-schema-optimization-for-heat-equations)

---

_[View the full topic](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015)._
