# 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:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kallol](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kallol](https://community.freefem.org/u/kallol)\
**Post date:** [September 19, 2022, 4:24pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/1 "2022-09-19T16:24:09Z")

</div>

Dear all,  
I am trying to compute discontinuous Galerkin method in 3D and trying to compute a discrete solution at certain time level. But when I use jump or mean in intallfaces for the previous time level solution in the variational form, I got this error message:  
“Internal error : no jump or average in intallfaces for RHS”.  
What should I do now?

---

<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 20, 2022, 3:22pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/2 "2022-09-20T15:22:26Z")

</div>

Possible I miss some code !

I will try a add if you sane the example.

---

<div class="post-metadata">

**Author:** ![kallol](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kallol](https://community.freefem.org/u/kallol)\
**Post date:** [September 21, 2022, 6:04am UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/3 "2022-09-21T06:04:13Z")

</div>

[sample.edp](https://community.freefem.org/uploads/short-url/jUZokeuiClSOVRnX50fLQYMFcqO.edp) (2.6 KB)  
I am attaching the code. Please suggest me if there is any solution for this problem.

---

<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, 1:53pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/4 "2022-09-23T13:53:04Z")

</div>

Effectively, a peace of code is missing  
I try to add rapidly.

---

<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)

---

<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:** [October 4, 2022, 12:17pm UTC](https://community.freefem.org/t/problem-in-3d-discontinuous-galerkin-computation/2015/6 "2022-10-04T12:17:11Z")

</div>

I do the correction in version [- add missing code for Discontinous Galerkin in 3d for RHS · FreeFem/FreeFem-sources@6e209d5 · GitHub](https://github.com/FreeFem/FreeFem-sources/commit/6e209d5aa724372f2194f23a74d55c4f86860009)

I think it work, I just do sample test.
