CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Error while trying to read volVectorField (https://www.cfd-online.com/Forums/openfoam/93166-error-while-trying-read-volvectorfield.html)

blackbirdinapie October 6, 2011 17:12

Error while trying to read volVectorField
 
Hello,

I am trying to read a volVectorField "D" from the output of solidDisplacementFoam. However, I get a strange error. This is error was also seen in the following thread http://www.cfd-online.com/Forums/ope...ntialfoam.html
but was not solved. I paste the whole error message below.


/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.0.0-a317a4e7cd55
Exec : gapField2 2000 gen
Date : Oct 06 2011
Time : 15:42:36
Host : steele-fe00.rcac.purdue.edu
PID : 20087
Case : /usr/rmt_share/scratch96/s/sdhar/sujan/IMGenerator/utils/inertiaRelief/BearingPlateBM
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL ERROR:
Attempt to cast type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE

From function dynamicCast<To>(From&)
in file /apps/rhel5/OpenFOAM/OpenFOAM-2.0.0/src/OpenFOAM/lnInclude/typeInfo.H at line 93.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/apps/rhel5/OpenFOAM/OpenFOAM-2.0.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/apps/rhel5/OpenFOAM/OpenFOAM-2.0.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 Foam::token::Compound<Foam::List<Foam::Vector<doub le> > >& Foam::dynamicCast<Foam::token::Compound<Foam::List <Foam::Vector<double> > >, Foam::token::compound>(Foam::token::compound&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#3 Foam::Istream& Foam::operator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#4 Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#5 Foam::tractionDisplacementFvPatchVectorField::trac tionDisplacementFvPatchVectorField(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#6 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::tractionD isplacementFvPatchVectorField>::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#7 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::dictionary const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#11 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/ba01/u136/sdhar/local_apps/gapField2"
#12 main in "/home/ba01/u136/sdhar/local_apps/gapField2"
#13 __libc_start_main in "/lib64/libc.so.6"
#14 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/home/ba01/u136/sdhar/local_apps/gapField2"
Aborted

Any help will be much appreciated..

Sujan

ata October 7, 2011 03:59

Error while trying to read volVectorField
 
Hi
It seems that you want to cast one type to volVectorField that this type casting is not permitted.
Good luck
Ata

tomislav_maric October 7, 2011 05:03

Quote:

Originally Posted by ata (Post 327010)
Hi
It seems that you want to cast one type to volVectorField that this type casting is not permitted.
Good luck
Ata

Can you post your code here?

T.

blackbirdinapie October 11, 2011 11:20

Thanks for your replies! The code is trying to read an existing volVectorField from a given directory..
The code is

#include "fvCFD.H"
#include "Switch.H"

#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

double round (double val, int digits) {
std::ostringstream oss;
oss.precision(digits);
oss.setf(std::ios::fixed);
oss << val;
std::istringstream iss;
iss.str(oss.str());
double rounded;
iss >> rounded;
return rounded;
}


int main(int argc, char *argv[])
{

argList::validArgs.append("numIter");
argList::validArgs.append("face");

#include "setRootCase.H"
#include "createTime.H"
#include "mesh.H"
#include "createFields.H" <---------------- This is the line with problem

Inside createFields.H

volVectorField D1
(
IOobject
(
"D",
"./1",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
// dimensionedVector("D", dimensionSet(0,1,0,0,0,0,0), vector(0.0,0,0))
);

There already exists a D volVectorField (with boundaryField of type tractionDisplacement) , and code just tries to read it. I have a feeling this has something to do with the tractionDisplacement BC, because when reading a volVectorField with boundaryField of another type, the code has no problem.

I greatly appreciate all the help! Thanks!

Sujan

tomislav_maric October 12, 2011 04:08

Could you pack the case and the whole app and upload it in your post? This way I don't have to reproduce your createFields.H and the tutorial case... :D

T.

blackbirdinapie October 12, 2011 15:56

Hi T,

Thanks a lot for your help.

I have uploaded both the case on which I am trying to run my app (BearingPlateBM), as well as the app itself (gapField2). The command to run the app is "gapField2 1 gen" on rapidshare in the link below. They were too large to attach with this message :).

https://rapidshare.com/files/44870168/OF.zip

I investigated it more, and it really seems to be a problem of the tractionDisplacement BC, especially when the traction field on the boundaries is non - zero

Thanks a lot once again!! Please let me know if you have questions regarding running the case.

Sujan

tomislav_maric October 14, 2011 06:16

Hi,

you seem to be reading the field D from the directory "1", I have opened the file and I saw this:

Code:

53611    forcePoint
153612    {
153613        type            tractionDisplacement;
153614        traction        nonuniform 0();
153615        pressure        nonuniform 0();
153616        value          nonuniform 0();
153617    }
153618    junk
153619    {
153620        type            tractionDisplacement;
153621        traction        nonuniform 0();
153622        pressure        nonuniform 0();
153623        value          nonuniform 0();
153624    }

"nonuniform0()" : where does it come from? This seems wrong. Also, why are some patches missing? What exactly does your program do? What is the purpose of the boundary condition?

I've used gdb on the program and you have to go deeper than createFields:

Code:

108        return readField(dictionary(is));
this is the line of the GeometricField.H, which menas that the field D is failing because a bad dictionary entry. My guess is nonuniform 0(); key-value pair.

Can you change this and let me know what happens?

Best,
Tomislav

blackbirdinapie October 14, 2011 15:16

Hi T.

Thanks for checking it out. Actually, this part of the code is a part of a larger project that i am working on for my research. Essentially it generates a Compliance Matrix, using a variant of the solidDisplacementFoam solver.

The D file in ./1 is an output of the stress solver. Actually, on my personal Ubuntu 10 install the gapField code works well if you remove the first line from the ./Make/files text file.. i.e delete <tractionDisplacement/tractionDisplacementFvPatchVectorField.C>.

However, on a Dell Compute Cluster running Red Hat Enterprise Linux 5.5, this fix does not work. I am very confused about this.

Please try to delete <tractionDisplacement/tractionDisplacementFvPatchVectorField.C> from Make/files and then try running gapField. Since it runs when compiled in a slightly different way, I dont think the problem is in the "D" file. What do you think?

Thanks a lot for your help,

Sujan

tomislav_maric October 15, 2011 05:09

Quote:

Originally Posted by blackbirdinapie (Post 327974)
Hi T.

Thanks for checking it out. Actually, this part of the code is a part of a larger project that i am working on for my research. Essentially it generates a Compliance Matrix, using a variant of the solidDisplacementFoam solver.

The D file in ./1 is an output of the stress solver. Actually, on my personal Ubuntu 10 install the gapField code works well if you remove the first line from the ./Make/files text file.. i.e delete <tractionDisplacement/tractionDisplacementFvPatchVectorField.C>.

However, on a Dell Compute Cluster running Red Hat Enterprise Linux 5.5, this fix does not work. I am very confused about this.

Please try to delete <tractionDisplacement/tractionDisplacementFvPatchVectorField.C> from Make/files and then try running gapField. Since it runs when compiled in a slightly different way, I dont think the problem is in the "D" file. What do you think?

Thanks a lot for your help,

Sujan


Hi Sujan,

there is something wrong with your mesh and boundary conditions, as I have noticed already here, what checkMesh tells me:

HTML Code:

Checking topology...
 ****Problem with boundary patch 13 named forcePoint of type patch. The patch should start on face no 265317 and the patch specifies 0.
Possibly consecutive patches have this same problem. Suppressing future warnings.
 ***Boundary definition is in error.


--> FOAM FATAL ERROR:
attempt to access element from zero sized list

    From function UList<T>::checkIndex(const label)
    in file /home/tomislav/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/UListI.H at line 113.

Besides, try copying the field "D" from the directory "0" to the directory "1". When you do this, the application works fine. Again, this means that there is a problem with reading the field. Never question the Gnu Debugger... it is always right :D

Check your mesh, check the boundary conditions and see why do you get a messed up field D in the directory "1". There is something seriously wrong with the boundary conditions of that field. Value "nonuniform 0();" makes no sense... it is an empty non-uniform list, so there has to be a bug somewhere. My suggestion: check the mesh and the boundary conditions, concentrate on the output that results with the "1" directory. The error is definitely in reading the field (boundaries are ill defined). As for why the application works without the defined boundary condition: I don't know, and in the light of what I have seen: it's not important at all... concentrate on the errors above.

Hope this helps,
Tomislav

blackbirdinapie October 18, 2011 11:33

Hi Tomislav,

Thanks a lot for your replies. I will check my case out following your advice and keep you informed on what I see. Thanks a lot for your help.:)

Sujan

blackbirdinapie October 18, 2011 13:13

Quote:

Hi Sujan,

there is something wrong with your mesh and boundary conditions, as I have noticed already here, what checkMesh tells me:
Hi Tomislav,

I fixed the problem with the BCs in the previous case that I had sent you. Now the output from checkMesh is
HTML Code:

Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          28068
    internal points:  14579
    faces:            265317
    internal faces:  238335
    cells:            125913
    boundary patches: 15
    point zones:      0
    face zones:      1
    cell zones:      1

Overall number of cells of each type:
    hexahedra:    0
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    125913
    polyhedra:    0

Checking topology...
    Boundary definition OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    drain              1437    869      ok (non-closed singly connected) 
    fplarge            368      252      ok (non-closed singly connected) 
    fppoints            16      20      ok (non-closed singly connected) 
    hpbalance1          1269    1589    ok (non-closed singly connected) 
    fixedPoint          1        3        ok (non-closed singly connected) 
    hpbalance2          15100    8319    ok (non-closed singly connected) 
    hpgap              2008    1148    ok (non-closed singly connected) 
    hprelief            528      297      ok (non-closed singly connected) 
    lpbalance          3536    1957    ok (non-closed singly connected) 
    lpgap              893      519      ok (non-closed singly connected) 
    lprelief            575      332      ok (non-closed singly connected) 
    sides              1124    733      ok (non-closed singly connected) 
    fixedcenter        126      85      ok (non-closed singly connected) 
    forcePoint          1        3        ok (non-closed singly connected) 
    junk                0        0        ok (empty)                       

Checking geometry...
    Overall domain bounding box (-0.0192 -0.0191935 0.0012) (0.05135 0.0192 0.0052)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (1.05356e-19 -1.55861e-19 3.25637e-20) OK.
    Max cell openness = 1.70687e-16 OK.
    Max aspect ratio = 10.1099 OK.
    Minumum face area = 5.36935e-10. Maximum face area = 1.07687e-06.  Face area magnitudes OK.
    Min volume = 8.79153e-15. Max volume = 2.98811e-10.  Total volume = 4.9011e-06.  Cell volumes OK.
    Mesh non-orthogonality Max: 73.1532 average: 19.1402
  *Number of severely non-orthogonal faces: 4.
    Non-orthogonality check OK.
  <<Writing 4 non-orthogonal faces to set nonOrthoFaces
    Face pyramids OK.
    Max skewness = 1.56604 OK.

Mesh OK.

End

However, the problem with the gapField2 application remains. I have uploaded
the new case and the application again on rapidshare. [execution on command line is "gapField2 2000 gen"]. The field D is in the ./2000 directory.

https://rapidshare.com/files/3769907155/CFDonline.zip

I am puzzled, as I mentioned in my previous post by the following -

Quote:

The D file in ./1 is an output of the stress solver. Actually, on my personal Ubuntu 10 install the gapField code works well if you remove the first line from the ./Make/files text file.. i.e delete <tractionDisplacement/tractionDisplacementFvPatchVectorField.C>.

However, on a Dell Compute Cluster running Red Hat Enterprise Linux 5.5, this fix does not work. I am very confused about this.

However, I also agree with you that Value "nonuniform 0();" doesnt make sense. However, the code works for me if compiled in a slightly different way!! :confused:

Please let me know what you think. Thanks again,

Sujan

tomislav_maric October 21, 2011 04:36

Well,

why do you have a patch of length "0" called "junk"?

From the constant/polyMesh/boundary:

Code:

189 junk
190 {
191 type
192 patch;
193 nFaces
194 0;
195 startFace
196 265317;
197 }

and, of course, then you have the "D" field defined poorly, because for this patch, you get the following BC values in the directory 2000:

Code:

153597    junk
153598    {
153599        type            tractionDisplacement;
153600        traction        nonuniform 0();
153601        pressure        nonuniform 0();
153602        value          nonuniform 0();
153603    }

And here's where the illogical "nonuniform 0();" appears... either remove the "junk" patch, or make the BC recognize the patch size and do nothing for that specific patch.

Hope this helps,
Tomislav

Hisham March 3, 2013 11:52

Dear all,

I have the same error:( Have anyone found the cure?

The custom solver seems OK as it works well on other geometries. This error only happens when trying to continue from a previous run and at reading the D field. I am using 2.1.x on Ubuntu 12.04.

I even removed all fancy BCs and kept all as fixedValue.

Error:
Code:

--> FOAM FATAL ERROR:
Attempt to cast type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE

    From function dynamicCast<To>(From&)
    in file /home/hisham/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/typeInfo.H at line 93.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/home/hisham/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::error::abort() in "/home/hisham/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  Foam::token::Compound<Foam::List<Foam::Vector<double> > >& Foam::dynamicCast<Foam::token::Compound<Foam::List<Foam::Vector<double> > >, Foam::token::compound>(Foam::token::compound&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#3  Foam::Istream& Foam::operator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#4  Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#5 
 in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#6  Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::tractionDisplacementFvPatchVectorField>::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#7  Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#8  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricBoundaryField(Foam::fvBoundaryMesh const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#9  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::dictionary const&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#10  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#11 
 at geotechFoam3.C:0
#12 
 in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"
#13  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#14 
 in "/home/hisham/OpenFOAM/hisham-2.1.x/platforms/linux64GccDPOpt/bin/geotechFoam3"

Check Mesh:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.x-4a4c06f816a3
Exec  : checkMesh
Date  : Mar 03 2013
Time  : 16:49:45
Host  : "numubuntu"
PID    : 18206
Case  : /home/hisham/TestRunsGeoTechFoam/coupledGWK/Basic/10-09-00
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 50.0111

Time = 50.0111

Mesh stats
    points:          17518
    internal points:  0
    faces:            34309
    internal faces:  16753
    cells:            8517
    boundary patches: 16
    point zones:      0
    face zones:      0
    cell zones:      16

Overall number of cells of each type:
    hexahedra:    8477
    prisms:        40
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology                 
    Back                8517    8759    ok (non-closed singly connected) 
    Front              8517    8759    ok (non-closed singly connected) 
    CaissonTop          38      78      ok (non-closed singly connected) 
    CaissonLeft        7        16      ok (non-closed singly connected) 
    CaissonRight        13      28      ok (non-closed singly connected) 
    CaissonHeelTop      4        10      ok (non-closed singly connected) 
    RubbleTopRight      4        10      ok (non-closed singly connected) 
    SandBeamTop        2        6        ok (non-closed singly connected) 
    SandBeamLeft        5        12      ok (non-closed singly connected) 
    RubbleAndSand      91      184      ok (non-closed singly connected) 
    Bottom              207      416      ok (non-closed singly connected) 
    Left                35      72      ok (non-closed singly connected) 
    Right              35      72      ok (non-closed singly connected) 
    SandRightTop        59      120      ok (non-closed singly connected) 
    SandBermTilt        7        16      ok (non-closed singly connected) 
    SandBermTop        15      32      ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (0 0 0) (24.25 5.21 3)
    Mesh (non-empty, non-wedge) directions (1 1 0)
    Mesh (non-empty) directions (1 1 0)
    All edges aligned with or perpendicular to non-empty directions.
    Boundary openness (0 0 -2.12921e-15) OK.
    Max cell openness = 2.1893e-16 OK.
    Max aspect ratio = 6.15356 OK.
    Minimum face area = 0.00380447. Maximum face area = 2.70416.  Face area magnitudes OK.
    Min volume = 0.0114134. Max volume = 0.228398.  Total volume = 224.003.  Cell volumes OK.
    Mesh non-orthogonality Max: 62.5867 average: 14.9313
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 1.60675 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End


Best regards
Hisham

anishtain4 March 3, 2013 14:26

However tomislav expatiated a lot and in my experience he is an expert, but from the error you are getting:
type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE
, aren't you trying to fit a scalar field into a vector one?

Hisham March 3, 2013 15:01

Quote:

Originally Posted by anishtain4 (Post 411195)
However tomislav expatiated a lot and in my experience he is an expert, but from the error you are getting:
type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE
, aren't you trying to fit a scalar field into a vector one?

Nope!

Actually it has to do with the tractionDisplacement BC at one of its constructors. The error is not consistent (does not appear for all problems). I think it has to do with:

Code:

tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedGradientFvPatchVectorField(p, iF),
    traction_("traction", dict, p.size()),
    pressure_("pressure", dict, p.size())
{
    //    fvPatchVectorField::operator=(patchInternalField());
    fvPatchField<vector>::operator==(Field<vector>(p.size(), pTraits<vector>::zero));
    gradient() = vector::zero;
}

I changed the line but still getting the same error. I just cannot track where the refCast is taking place.

Hisham

ngj March 3, 2013 15:52

Hi Hisham,

I have made a quick look, and the only casts, which I have been able to come across are the following (at least those in the direct line of search):

Code:

fvPatchField.H:            (dynamic_cast<const fvPatchFieldType&>(ptf), p, iF, m)
and

Code:

fixedGradientFvPatchField.C:        refCast<const fixedGradientFvPatchField<Type> >(ptf);
and then probably the one, which is the most interesting, because it is related to your adddictionaryConstructorToTable:

Code:

./finiteVolume/interpolation/interpolation/interpolation/interpolation.H:interpolation<Type>::adddictionaryConstructorToTable<SS<Type> >
Your boundary condition has a reference to fvPatch through your fvPatchField, and the former connects to "class surfaceInterpolation". Why you are having problems is beyond my understanding - especially since you have mixed results.

There are quite a few "adddictionaryTo...", but the rest are related to either lagrangian or thermo-physical models.

Could you elaborate on (i) how you are reading the field in terms of code and (ii) given an example of a field, which is improper read.

Good luck

Niels

Hisham March 3, 2013 20:09

Hi Niels,


Thanks a lot for the effort. I will surely consider those. I just think I should do some more experimenting before I go into code modification. I hope I am not trying to fix what is already fixed. I took the geometry to a different input files and it seems to be working. Well not working I just have other errors :D. So until I am sure about the error I will not change the code.

It just strikes me how this kind of error can arouse from user input :confused:

The code that issues the error is (simply):

Code:

volVectorField D 
(   
 IOobject   
 (       
 "D",       
 runTime.timeName(),       
  mesh,       
  IOobject::MUST_READ,       
 IOobject::AUTO_WRITE     
),   
 mesh
 );

when the tractionDisplacement BC is used. However, now it seems to be more likely an input error.

Thanks again and I will post if I knew what caused this madness!

Hisham March 5, 2013 11:11

Hi Niels,

I think it is something with the use of gmshToFoam - splitMesh combination. It seems that every time splitMesh is used (after gmshToFoam), it does not produce the same result (for the same files) for some unknown reason and it, sometimes, creates one crazy shaped element on the split surface that connect both regions on both sides of the split. When that element is produced, the error happens for continuation of solution from a previous one. If the mesh survived splitMesh without that element, all works well.

I think it has to do with quality of the mesh near split surfaces.
This is what seems to be the problem!

Thanks again and best regards,
Hisham


All times are GMT -4. The time now is 12:17.