|
[Sponsors] |
![]() |
![]() |
#1 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14 ![]() |
I have a really odd bug in a simple application for OF v8 that I have written to calculate some initial fields. The code updates some values in constant/thermophysicalProperties using:
Code:
IOdictionary thermoDict( IOobject( "thermophysicalProperties", "constant", mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ) ); thermoDict.subDict("mixture").subDict("equationOfState").set("rho0",abl.rho0); thermoDict.regIOobject::write(); Can anyone give me a hint as to why the class is changed on rewriting the dictionary? |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14 ![]() |
I should have been clearer in my first post Domenico. At the top of every foam file is a header with something like the following text:
Code:
FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object thermophysicalProperties; } Now what is bizarre is that I open thermophysicalProperties, adjust some of the contents and then write it out, and suddenly the headerClassName changes from dictionary to volScalarField. I tried moving just the lines above into a new app, and the bug doesn't happen (!), so there must be something subtle going on. I'll keep testing. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
|
Very sorry to say that I am still in the mist.
Are you running an application that creates constant/thermophysicalProperties for you? I am happy to keep read attentively whatever you send across. |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14 ![]() |
Ok - weirder and weirder ... I am now printing out the contents of headerClassName:
Code:
Info << thermoDict.regIOobject::headerClassName() << endl; |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14 ![]() |
Yes - or rather it updates some of the values as well as setting up the initial fields. I am slowly narrowing down what the cause is - the good old fashioned way of comment everything out, and slowly uncomment until the problem occurs, and voila - you have found your culprit.
|
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14 ![]() |
Well, I have found the culprit. I needed to pull out the value of kappa from the wall boundary, to use in the initial fields calculation, but rather crudely I had opened the nut file as a IOdictionary rather than a volScalarField. For some reason this then caused thermoDict, opened later as a IOdictionary, to write as a volScalarField! Very odd, but a problem of my making I guess.
I'll need to find another way of stripping out kappa from the nut file. |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
temperature negative occurred in rhoCentralFoam at high M | longming | OpenFOAM Running, Solving & CFD | 10 | February 25, 2024 23:46 |
Read from dictionary inside new smoother class | TommyGun | OpenFOAM Programming & Development | 3 | May 22, 2020 18:08 |
given a volScalarField object, how to read inputs from its dictionary | anon_q | OpenFOAM Programming & Development | 6 | August 9, 2019 02:07 |
driftFluxFoam viscosity model modification problem | dleduc | OpenFOAM Programming & Development | 15 | October 1, 2018 09:37 |
Compressible 2D airfoil rhoSimpleFoam fatal error volScalarField none | jfournier | OpenFOAM Running, Solving & CFD | 4 | September 28, 2017 06:28 |