basicThermo.C in foam-extend-3.0, declared differently from OpenFOAM-1.6-ext
Hello! I am porting a solver from OpenFOAM-1.6-ext to foam-extend-3.0. Looks like the basicThermo class is declared differently in $FOAM_SRC/thermophysicalModels/basic/basicThermo/basicThermo.C under ***Constructors***
OF-1.6-ext: Foam::basicThermo::basicThermo(const fvMesh& mesh) foam-extend-3.0: Foam::basicThermo::basicThermo(const fvMesh& mesh, const objectRegistry& obj) In my code before, I only needed "basicThermo(U.mesh())" but now I understand I need another argument that is from the objectRegistry. What should that be? Also, excuse/feel free to correct my incorrect terminology - I am still learning the c++ jargon. Thanks! ---------- [edit] forgot to mention that I tried using runTime as the objectRegistry variable(?). In my solver, I put in: const objectRegistry& runTimeObjectRegistry and basicThermo(U.mesh(), runTimeObjectRegistry), This allowed my solver to compile, but when I run a case it gives this result: Quote:
|
Hi Alex,
In your post you describe that you create runTimeObjectRegistry as a const reference, but where is the const reference pointing to? (The rest of the line is missing in your post.) You get a run-time error because you created a new objectRegistry, which is empty and field "p" cannot be found there. What you want to do instead is provide access to the objectRegistry that is "in use" within your application and that has all the fields and dictionaries. You can grab it from the mesh object via mesh.thisDb() . But since mesh is of class fvMesh and fvMesh is derived from polyMesh which is derived from objectRegistry (Doxygen is your friend here and gives a nice picture showing the relationship), you can pass "mesh" as second argument as well and it will be automatically stripped down to an objectRegistry object. So calling: basicThermo(mesh,mesh) should do the job. Best regards, Dominik |
Thanks for the response! Unfortunately I'm not sure if I made the changes correctly. I changed the call to basicThermo as you suggested and when I compile, I get this:
Quote:
basicThermo(mesh_,mesh_) and it seems to compile correctly. When I run a case, I get a "segmentation fault". On openfoamwiki.net, it says Quote:
|
RESOLVED!
basicThermo(U.mesh(),U.mesh()) Thanks again! |
All times are GMT -4. The time now is 00:55. |