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 |
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 |
Quote:
T. |
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 |
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. |
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 |
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 I've used gdb on the program and you have to go deeper than createFields: Code:
108 return readField(dictionary(is)); Can you change this and let me know what happens? Best, Tomislav |
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 |
Quote:
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... 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 |
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 |
Quote:
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 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:
Please let me know what you think. Thanks again, Sujan |
Well,
why do you have a patch of length "0" called "junk"? From the constant/polyMesh/boundary: Code:
189 junk Code:
153597 junk Hope this helps, Tomislav |
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: Code:
/*---------------------------------------------------------------------------*\ Best regards Hisham |
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? |
Quote:
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:: Hisham |
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) Code:
fixedGradientFvPatchField.C: refCast<const fixedGradientFvPatchField<Type> >(ptf); Code:
./finiteVolume/interpolation/interpolation/interpolation/interpolation.H:interpolation<Type>::adddictionaryConstructorToTable<SS<Type> > 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 |
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 Thanks again and I will post if I knew what caused this madness! |
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. |