CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Unable to read the Temperature field with Paraview (https://www.cfd-online.com/Forums/openfoam-post-processing/230172-unable-read-temperature-field-paraview.html)

Francesco95 September 11, 2020 08:40

Unable to read the Temperature field with Paraview
 
Hi guys, I'm translating a solver with a conjugate heat transfer method implemented in interFoam from the version 2.2.1 of OF to the 7. I did it, and I was also able to run a test case, but when I try to visualize the result, I get an error by paraview for every processor, I show you just for one



Code:

  ERROR: In /home/ag600/OpenFOAM/ThirdParty-2.2.1/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
 vtkOpenFOAMReaderPrivate (0x2e89940): Error reading line 675043 of /media/ag600/D1/FrancescoLatella/TEST_MYMULTIREG_V7/processor39/0.0011/fluid/T.gz: Unmatched }
 p, li { white-space: pre-wrap; }

if I go to see what's is the problem inside the T.gz file at that line, I see that I have all the temperature values for each point of the mesh (so it seems that is working well and managinf with the temperature fields and the mesh well) but in one of the boundary conditions, the one coupled with the liquid domain, I have this



Code:

boundaryField
{
    top
    {
        type            regionCoupleHeatFlux;
        neighbourRegionName fluid;
        ownRegionName  solid;
        neighbourPatchName bottom;
        ownPatchName    top;
        neighbourFieldName T;
        ownFieldName    T;
        ownThermalConductivity KS;
        value 

      }

and the line that get me the error is exactly the line where there is "value" without other things and without the ";". Looking at the temperature file of this test case launched with the 2.2.1 version of this solver, this boundary conditions looks in this way


Code:

boundaryField
{
    top
    {
        type            regionCoupleHeatFlux;
        neighbourRegionName fluid;
        ownRegionName  solid;
        neighbourPatchName bottom;
        ownPatchName    top;
        neighbourFieldName T;
        ownFieldName    T;
        ownThermalConductivity KS;
        value          nonuniform List<scalar>

where you can see that there is not just "value" but "value nonuniform List<scalar". So it seems that this is the problem, that my translated solver is not making the new temperature files correctly.


Which should be the reason? :confused::confused: If anyone could help me I will be really thankfull! :):):):):D:D



What I was thinking is that, maybe a did some error in the solver's code when I create the solid and fluid meshes. I say this because I'm not really sure about what I did because interFoam 7 use the dynamicFVmesh class instead of the normal static mesh class, so I tried to use this new class just trying to modify arguments and see what happen. I put also my createDynamicMesh.H file here if anyone will see some error in how I used this class


Code:

Info<< "Creating meshes "
        << runTime.timeName() << nl << endl;

// **********************************************************************
//  Fluid mesh
// **********************************************************************
    autoPtr<dynamicFvMesh> fluidmeshPtr
    (
        dynamicFvMesh::New
        (
            IOobject
            (
                "fluid",
                //dynamicFvMesh::fluid,
                runTime.timeName(),
                runTime,
                IOobject::MUST_READ
            )
        )
    );

    dynamicFvMesh& fluidMesh = fluidmeshPtr();

// **********************************************************************
//  Solid mesh
// **********************************************************************
    autoPtr<dynamicFvMesh> solidmeshPtr
    (
        dynamicFvMesh::New
        (
            IOobject
            (
                "solid",
                //dynamicFvMesh::solid,
                runTime.timeName(),
                runTime,
                IOobject::MUST_READ
            )
        )
    );

    dynamicFvMesh& solidMesh = solidmeshPtr();


Francesco95 September 11, 2020 09:07

Error in the post
 
Thank you in advance to anyone will help me!

olesen September 11, 2020 11:43

Quote:

Originally Posted by Francesco95 (Post 782564)
Hi guys, I'm translating a solver with a conjugate heat transfer method implemented in interFoam from the version 2.2.1 of OF to the 7. I did it, and I was also able to run a test case, but when I try to visualize the result, I get an error by paraview for every processor, I show you just for one

if I go to see what's is the problem inside the T.gz file at that line, I see that I have all the temperature values for each point of the mesh (so it seems that is working well and managinf with the temperature fields and the mesh well) but in one of the boundary conditions, the one coupled with the liquid domain, I have this

Code:

boundaryField
{
    top
    {
        type            regionCoupleHeatFlux;
        neighbourRegionName fluid;
        ownRegionName  solid;
        neighbourPatchName bottom;
        ownPatchName    top;
        neighbourFieldName T;
        ownFieldName    T;
        ownThermalConductivity KS;
        value 
      }

and the line that get me the error is exactly the line where there is "value" without other things and without the ";".


Having "value" with nothing else looks pretty bad. You might want to review how boundary condition is actually emitting the values. Starting with OpenFOAM-v1712, many of the dictionary write key/value constructs were augmented with a simpler Ostream::writeEntry() method, but the older methods were left intact (for compatibility etc).

However you are using the openfoam.org version, you probably needed to rewrite some of your output code. Some of the more recent openfoam.org versions did something similar to the openfoam.com version, but decided to make it an output template instead of a method and removed the old methods. Although it generally should work, but it could be that you are missing a template specialization somewhere that is causing your output to be swallowed. Not really sure what else to suggest. Depending on which models you use, could also try with OpenFOAM-v2006 and see how that works out.

Francesco95 September 12, 2020 10:11

Hi Olesen, thank you for the quick reply. Here is how my boundary conditions do the output I guess


Code:

//- Write
void Foam::regionCoupleTemperatureFvPatchScalarField::write
(
    Ostream& os
) const
{
    fvPatchScalarField::write(os);
    coupleManager_.writeEntries(os);
    os.writeKeyword("Kappa") << Kappa_ << token::END_STATEMENT << nl;
  writeEntry( os, "value"); //writeEntry("value", os);
 
}


and I guess that the line that makes me problems is "writeEntry( os, "value");" but unfortunately I'm not familiar with this part of a code so it's a bit tricky for me to understand how to modify it. Consider that, this code is working in the 2.2.1 version of OF but not in the 7.


All times are GMT -4. The time now is 15:47.