|
[Sponsors] |
[blockMesh] #codeStream loop inside a blockMeshDict |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 23, 2015, 16:15 |
|
#21 |
New Member
Gianluca
Join Date: Sep 2011
Location: Firenze, Italy
Posts: 11
Rep Power: 15 |
Okay, Bruno you were right: I was living in the illusion that the blocks topology could take advantage from the edges curvature (spline in my case) so I tried to define with just one block the helical sweep of each block face whose normal is in tangential direction (local x axis). Instead topology is built, as far as I understand, by only connecting the edges in the block's vertexes list with straight lines.
So I solved the negative volume error by defining 27 blocks instead of 9, sweeping on the helical path by only 120° and not 360° (sigh). Hassan, I did not get any error from the #codestream routines during blockmeshing. What errors did it show to you? Thank you both for your help Cheers Gianluca |
|
October 23, 2015, 17:35 |
|
#22 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
Hello Gianluc,
I am investigating the reasons of this error (log attached). It is strange error but it seems to be related to OpenFOAM version. I am not sure yet. I tried your code using two versions of OpenFOAM-2.3.x. The newer version (18th Jun 2015) is not working, however the older version (26th Feb) is fine. I will update both and recompile both to pinpoint the problem. Another possibility, maybe, it is related to gcc version. I will check that as well. Best wishes, Hassan |
|
October 24, 2015, 13:46 |
|
#23 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
I updated OpenFOAM-2.3.x, to check if this error due to any new commits. It seems not, because your blockMesh worked even with the updated OpenFOAM-2.3.x. Therefore I tried a third updated version of OpenFOAM-2.3.x on different system and I get the same error.
Now, I think (maybe), it is something related to GCC version because it worked with GCC-4.9.2 (Ubuntu 15.04) but it did not work with GCC-4.8.4 (Ubuntu 14.04LTS) nor GCC-4.7.3 (CentOS 6.5). Could you please check your GCC version? Bw, Hassan |
|
October 24, 2015, 14:32 |
|
#24 |
New Member
Gianluca
Join Date: Sep 2011
Location: Firenze, Italy
Posts: 11
Rep Power: 15 |
Hi Hassan,
here is the output of "gcc -v": gcc version 4.9.2 (Debian 4.9.2-10). The error you are getting seems to be strange to me because in my humble experience, normally the use of uninitialized array leads to a gcc warning, unless gcc is instructed to treat warnings as errors. Regards Gianluca |
|
March 8, 2021, 20:27 |
Similar issues with #codeStream in openfoam8
|
#25 | |
New Member
Luca
Join Date: Jun 2019
Location: Colorado, USA
Posts: 6
Rep Power: 7 |
I realize this is an old thread but thought I would try and revive it to ask a related question. I am using openfoam8 and #codeStream in blockMeshDict. The vertices are computing okay, but there are issues with the edges. It seems that the quoted response provided by hk318i to output the edge dictionary does not work anymore in openfoam8. Here is the loop in my code where i output each line:
Code:
//std::string v1, v2; int v1, v2; for (int i=0; i<np; i++) { // vertices of interest if ((i+1)%4==0) { //v1 = std::to_string(i); //v2 = std::to_string(i-3); v1 = i; v2 = i-3; } else { //v1 = std::to_string(i); //v2 = std::to_string(i+1); v1 = i; v2 = i+1; } // output Info << "arc " << v1 << " " << v2 << " " << points[i] << endl; os << "arc " << v1 << " " << v2 << " " << points[i] << endl; //Info << "arc "+v1+" "+v2+" " << points[i] << endl; //os << "arc "+v1+" "+v2+" " << points[i] << endl; } Code:
--> FOAM FATAL IO ERROR: incorrect first token, expected <int> or '(', found on line 0 the word 'arc' Thanks! Luca Quote:
|
||
March 12, 2021, 06:14 |
|
#26 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
It would helpful if you added in a full listing of the blockMeshDict that the code tried to create. From the error message, it looks like you have the wrong syntax for the arc command - check out section 5.3.1.2 in https://cfd.direct/openfoam/user-guide/v6-blockmesh/ and compare against what you have in your file.
Good luck! |
|
March 12, 2021, 13:42 |
|
#27 |
New Member
Luca
Join Date: Jun 2019
Location: Colorado, USA
Posts: 6
Rep Power: 7 |
Here is the full blockMeshDict file, as well as a geometryInput file from the constant directory which is required for it to run. I am trying to recreate a previously generated blockMeshDict file with codeStream, so it can eventually be expanded. There is a commented out edges() dictionary in the file as well with hardcoded values, the blockMeshDict file fine runs with this edges dictionary. The boundaries are eliminated for use with paraFoam -block. Thanks for taking the time to look at this!
|
|
March 12, 2021, 14:55 |
|
#28 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
Could you also just include the Info output? I.e. from this, we can see the parsing of the previous lines and the line that it crashes on ... would be quicker than debugging your code.
|
|
March 12, 2021, 14:59 |
|
#29 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
One quick thing to consider - your codestream creates lists of vertices and then edges ... these need to be bracketed, and I don't see those brackets in your code. e.g.
Code:
vertices ( <list of vertices here> ); edges ( <list of edges here> ); Code:
vertices (#codeStream { |
|
March 12, 2021, 15:31 |
|
#30 |
New Member
Luca
Join Date: Jun 2019
Location: Colorado, USA
Posts: 6
Rep Power: 7 |
Yes that makes sense, I apologize for the missing info. Here is the last line of my output including Info output for edges in the blockMeshDict I sent:
Code:
arc01(0.041 0 0) arc12(0 0.041 0) arc23(-0.041 0 0) arc30(0 -0.041 0) arc45(0.045 0 0) arc56(0 0.045 0) arc67(-0.045 0 0) arc74(0 -0.045 0) arc89(0.041 0 3.96) arc910(0 0.041 3.96) arc1011(-0.041 0 3.96) arc118(0 -0.041 3.96) arc1213(0.045 0 3.96) arc1314(0 0.045 3.96) arc1415(-0.045 0 3.96) arc1512(0 -0.045 3.96) arc1617(0.1426 0 5.333) arc1718(0 0.1426 5.333) arc1819(-0.1426 0 5.333) arc1916(0 -0.1426 5.333) arc2021(0.041 0 5.333) arc2122(0 0.041 5.333) arc2223(-0.041 0 5.333) arc2320(0 -0.041 5.333) arc2425(0.045 0 5.333) arc2526(0 0.045 5.333) arc2627(-0.045 0 5.333) arc2724(0 -0.045 5.333) arc2829(0.1426 0 5.333) arc2930(0 0.1426 5.333) arc3031(-0.1426 0 5.333) arc3128(0 -0.1426 5.333) arc3233(0.03134 -0.0085 5.422) arc3334(0 0.02284 5.422) arc3435(-0.03134 -0.0085 5.422) arc3532(0 -0.041 5.422) arc3637(0.0365 -0.0085 5.422) arc3738(0 0.028 5.422) arc3839(-0.0365 -0.0085 5.422) arc3936(0 -0.045 5.422) arc4041(0.13294 -0.0085 5.422) arc4142(0 0.12444 5.422) arc4243(-0.13294 -0.0085 5.422) arc4340(0 -0.1426 5.422) Creating block edges --> FOAM FATAL IO ERROR: wrong token type - expected word, found on line 0 the doubleScalar 0.041 file: /home/limponenti/OpenFOAM/limponenti-8/run/emptyHCE/system/blockMeshDict/edges at line 0. From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&) in file primitives/strings/word/wordIO.C at line 74. FOAM exiting |
|
March 13, 2021, 12:23 |
|
#31 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
Quote:
Code:
vertices #codeStream { ... code #{ pointField points(19); points[0] = point(0.5, 0, -0.5); points[1] = point(1, 0, -0.5); ... os << points; Info << points; #}; }; Code:
38 ( (0.5 0 -0.5) (1 0 -0.5) ... (-0.707107 2 0.5) ) |
||
March 13, 2021, 13:29 |
Solved!
|
#32 |
New Member
Luca
Join Date: Jun 2019
Location: Colorado, USA
Posts: 6
Rep Power: 7 |
Yes thank you! With the brackets added, and also outputting the vertices as integers with spaces in between, everything works. Here is the final edges call with codeStream output for each point:
Code:
edges (#codeStream { codeInclude #{ #include "pointField.H" #}; code #{ // calculate required points, in this case midpoint of arcs // ... // get vertices and output edge int v1, v2; for (int i=0; i<np; i++) { // vertices of interest if ((i+1)%4==0) { v1 = i; v2 = i-3; } else { v1 = i; v2 = i+1; } // output Info << "arc " << v1 << " " << v2 << " " << points[i] << endl; os << "arc " << v1 << " " << v2 << " " << points[i] << endl; } #}; } ); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
Star-CCM+ Macro - Loop over just wall boundary conditions | jbatchel | STAR-CCM+ | 5 | March 2, 2018 14:42 |
Pressure distribution on a wall | darazsbence | CFX | 17 | October 6, 2015 11:38 |
How to determine a point is inside a tetrahedral? | G.P. Xia | Main CFD Forum | 16 | January 12, 2000 12:15 |