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

Solving laplace equation using own code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2017, 04:03
Default Solving laplace equation using own code
  #1
New Member
 
krishna kant
Join Date: Aug 2017
Location: hyderabad
Posts: 4
Rep Power: 9
krishna_kant_IITH is on a distinguished road
Send a message via Skype™ to krishna_kant_IITH
Hello Foamers

I am on my quest of learning openfoam trying to solve laplace equation on my own without using laplacian function.

I am trying the following

#include "fvCFD.H"
#include "simpleControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar calculateTemperature(scalar x,int id);

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

simpleControl simple(mesh);

#include "createFields.H"
//#include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;
scalar x[1]={0};
scalar y[1]={0};
scalar z[1]={0};

while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

while (simple.correctNonOrthogonal())
{
gradT=fvc::grad(T);
for (label cellid= 0; cellid <mesh.C().size(); cellid++)
{
for (label faceid= 0; faceid <mesh.owner().size(); faceid++)
{
x[0]=mesh.Sf()[faceid].x();
y[0]=mesh.Sf()[faceid].y();
z[0]=mesh.Sf()[faceid].z();
T[cellid]=T[cellid]-runTime.deltaTValue()*1.00*(gradT.component(0)*x[0]+gradT.component(1)*y[0]+gradT.component(2)*z[0]);
}
}
}

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}

I am getting this error :
error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in assignment
for the line T[cellid] ...

Last edited by krishna_kant_IITH; August 28, 2017 at 10:10.
krishna_kant_IITH 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
Maximum number of iterations exceeded chtmultiregionsimpleFoam Moncef OpenFOAM Running, Solving & CFD 28 July 13, 2020 14:26
Suppress twoPhaseEulerFoam energy AlmostSurelyRob OpenFOAM Running, Solving & CFD 33 September 25, 2018 17:45
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 05:28
Wrong fluctuation of pressure in transient simulation caitao OpenFOAM Running, Solving & CFD 2 March 5, 2015 21:33
Error while running rhoPisoFoam.. nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 12:50


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