Having trouble writing a coupled differential equation in OpenFOAM
Is someone willing to help me write this equation in OpenFOAM?
I want to write this coupled differential equation. // x = x coordinate. // Ax = partial derivative of A with ONLY x (1/x)*Laplacian A - (1/(x*x))*Ax = (B)/x (1/x)*Laplacian B - (1/(x*x))*Bx = -(A)/x I have two problems here. 1. How do I write the derivative of A and B only with x and not write it as div(B)? 2. How can I multiply 1/x or 1/x*x to the matrix which is the derivative of A and B only with respect to x? I have to solve this using a steadystate solver without any time derivative like simpleFoam. Please Help me.:(:( Thank you. |
I haven't worked in OpenFOAM for a while, but these are my first shot at them. My apologies if my OpenFOAM syntax is a little rusty.
(1) You would have to take the gradient of A and B and then dot with the x-direction unit vector. Something like: fvc::grad(A) & vector(1,0,0) (2) fvMesh has a volume vector field C that contains the cell centroids. Again, dot with the x-direction unit vector to get the x component. I would multiply through by 1/x^2 to avoid division by zero. I do this reflexively. There is a coupled solver in the openfoam water supply. You could investigate how to make that work if performance is absolutely critical, but honestly, you are better off by building a segregated iterative solver. Start by fixing B, and solving the first equation for A. Then fixing that result for A and solve the second equation for B. And then iterate until convergence. |
Thank you so much Mr. Prinkey for your reply.
Taking the dot product after computing the gradient is a very good idea. I will try that. And thanks for letting me know the tutorial case. I will take a deeper look into it. |
All times are GMT -4. The time now is 05:58. |