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

Adding a Source Term to an User Defined transport equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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
Location: England, United Kingdom
Posts: 2
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: 261
Rep Power: 22
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


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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
Reaction Source Term in Steady Species transport equation cfdvenkatesh Main CFD Forum 0 August 19, 2010 10:28


All times are GMT -4. The time now is 21:08.