-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Current State
Currently the blastAMR model does not work with some turbulence models, in particular the kOmegaSST turbulence model. The reason for this can be found in the balancing of the mesh.
The mesh is balanced in blastAMR using the fvMeshDistribute class and from it the fvMeshDistribute::distribute() function. This function calls prior to sending the fields the fvMesh::clearOut() function (In OpenFOAM v2012 this is in line 2033 of fvMeshDistribute.C).
This function then calls the polyMesh::clearOut() which itself calls polyMesh::clearAddressing(), note that the flag isMeshUpdate is set by default to false. Consequently, the meshObject::clear() is called deleting all TopologicalMeshObject<fvMesh> objects, which is unfortunately the wallDist class.
This leads then to a pointer error when turbulence::correct() is called. Particularly for the k-omega SST model, as in kOmegaSSTBase.C in the F2 function, the square of the y field is required. However, the y field in kOmegaSSTBase was a const reference to the wallDist object created with MeshObject::New(). Hence, the pointer exception when the underlying wallDist model has been destroyed in the MeshObject::clear() command.
Potential Solution
In fvmeshPolyRefiner, when the hasChanged check is made, an additional function called updateTurbulenceModel could be implemented. Due to kOmegaSST having a const reference to the y field it is broken and needs to be destroyed. The solution would then be to look up the turbulence model in the object registry, destruct the turbulence model, and reconstruct the turbulence model. I am unsure if one can do this while keeping the autoPtr in createFields valid.