|
[Sponsors] |
August 13, 2014, 08:38 |
autoPtr in Openfoam code
|
#1 |
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 |
Hi,
I am pretty new to Openfoam and now trying to dig into the code. If anybody can explain what is autoPtr, I met it several times but can not find any information about it. eg. Code:
autoPtr<motionSolver> motionPtr_ Best regards Hao |
|
August 14, 2014, 08:48 |
|
#2 |
Senior Member
|
Hi Hao,
an autoPtr<T> is a smart pointer, which is basically "nothing more" than a wrapper around C++ pointers and handles e.g. garbage collection in an automatic fashion. Resources are released automatically, when they are out of scope. Good luck with the dynamic meshes Jens
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
August 14, 2014, 09:25 |
|
#3 |
Member
Eric M. Tridas
Join Date: May 2011
Location: Tampa, Florida
Posts: 48
Rep Power: 14 |
So if I understand correctly, using "autoPtr<T>" is preferable to using "new T()"?
|
|
August 14, 2014, 09:40 |
|
#4 |
Senior Member
|
autoPtr<T> myVar is preferable to T* myVar.
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
August 14, 2014, 09:46 |
|
#5 |
Member
Eric M. Tridas
Join Date: May 2011
Location: Tampa, Florida
Posts: 48
Rep Power: 14 |
That makes sense. Thanks!
|
|
August 14, 2014, 09:47 |
|
#6 |
Senior Member
|
No problemo
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
August 15, 2014, 04:46 |
|
#7 | |
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 |
Hi Jens,
Thanks very much! And one more question is that I can see in dynamic motion solver fv mesh, there are displacement laplacian and velocity laplacian, but I found one more mesh class called laplace...which equation does it solve? I can not find the source code of it... Also waiting for your Openfoam book! Hao Quote:
|
||
August 15, 2014, 08:13 |
|
#8 |
Senior Member
|
There are several types of motionSolvers:
For displacementLaplacianFvMotionSolver it solves Laplace equation: Code:
void Foam::displacementLaplacianFvMotionSolver::solve() { // The points have moved so before interpolation update // the motionSolver accordingly movePoints(fvMesh_.points()); diffusivity().correct(); pointDisplacement_.boundaryField().updateCoeffs(); Foam::solve ( fvm::laplacian ( diffusivity().operator()(), cellDisplacement_, "laplacian(diffusivity,cellDisplacement)" ) ); }
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
August 15, 2014, 09:02 |
|
#9 | |
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 |
Hi Jens,
I see, thank you! Another thing is when I select some diffusivity models, say exponential or quadratic, the error shows that: attempt to read beyond EOF, but normally uniform diffusivity is OK...Do you have any idea about the reason? Best regards Hao Quote:
|
||
August 15, 2014, 09:41 |
|
#10 |
Senior Member
|
Maybe you are missing a parameter? Or a semicolon? Look in the source code of the particular model you use, and check which parameters it requires.
__________________
Blog: sourceflux.de/blog "The OpenFOAM Technology Primer": sourceflux.de/book Twitter: @sourceflux_de Interested in courses on OpenFOAM? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 12:25 |
How to calculate Reynolds stress tensor in OpenFOAM code. | yzf1215 | OpenFOAM Programming & Development | 1 | October 26, 2013 07:25 |
OpenFOAM Foundation releases OpenFOAM 2.2.2 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | October 14, 2013 07:18 |
How to code integral of (DU/Dt - 2000 ) in openFoam | erncyc | OpenFOAM | 5 | September 13, 2012 06:33 |
OpenFOAM for subsurface flow, or coupling with a subsurface flow code? | chljl | OpenFOAM Running, Solving & CFD | 0 | February 14, 2012 19:38 |