|
[Sponsors] |
Deletion of volScalarField object in PimpleFoam Solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 8, 2018, 12:53 |
Deletion of volScalarField object in PimpleFoam Solver
|
#1 |
New Member
Muhammad Arslan Ansari
Join Date: Aug 2018
Posts: 1
Rep Power: 0 |
Hi,
I am rather new to OpenFOAM and currently I am working with PimpleFoam solver. For Testing purposes I have created a test field with the object named Test, besides pressure (p) and valocity (U) in createFields.H file. Now the thing is, after I finish my simulations I want to delete the test object of volScalarField. Now if I use the simple delete() function, the error which pops up, states that: error: type ‘Foam::volScalarField {aka class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ argument given to ‘delete’, expected pointer delete(Test); Any suggestions how would I take care of this memory leak? It is not important for the task which I am trying to do, but it would be nice to know about efficient memory management in OpenFOAM. |
|
August 9, 2018, 18:01 |
|
#2 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
a normal variable such as Code:
int myNumber; double myDouble; scalarField foo; Code:
double* myDouble; To deallocate the memory, you can use the delete function. Again, the volScalarField is not a pointer. To make it a pointer, you have to do it in a different way such as: Code:
volScalarField* myNewField = new volScalarField(...); . . . . myNewField->delete(); // Or delete(myNewField); Summing up. The problem you have is a pure C++ problem. Not related to FOAM.
__________________
Keep foaming, Tobias Holzmann |
|
Tags |
memoryleak, pimplefoam, volscalarfield |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Population Balance Modeling (PBM) - Ansys Fluent | chittipo | FLUENT | 164 | November 18, 2023 12:54 |
engineFoam with layers - pressure problems when adding layers | mturcios777 | OpenFOAM Running, Solving & CFD | 23 | January 4, 2023 22:56 |
Star cd es-ice solver error | ernarasimman | STAR-CD | 2 | September 12, 2014 01:01 |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 04:23 |