Deletion of volScalarField object in PimpleFoam Solver
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. |
Hi,
a normal variable such as Code:
int myNumber; 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:
Summing up. The problem you have is a pure C++ problem. Not related to FOAM. |
All times are GMT -4. The time now is 05:16. |