Is the following code is correct?

Can someone help me how to write the second term of the bilinear form??


Here is my code

Blockquote
+intalledges(Th)((abs(N.xmean(v1old)+N.ymean(v2old))jump(v1)jump(vv1))/nTonEdge(nTonEdge-1))
+int1d(Th)(abs(N.x
v1old+N.yv2old)v1vv1)
+intalledges(Th)((abs(N.x
mean(v1old)+N.ymean(v2old))jump(v2)jump(vv2))/nTonEdge(nTonEdge-1))
+int1d(Th)(abs(N.x
v1old+N.y
v2old)v2vv2)

Blockquote
Here, v is known ,v=(v1old,v2old), z=(v1,v2) is unkown, theta=(vv1,vv2) is test function.

I would write for your second term
intalledges(Th)((nTonEdge-1)*real(mean(w1)*N.x+mean(w2)*N.y<0.)*abs(N.x*mean(v1old)+N.y*mean(v2old))*(-jump(v1)*vv1-jump(v2)*vv2))

1 Like

Thank sir for your replies. But why you are ignoring jump(vv1) and jump(vv2) sir?. Does it has any reason??. In weak formulation in continuous case, theta=0 on boundary of the domain (given). But in discontinuous case, jump(theta)=theta^int-theta^ext. It this may be theta^ext=0 . So, theta^int only there it the bilinear form.

One more that i observe you have not written boundary edges term. But why?. If i am not wrong it is full boundary sir. For nTonEdge=1, term that you wrote becomes zero sir. So, no contribution of boundary are there.

Thanks sir.

But why you are ignoring jump(vv1) and jump(vv2) sir?.
There is no jump(theta) appearing in your formulation.
theta_int=theta

theta=0 on boundary of the domain (given).
Since theta is given and vanishes on the boundary, it follows that the boundary term vanishes in your formulation. Thus there is nothing to discretize.

One more that i observe you have not written boundary edges term.
You said that theta vanishes on the boundary \partial\Omega. It follows that there is no boundary term.

If theta does not vanish on the boundary, you can add boundary terms by writing another intalledges with factor 2-nTonEdge.

1 Like

Can write as following sir??

Blockquote
+intalledges(Th)((nTonEdge-1)real(mean(v1old)N.x+mean(v2old)N.y<0.)abs(N.xmean(v1old)+N.ymean(v2old))(-jump(v1)vv1-jump(v2)vv2))
+int1d(Th)((real(v1old
N.x+v2old
N.y<0.)abs(N.xv1old+N.y
v2old)(-v1vv1-v2*vv2))) // boundary terms of inflow boundary

Blockquote
Here, w=(v1old, v2old) is known.

According to you sir, am i write as following?

Blockquote
+intalledges(Th)((2-nTonEdge)*real(mean(v1old)N.x+mean(v2old)N.y<0.)abs(N.xmean(v1old)+N.ymean(v2old))(-jump(v1)*vv1-jump(v2)*vv2))

Blockquote

Which one is best sir?? .

The most simple is
+int1d(Th)(real(v1old*N.x+v2old*N.y<0.)*abs(N.x*v1old+N.y*v2old)*(v1*vv1+v2*vv2))
Note the change of sign, because jump(v)=v_ext-v_int, not the opposite.
Here all quantities are evaluated on the interior side of the boundary.

But it depends on the interpretation of your variational formulation for boundary terms.
– If you want that on the boundary \{v\}=v_{int} then the previous formula is good.
– If you want that on the boundary v_{ext}=0, \{v\}=(v_{int}+v_{ext})/2=v_{int}/2 then you should use the intalledges formula.

1 Like

I am seeing that you have not divided by nTonEdge while writing intalledges( ). Should we divide by nTonEdge or not sir??.

You must not divide by nTonEdge (or equivalently divide by 2)
because your variational formulation contains two contributions at each internal edge, one from each triangle on each side.
You divide by 2 when you want a single contribution for each edge (or the average of the two contributions from each side if these contributions differ).

1 Like

Okay thanks sir. I got it. So, i will not divide by nTonEdge.