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

unable to use fvc::ddt correctly

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 6, 2012, 00:23
Default unable to use fvc::ddt correctly
  #1
New Member
 
Mandeep
Join Date: Aug 2012
Location: Canada
Posts: 9
Rep Power: 13
Rocky4 is on a distinguished road
i am working on melting problem of pure gallium based on enthalpy porosity technique.(Voller)
to start with i m neglecting fluid flow and using laplacian foam.
energy eqn requires a additional source term in the form of time derivative of latent heat content of each cell which inturn is based on temperature of each cell computed in previous time step. the problem is fvc:: ddt(DH) IS UNABLE RECOGNIZE oldtime step value of DH and sets it to zero ie
DHold=0,DHcurrent=DH.
I FOLLOWED the remarks on DDT in the thread
http://www.cfd-online.com/Forums/openfoam-solving/58580-ddt.html
ie i have defined DH OUTSIDE the timeloop
and used.oldtime() WHILE CREATING DH FIELD
but still the oldtime values of DH are set to zero while computing ddt(DH) rather than actual oldtime values .
I have tried a few things to make it work and got some different results
if the DH field in sources file is updated on a whole ,say arbitrarily as DH=DH+L
where L-latent heat
instead of cellwise updation.
then ddt(DH) uses the oldtime value of DH instead of setting to zero.however when updation of DH is made on cell by cell basis using forALL then
DHoldtime=0 is used for ddt(DH) COMPUTATION

ALSO if i dont use intermediate variable FT AND UPDATE DH directly using forALL the ddt(DH) is computed as zero meaning that DHoldtime is set to current value. the relevant portion of code is as follows
create fields
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField lf
(
IOobject
(
"lf",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(
"lf", dimless, 0)
);

volScalarField ST
(
IOobject
(
"ST",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(
"ST", dimTemperature/dimTime, 0)
);
Info<<
"Reading field DH\n" << endl;
volScalarField DH
(
IOobject
(
"DH",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
DH.oldTime();
mesh,
dimensionedScalar(
"DH", dimLength*dimLength/(dimTime*dimTime), 0)
);
main code
#include"fvCFD.H"
#include"simpleControl.H"
#include"IFstream.H"
#include"OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include"setRootCase.H"
#include"createTime.H"
#include"createMesh.H"
#include"readProperties.H"
#include"createFields.H"
simpleControl simple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nCalculating temperature distribution\n" << endl;
while (simple.loop())
{
Info<<
"Time = " << runTime.timeName() << nl << endl;
while (simple.correctNonOrthogonal())
{
#include"sources.H"
# include"TEqn.H"
}
#include"write.H"
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<<
"End\n" << endl;
return 0;
}
sources
/cellwise updation of latent heat content for each time step
forAll(mesh.cells(),celli)
{
if (T[celli] > Tm.value())
{
FT[celli] = L.value();
}
if (T[celli] < Tm.value())
{
FT[celli] = 0;
}
};
DH=FT;
lf=DH/L;


ST = fvc::ddt(DH)/Cp;
// Solve energy equation


fvScalarMatrix TEqn
(
fvm::ddt(T)

- fvm::laplacian(DT, T)
==
- ST

);
TEqn.solve();
why the usage of forALL for updating cell value of FT/DH, affects the oldtime values while evaluating ddt(DH)? whereas as updation of the entire field on a whole does not cause any problem in oldtime values while evaluatng ddt(DH).Is there any other way to update field variable on cell by cell basis without affecting ddt(DH) evaluation? In nutshell why the use of forAll makes the object DH local thereby setting it to zero at the start of each new timestep and what's the remedy?

any kind of help is greatly appreciated. thanks in advance.sorry for such a long post but i wanted to express my point clearly.


Last edited by Rocky4; October 7, 2012 at 00:28.
Rocky4 is offline   Reply With Quote

Old   October 10, 2012, 20:39
Default sorry foamers
  #2
New Member
 
Mandeep
Join Date: Aug 2012
Location: Canada
Posts: 9
Rep Power: 13
Rocky4 is on a distinguished road
the DHold was becoming zero due to some other reason(related to algorithm of enthalpy method) and not due to usage of forAll .Sorry for troubling everyone.
Rocky4 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sun Grid Engine grtabor OpenFOAM Running, Solving & CFD 28 August 22, 2012 10:27
interFoam & decomposition method: scotch MacGyver OpenFOAM Running, Solving & CFD 2 May 23, 2012 08:00
openfoam 1.6 on debian etch romant OpenFOAM Installation 9 May 6, 2010 03:26
fluent nithin20k Main CFD Forum 1 January 12, 2010 20:37
[Commercial meshers] ST_Malloc: out of memory.malloc_storage: unable to malloc Velocity SA, cfdproject OpenFOAM Meshing & Mesh Conversion 0 April 14, 2009 16:45


All times are GMT -4. The time now is 02:44.