using JFVM, JFVMvis, PyPlot L= 1.0 # length of the domain Nx= 20 # number of cells m= createMesh1D(Nx, L) # create the domain and mesh BC= createBC(m) # create the boundary condition BC.left.a .= 0.0 # left side Neumann term equal to zero BC.left.b .= 1.0 # left side Dirichlet term coefficient equal to one BC.left.c .= 0.0 # left side Dirichlet term value equal to zero BC.right.a .= 0.0 BC.right.b .= 1.0 BC.right.c .= 1.0 D_val= 1.0 # value of the transfer coefficient D= createCellVariable(m, D_val) # assign D_val to all the cells # harmonic average of the transfer coefficient on the cell faces: D_face= harmonicMean(D) (Mbc, RHSbc)= boundaryConditionTerm(BC) Mdiff= diffusionTerm(D_face) M= Mdiff+Mbc # matrix of coefficients RHS= RHSbc # off course! phi= solveLinearPDE(m, M, RHS) # solve the linear PDE figure(figsize=(6.0,5.0)) # unit is [cm] for me visualizeCells(phi) # visualize the results # decorate the plot xlabel("x", fontsize=16) ylabel(L"\phi", fontsize=16) L= 1.0 # length of the domain Nx= 30 # number of cells Ntheta= 5*20 m= createMeshRadial2D(Nx, Ntheta, L, 2π) # create the domain and mesh m.cellcenters.x .+= 0.1 m.facecenters.x .+= 0.1 BC= createBC(m) # create the boundary condition BC.left.a .= 0.0 # left side Neumann term equal to zero BC.left.b .= 1.0 # left side Dirichlet term coefficient equal to one BC.left.c .= 0.0 # left side Dirichlet term value equal to zero BC.left.c[1:5:Ntheta] .= 1.0 BC.right.a .= 0.0 BC.right.b .= 1.0 BC.right.c .= 0.0 BC.bottom.periodic=true # periodic boundary condition D_val= 1.0 # value of the transfer coefficient D= createCellVariable(m, D_val) # assign D_val to all the cells # harmonic average of the transfer coefficient on the cell faces: D_face= harmonicMean(D) D_face.yvalue .= 0.003*D_val (Mbc, RHSbc)= boundaryConditionTerm(BC) Mdiff= diffusionTerm(D_face) M= -Mdiff+Mbc # matrix of coefficients RHS= RHSbc # off course! phi= solveLinearPDE(m, M, RHS) # solve the linear PDE visualizeCells(phi) # visualize the results