|
[Sponsors] |
[swak4Foam] Illegible characters when set initial field using funkySetFields |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 7, 2019, 04:33 |
Illegible characters when set initial field using funkySetFields
|
#1 |
New Member
Join Date: May 2013
Posts: 29
Rep Power: 13 |
Hi everyone,
I met a problem when I try to set the initial field using funkySetFields. I am sorry that I can't upload the file since it's too big. Please see the screenshot I uploaded. The mesh was generated by snappyHexMesh with 5.3 million cells. The expression I used is Code:
expressions ( u0 { field U; expression "vector(3.824*pow((pos().z/0.08),0.28),0,0)"; } ); I tested to initialize the background mesh generated by blockMesh (0.16 m cells). Everything is fine. Anyone knows how to solve this problem? Leo |
|
August 8, 2019, 04:22 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The "problem" is that this is a binary file (see header and your controlDict). These are supposed to look like this
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 12, 2019, 06:26 |
|
#3 |
New Member
Join Date: May 2013
Posts: 29
Rep Power: 13 |
Hi Gschaider,
Thank you for your reply. I have checked the header of funkySetFieldsDict and controlDict. Both files are ascii. I am not sure if funkySetFields converts ascii file to binary file if the size of the file is big. I find that the boundary conditions in the same file ./0/U are ascii format. Does the inconsistent data format lead to openFoam failing to read the initial field? Best, Leo. For someone who is interested in non-uniform initial field, the following code may be helpful. internalField #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); vectorField U(mesh.nCells(), vector(0, 0, 0)); forAll(U, i) { const scalar z = mesh.C()[i][2]; const scalar Uref=3.824; const scalar zref=0.08; const scalar alpha=0.28; U[i] = vector(Uref*pow(z/zref,alpha), 0.0, 0.0); } U.writeEntry("", os); #}; }; |
|
August 12, 2019, 07:25 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
According to your screenshot it is a binary file. funkySetFields does not change that setting. It is irrelevant what the headers of those files say. Important is the setting writeFormat in your controlDict. That seems to have been binary at the time funkySetFields was run (maybe you changed it later)
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 12, 2019, 22:38 |
|
#5 |
New Member
Join Date: May 2013
Posts: 29
Rep Power: 13 |
Hi Gschaider,
Thank you for your help. It's my mistake. I thought the writeFormat only controlling output format of openfoam solvers. Leo |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Suppress twoPhaseEulerFoam energy | AlmostSurelyRob | OpenFOAM Running, Solving & CFD | 33 | September 25, 2018 18:45 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 03:50 |
Micro Scale Pore, icoFoam | gooya_kabir | OpenFOAM Running, Solving & CFD | 2 | November 2, 2013 14:58 |
Orifice Plate with a fully developed flow - Problems with convergence | jonmec | OpenFOAM Running, Solving & CFD | 3 | July 28, 2011 06:24 |