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

Generalising 1D-equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 8, 2018, 07:17
Default Generalising 1D-equation
  #1
New Member
 
Albin Lindskog
Join Date: Dec 2017
Posts: 8
Rep Power: 8
Dharoc is on a distinguished road
Hello,


I am creating a custom solver that is based around the following equation:

a v (\frac{\partial v}{\partial z}) + v/b = - \frac{\partial y}{\partial z} + c

where a, b and c are constants. v and y are both scalars.
y is known and v is the variable I'm solving for.

My approach is to implement a generic solution (3D) and introduce the one-dimensional condition by defining all side patches as empty. As such I am trying to implement the following equation in my solver:

a (V \cdot \nabla) V + V/b = - \nabla y + C

Where V and C instead are vectors.

However I am struggling to do so.

Is this the recommended/correct approach to my problem?
How would I implement equation 2 in my Solver? Are there any resources describing this part of OpenFOAM-development?
Dharoc is offline   Reply With Quote

Old   April 21, 2018, 14:52
Default
  #2
New Member
 
Albin Lindskog
Join Date: Dec 2017
Posts: 8
Rep Power: 8
Dharoc is on a distinguished road
I've made an attempt to implement the equation

a (V \cdot \nabla) V + V/b = - \nabla y + C

based on icoFoam:

Code:
surfaceScalarField phi = fvc::interpolate(V) & mesh.Sf();
fvVectorMatrix VEqn
(
    a * fvm::div(phi, V)
    + fvm::Sp((1/b), V)
);
solve(VEqn == -fvc::grad(y) + C);
where V and C are volVectorField.

The solution produced are however non-physical. Is there something I've overlooked or misunderstood?

Thanks in advance,
Dharoc
Dharoc is offline   Reply With Quote

Old   April 22, 2018, 16:49
Default
  #3
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 16
babakflame is on a distinguished road
Hello,

The main thing is that if you create an almost 1 dimensional grid with suitable boundary conditions. You can still run OpenFOAM codes in 1 dimensional. I mean there is no 1 dimensional coding approach.

The second thing that I wanted to mention and you might probably find it helpful is trying to adapt OpenFOAM momentum (UEqn.H) to your case by adding and excluding terms. Easily, you can make it compatible with your case.
babakflame is offline   Reply With Quote

Old   April 26, 2018, 07:52
Default
  #4
New Member
 
Albin Lindskog
Join Date: Dec 2017
Posts: 8
Rep Power: 8
Dharoc is on a distinguished road
Hello babakflame, thank you for your reply. That is exactly how I've approached the problem so far, so it's nice to know I've taken the right approach.

I've also identified the issue I described in the second post i this thread. The problem was not my implementation of the equation, but rather with the boundary conditions for the y-field. So far now are things looking promising.
Dharoc is offline   Reply With Quote

Old   May 6, 2018, 15:15
Default
  #5
New Member
 
Albin Lindskog
Join Date: Dec 2017
Posts: 8
Rep Power: 8
Dharoc is on a distinguished road
Hello again!

I'm stuck with the same problem, albeit with another equation. I'm trying to implement:

\nabla \cdot (a*V + \nabla a - \nabla b ) = 0

where V is a volVectorField and a and b are volScalarFields.

Does anyone have any pointers?

Last edited by Dharoc; May 12, 2018 at 09:24.
Dharoc is offline   Reply With Quote

Old   May 12, 2018, 09:58
Default
  #6
New Member
 
Albin Lindskog
Join Date: Dec 2017
Posts: 8
Rep Power: 8
Dharoc is on a distinguished road
I've not made any progress. Just to clarify, I'm trying to implement the following one-dimensional equation, where a is the unknown I'm solvning for:

\frac{\partial }{\partial z}(a * v + \frac{\partial a}{\partial z}- \frac{\partial b}{\partial z}=0

By generalising it to the following three-dimensional equation and using empty boundary conditions to make it one-dimensional.

\nabla \cdot (a*V + \nabla a - \nabla b ) = 0

Is this not the correct approach in this case?

Last edited by Dharoc; May 12, 2018 at 11:56.
Dharoc is offline   Reply With Quote

Reply

Tags
1-d, development, equation, generalising, generalizing


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
rotational and inviscid Mike Main CFD Forum 40 November 9, 2023 07:03
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Some problem of "Qcriterion.mcr& yuyuxuan Tecplot 9 February 12, 2016 04:27
Need help:about energy equation in CFX Stein CFX 4 July 2, 2009 23:31
Diffusion Equation izardy amiruddin Main CFD Forum 2 July 4, 2002 09:14


All times are GMT -4. The time now is 20:22.