CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD

Hartmann flow constant source term

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   March 8, 2007, 11:22
Default Dear all, I'm working on si
New Member
Zaki Saldi
Join Date: Mar 2009
Posts: 18
Rep Power: 10
zakifoam is on a distinguished road
Dear all,

I'm working on simulation of Hartmann flow (hartmann case, mhdFoam application). After successfully finishing the simulation with default setting (like what described in the pdf manual), I want to see if things work out as well if I use cyclic bc's for the 'inlet' and 'outlet'. So I tried the first simulation with no magnetic field (then it's actually a normal channel flow) after reducing the channel length (hence changing the mesh) and imposing the cyclic bc at both ends of the domain. The simulation ran well but the result indicated that the flow decays (since no body forces are active). So I was thinking of implementing a constant pressure gradient in order to maintain the flow. This surely led me to a necessity to deal with the source code (mhdFoam.C and related files).

So, here's what I did to the codes.

(1) In mhdFoam.C, I used a constant pressure gradient (denoted by, say, pg), and removed -fvc::grad(p) from the momentum equation.

fvVectorMatrix UEqn
+ fvm::div(phi, U)
- fvc::div(phiB, 2.0*DBU*B)
- fvm::laplacian(nu, U)
+ fvc::grad(DBU*magSqr(B))

solve(UEqn == -pg);

(2) I specified pg as scalar with dimension in createFields.H

dimensionedScalar pg

(3) I specified pg in $FOAM_RUN/mhdFoam/hartmann_cyclic/constant/transportProperties, so it can be read by createField.H

pg pg [0 1 -2 0 0 0 0] 0.00223;

After compiling, I got the following messages:

Making dependency list for source file mhdFoam.C

SOURCE=mhdFoam.C ; g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/zaki/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/zaki/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread -c $SOURCE -o Make/linuxGcc4DPOpt/mhdFoam.o
mhdFoam.C: In function 'int main(int, char**)':
mhdFoam.C:93: error: no match for 'operator==' in 'UEqn == Foam::operator-(const Foam::dimensioned<type>&) [with Type = double]()'
/home/zaki/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/cellModelI.H:124: note: candidates are: bool Foam::operator==(const Foam::cellModel&, const Foam::cellModel&)
/home/zaki/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/edgeI.H:147: note: bool Foam::operator==(const Foam::edge&, const Foam::edge&)
make: *** [Make/linuxGcc4DPOpt/mhdFoam.o] Error 1

My question is:
I guess the error is related to the most likely fact that pg is incorrectly handled in step (1). If my guess is correct, how should I specify pg as a constant source term?


zakifoam is offline   Reply With Quote

Old   March 8, 2007, 11:35
Default Look at the channelOodles code
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 14
eugene is on a distinguished road
Look at the channelOodles code. It imposes a pressure gradient to maintain a fixed mass flow.
eugene is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Source term for channel flow lofty OpenFOAM Running, Solving & CFD 5 April 4, 2008 08:49
Source term in two-phase flow chouki FLUENT 0 February 15, 2008 08:55
source term in multiphase flow+Urgent sara FLUENT 0 June 20, 2007 14:30
source term in multiphase flow+Urgent sara FLUENT 0 June 20, 2007 14:29
Source term of multiphase flow in CFX44 youngan CFX 0 September 28, 2003 22:27

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