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

Transport Equation for a scalar - Compressible Solver

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

Like Tree1Likes
  • 1 Post By l_r_mcglashan

Reply
 
LinkBack Thread Tools Display Modes
Old   January 25, 2011, 14:22
Default Transport Equation for a scalar - Compressible Solver
  #1
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
Hi, I am a beginner with OF and I am new in the programming of the code.

I have to modify XiFoam, premix solver for turbulent combustion (which is rhoPisoFoam without any combustion) adding simply a new scalar transport equation for a variable ''C".

The equation is on the form of:

d/dt(rho*C)+rho*Ud/dxj(C) - laplacian(rho*nu * C) = ST

where the ST is the source term for the scalar.

The solver XiFoam is composed on the following files:

bEqn.H
createFields.H
ftEqn.H
hEqn.H
huEqn.H
Make (directory)
pEqn.H
readCombustionProperties.H
UEqn.H
XiFoam.C
XiFoam.dep

1) I have changed the names regarding XiFoam in NewXiFoam and the path of compilation (make/files).

2)I have created the file "Ceqn.H" and typed the following code:

solve
(
fvm::ddt(rho, C)
+ fvc::div(phi, C)
- fvm::laplacian(nu, C) == f
);

where f is taken from a table.

2) on the NewXiFoam.C I have added the following script on the code at the beginning the PISO loop:

for (int corr=1; corr<=nCorr; corr++)
{
#include "pEqn.H"
#include "Ceqn.H"
}

turbulence->correct();

3)on the "createFields.H"

I have added the script :

Info<< "\nReading field C\n" << endl;
volScalarField C
(
IOobject
(
"C",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Now everything should be done and after the compilation "wmake" it gives 1 error. Could you please tell if the steps for this compressible solver are the correct ones or not and what I should take car of.

Thanks,
alex
alessio.nz is offline   Reply With Quote

Old   January 26, 2011, 03:17
Default
  #2
Member
 
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 8
smehdi609 is on a distinguished road
It can be several things, like syntas error, unit error and so on. You should post that so that we can help you. BTW, I bet you are implmenting PCM-FPI.
smehdi609 is offline   Reply With Quote

Old   January 26, 2011, 04:46
Default
  #3
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 446
Rep Power: 11
mvoss is on a distinguished road
hi,
did you try a wclean before wmake? what is wmake complaining about?
how did you set up the table for "f"? I mean,... is it read from an external file?

neewbie
mvoss is offline   Reply With Quote

Old   January 26, 2011, 12:58
Default
  #4
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
thanks to all of you! finally, after checking all things, I succeed!
alessio.nz is offline   Reply With Quote

Old   January 27, 2011, 05:39
Default
  #5
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
d/dt(rho*C)+rho*Ud/dxj(C) - laplacian(rho*nu * C) = ST

The above equation does not match what you've programmed below:

solve
(
fvm::ddt(rho, C)
+ fvc::div(phi, C)
- fvm::laplacian(nu, C) == f
);
solefire likes this.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   April 11, 2013, 09:04
Smile
  #6
New Member
 
Lorenzo Bartolucci
Join Date: Oct 2012
Location: Rome - University of Tor Vergata
Posts: 3
Rep Power: 4
Barlo is on a distinguished road
I'm sorry Alex, I'm interested in change XiFoam solver too, could you post your "well-done" code below, please? Thank you
Lorenzo
Barlo is offline   Reply With Quote

Reply

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
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
compressible flow solver in OF1.6 mecbe2002 OpenFOAM 9 December 25, 2010 10:17
interFoam + a scalar transport equation CYMa OpenFOAM 1 May 11, 2010 03:50
Is it possible to influence the velocity of an scalar transport equation? jannnesss CFX 1 January 11, 2010 13:02
scalar advection-diffusion equation Darcy CFX 1 March 12, 2001 10:49


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