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

Trouble adding a directional derivative source term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2013, 20:19
Default Trouble adding a directional derivative source term
  #1
New Member
 
Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 13
cpro is on a distinguished road
Hi everyone. Thanks for checking this.

I am a new OpenFOAM user, and I have been trying to create my own solver to model ferrofluid motion. In the model that I am using, there is a directional derivative source term (i.e. M \cdot \nabla B which I plan to approximate as \nabla\left( M \cdot B \right) where M and B are vectors).

I have M and B set up as volVectorFields, and I want multiply the entire thing by a the volume of each cell over the (constant) density. It looks like the fvc::div function needs one surface scalar field, so I created a phiB in a similar way to the phi for velocity using
Code:
(fvc::interpolate(B) & mesh.Sf())
Next, I try to modify phiB by the constant. Here is some relevant code:

Code:
            phiB=phiB*mesh.V()/rho;

            fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              - fvm::laplacian(nu, U)
            );

            solve(UEqn == -fvc::grad(p) + fvc::div(phiB, M));
When I try to compile it, it lists a large number of errors that were not there before attempting to multiply by volume. So, I think the problem occurs when I multiply by the volume of each cell (using mesh.V), but I'm lost as to how to fix it. Any tips or suggestions? Is there a better way to do this?

I really appreciate your help.
cpro is offline   Reply With Quote

Old   March 19, 2013, 16:51
Default
  #2
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 62
Rep Power: 15
alundilong is on a distinguished road
Quote:
Originally Posted by cpro View Post
Hi everyone. Thanks for checking this.

I am a new OpenFOAM user, and I have been trying to create my own solver to model ferrofluid motion. In the model that I am using, there is a directional derivative source term (i.e. M \cdot \nabla B which I plan to approximate as \nabla\left( M \cdot B \right) where M and B are vectors).

I have M and B set up as volVectorFields, and I want multiply the entire thing by a the volume of each cell over the (constant) density. It looks like the fvc::div function needs one surface scalar field, so I created a phiB in a similar way to the phi for velocity using
Code:
(fvc::interpolate(B) & mesh.Sf())
Next, I try to modify phiB by the constant. Here is some relevant code:

Code:
            phiB=phiB*mesh.V()/rho;

            fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              - fvm::laplacian(nu, U)
            );

            solve(UEqn == -fvc::grad(p) + fvc::div(phiB, M));
When I try to compile it, it lists a large number of errors that were not there before attempting to multiply by volume. So, I think the problem occurs when I multiply by the volume of each cell (using mesh.V), but I'm lost as to how to fix it. Any tips or suggestions? Is there a better way to do this?

I really appreciate your help.
phiB ---> surfaceScalarField
mesh.V() ---> volScalarField
rho ---> volScalarField

I think you have to do linear interpolation for volScalarField before math operations.
alundilong is offline   Reply With Quote

Reply

Tags
directional derivative, ferrofluid, mesh


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
derivative of source term denise Fluent UDF and Scheme Programming 1 October 29, 2009 04:41
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
UDF Source Term Units? Brian FLUENT 1 October 24, 2005 09:15
Directional Diffusivity of UDS Source Greg Perkins FLUENT 2 September 4, 2003 03:02


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