|
[Sponsors] |
Having trouble writing a coupled differential equation in OpenFOAM |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 10 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 24 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 10 ![]() |
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. |
|
![]() |
![]() |
![]() |
Tags |
basic, equation, syntax error |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 02:36 |
Problem with cyclic boundaries in Openfoam 1.5 | fs82 | OpenFOAM | 36 | January 7, 2015 00:31 |
Wave Action Equation Solver for OpenFOAM | chyczewski | OpenFOAM Programming & Development | 7 | September 4, 2013 11:06 |
error message | cuteapathy | CFX | 14 | March 20, 2012 06:45 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 08:56 |