CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Hartmann flow constant source term (http://www.cfd-online.com/Forums/openfoam-solving/59783-hartmann-flow-constant-source-term.html)

zakifoam March 8, 2007 11:22

Dear all, I'm working on si
 
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::ddt(U)
+ 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
(
transportProperties.lookup("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_DIR=.
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?

Thanks,

zaki

eugene March 8, 2007 11:35

Look at the channelOodles code
 
Look at the channelOodles code. It imposes a pressure gradient to maintain a fixed mass flow.


All times are GMT -4. The time now is 05:11.