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

Adding a Source Term to an User Defined transport equation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 1, 2017, 19:00
Default Adding a Source Term to an User Defined transport equation
  #1
rma
New Member
 
Anonymous
Join Date: Jan 2017
Posts: 1
Rep Power: 0
rma is on a distinguished road
Hello everyone,

I have added a new transport equation to an existing solver, and I have all the bits working but the source term.

That source term takes the following form: div(K*scalarField*vectorField)

with K being a constant.

Therefore, I have created in createFields.H an volVectorField countaining that product, so I can easily take the divergence afterwards in the solvers's '.C' file.

volVectorField sourceTerm
(
IOobject
(
"sourceTerm",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
K*scalarField*vectorField
);

Then, in the '.C' file of the solver I do:

sourceTerm=K*scalarField*vectorField;

fvScalarMatrix uds1Eqn
(
fvm::ddt(uds1)
- fvm::laplacian(D_uds1, uds1)
==
- fvc::div(sourceTerm)
);

uds1Eqn.solve();

Everything compiles fine, but when I am running the solver, I get the following error:

--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/rma/OpenFOAM/Pruebas/case/system/fvSchemes.divSchemes.div(sourceTerm) at line 33.

From function ITstream::read(token&)
in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting


However, the fvSchemes file does have that scheme specified:

divSchemes
{
default Gauss upwind;
div(phi,U) Gauss limitedLinearV 1;
div(sourceTerm) Gauss upwind;
}


I don't really know how to proceed from here, maybe that is not the way I am suppossed to create a source term, so I would really appreciate if someone could help me with this problem.

Thank you very much.
rma is offline   Reply With Quote

Old   January 2, 2017, 06:55
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 199
Rep Power: 13
Zeppo will become famous soon enough
http://cfd.direct/openfoam/user-guid...19-1400004.4.3
Code:
divSchemes
{
    div(sourceTerm) Gauss upwind;
}
requires you to specify "the (volumetric) flux of velocity on the cell faces for constant-density flows and the mass flux for compressible flows"
Code:
div(phi, sourceTerm) Gauss upwind;
Depending on the physical meaning of the term you might be happy with
Code:
div(sourceTerm)         Gauss linear;
Zeppo 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
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
Swak4Foam funkyDoCalc with OF2.3 massflow NiFl OpenFOAM 11 November 1, 2016 07:43
swak4foam building problem GGerber OpenFOAM Installation 54 April 24, 2015 16:02
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
Reaction Source Term in Steady Species transport equation cfdvenkatesh Main CFD Forum 0 August 19, 2010 09:28


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