CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Having trouble writing a coupled differential equation in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2015, 07:42
Default Having trouble writing a coupled differential equation in OpenFOAM
  #1
New Member
 
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11
adkar is on a distinguished road
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.
adkar is offline   Reply With Quote

Old   December 1, 2015, 08:57
Default
  #2
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
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.
mprinkey is offline   Reply With Quote

Old   December 2, 2015, 00:37
Default
  #3
New Member
 
Adkar
Join Date: Apr 2015
Posts: 18
Rep Power: 11
adkar is on a distinguished road
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.
adkar is offline   Reply With Quote

Reply

Tags
basic, equation, syntax error


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
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


All times are GMT -4. The time now is 19:01.