|
[Sponsors] |
"Copy" element of a PtrList into another ListPtr |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 27, 2019, 09:35 |
"Copy" element of a PtrList into another ListPtr
|
#1 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10 |
Hey,
I have results from another run that I want to import, (on a different dt as the current one) I would like to keep a field with the previous values and one for the next value (to interpolate between both of them). For now I have something like Code:
PtrList<pointScalarField> potPhiPrevious(externalPhiRegions.size()); PtrList<pointScalarField> potPhiNext(externalPhiRegions.size()); Code:
forAll(externalPhiRegions, i) { potPhiPrevious.set ( i, new pointScalarField ( IOobject ( "Phi", pTime, externalPhiRegions[i], IOobject::MUST_READ, IOobject::NO_WRITE ), pMesh ) ); } The problem is at some times, I need to send potPhiNext[i] into potPhiPrevious[i], and then read the new potPhiNext[i]. I've tried everything I could think of ( Code:
potPhiPrevious.set(i, potPhiNext[i]); potPhiPrevious[i]=potPhiNext[i]; Code:
#3 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::Boundary::Boundary(Foam::DimensionedField<double, Foam::pointMesh> const&, Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::Boundary const&) at ??:? #4 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::GeometricField(Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh> const&) at ??:? #5 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::clone() const at ??:? #6 Foam::tmp<Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh> >::ptr() const at ??:? Thanks a lot! Last edited by frobaux; May 28, 2019 at 10:09. |
|
May 28, 2019, 10:32 |
|
#2 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10 |
After a entire day of following error, debugging and trying new stuffs, the only solution I came with was rereading it completely.
But the same problem appeared for the interpolated in time (I use a simple linear interpolation) I set this one to be written at each time step: Code:
potPhi.set ( i, new pointScalarField ( IOobject ( "Phi_interp", runTime.timeName(), externalPhiRegions[i], IOobject::NO_READ, IOobject::AUTO_WRITE ), potPhiPrevious[i]*(1-alph)+potPhiNext[i]*alph ) ); Code:
#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 ? in "/lib/x86_64-linux-gnu/libc.so.6" Also, when I try to print potPhiPrevious[0].internalField() it always send an error like: Code:
... -2.24018e-09 -2.53537e-09 -2.85198e-09 ) ; boundaryField { #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::Boundary::writeEntries(Foam::Ostream&) const at ~/These/OpenFOAM/v1712/OpenFOAM-v1712/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:586 #4 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::Boundary::writeEntry(Foam::word const&, Foam::Ostream&) const at ~/These/OpenFOAM/v1712/OpenFOAM-v1712/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:574 (discriminator 2) #5 Foam::Ostream& Foam::operator<< <double, Foam::pointPatchField, Foam::pointMesh>(Foam::Ostream&, Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh> const&) at ~/These/OpenFOAM/v1712/OpenFOAM-v1712/src/OpenFOAM/lnInclude/GeometricField.C:1337 (discriminator 2) #6 Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>::writeData(Foam::Ostream&) const at ~/These/OpenFOAM/v1712/OpenFOAM-v1712/src/OpenFOAM/lnInclude/GeometricField.C:1036 #7 ? at ~/These/OpenFOAM/v1712/OpenFOAM-v1712/src/OpenFOAM/lnInclude/DimensionedFieldIO.C:151 #8 ? at ~/OpenFOAM/robaux-v1712/applications/solver/myCoupledHPCSolver/./externalPhi/createExternalPhiFields.H:115 (discriminator 7) #9 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #10 ? at ??:? Thanks a lot ! |
|
June 4, 2019, 04:57 |
|
#3 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10 |
well, after a while and reading all treads containing PtrList and pointScalarField, I ended up finding the error, and it was my mistake..
The Sigrev error meant that there was empty memory somewhere and I tought it was due to the PtrList stuffs, but I was actually due to the fact that the pointMesh(es) associated with the pointScalarField(s) were not stored in memory. I endend up adding a PtrList<pointMesh> pMeshes(type1Regions.size()) |
|
Tags |
copy, ptrlist, reference, regions |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] 3D Mesh conversion from gmsh-2.5.0 to OpenFOAM | Ancioi | OpenFOAM Meshing & Mesh Conversion | 17 | January 9, 2019 00:50 |
Identifying Markers in a CGNS Mesh | tjim | SU2 | 3 | October 12, 2018 02:21 |
[Other] Mesh Importing Problem | cuteapathy | ANSYS Meshing & Geometry | 2 | June 24, 2017 06:29 |
Temperature linearly rising after restarting a simulation | Gennaro | OpenFOAM Programming & Development | 2 | September 2, 2014 08:58 |
autoPatch error, mesh quality related...? | Alexvader | OpenFOAM | 0 | October 6, 2011 18:57 |