### Defining a source term equals to: CST1 on part of the domain and to CST2 elsewhere

196

views

0

Dear Fenics community,

I am considering a 3D vector field u that is defined in the cylindrical geometry:

I would like to define the linear form $L\left(v\right)=\int_{\Omega}f\cdot v\mathrm{dx}$

I would like to define $f$

My question is how do I define such function ? Should I:

Thank you very much in advance for your help !!!

PS: Last time Hernan was very helpful for a similar question ;-)

I am considering a 3D vector field u that is defined in the cylindrical geometry:

```
domain = Cylinder(Point(cylinder_length, 0, 0), Point(0, 0, 0), W, W, 64)
mesh = generate_mesh(domain, 64)
```

I would like to define the linear form $L\left(v\right)=\int_{\Omega}f\cdot v\mathrm{dx}$

`L`(`v`)=∫_{Ω}`ƒ`·`v``d``x`where $f=\left(f_1,f_2,f_3\right)$`ƒ`=(`ƒ`_{1},`ƒ`_{2},`ƒ`_{3}) is a 3D vector field (like the 3D test vector function $v$`v`). The space is three dimensional $x=\left(x_0,x_1,x_2\right)$`x`=(`x`_{0},`x`_{1},`x`_{2}).I would like to define $f$

`ƒ`such that:- $f\left(x_0,x_1,x_2\right)=\left(a_0,a_1,a_2\right)$
`ƒ`(`x`_{0},`x`_{1},`x`_{2})=(`a`_{0},`a`_{1},`a`_{2}) if $L_1$`L`_{1}< $x_0$`x`_{0}< $L_2$`L`_{2} - $f\left(x_0,x_1,x_2\right)=\left(b_0,b_1,b_2\right)$
`ƒ`(`x`_{0},`x`_{1},`x`_{2})=(`b`_{0},`b`_{1},`b`_{2}) otherwise

`a`_{0},`a`_{1},`a`_{2}) and $\left(b_0,b_1,b_2\right)$(`b`_{0},`b`_{1},`b`_{2}) are constants.My question is how do I define such function ? Should I:

- Define f directly through an expression (maybe with some if statement : if {x0>L_1 and x_0<L2} then f=(a0,a1,a2) else f=(b0,b1,b2))
- Cut the space into different subspaces and define f as being constant on each of these subspaces
- Another method...

Thank you very much in advance for your help !!!

PS: Last time Hernan was very helpful for a similar question ;-)

Community: FEniCS Project

Please login to add an answer/comment or follow this question.

https://www.allanswered.com/post/eqvbw/how-to-implement-a-piece-wise-constant-curl-curlelectromagnetic-maxwell-equations/

If your domains are fixed, try to include them already in the mesh generation process. This way, your subdomain boundaries would consist of element boundaries and the definition is followed better. (Cf. https://www.allanswered.com/post/nqzba/defending-sub-domains/)