CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Problem about setFields (https://www.cfd-online.com/Forums/openfoam-pre-processing/62132-problem-about-setfields.html)

williamscn May 18, 2007 12:36

Hello I am running the damB
 
Hello

I am running the damBreakFine case. When I run:
setFields . damBreakFine
I get following error:
--> FOAM FATAL IO ERROR : size 2268 is not equal to the given value of 7700

How to do with this?

Thanks

williamscn May 18, 2007 12:47

I got the problem. Thanks
 
I got the problem.
Thanks

rmorgans May 18, 2007 22:53

From memory, this is something
 
From memory, this is something to do with not copying gamma.org to gamma (check out the Allrun script).

Rick

student0815 July 30, 2009 07:01

Hi,

I got the same problem.

Followed instructions as told in the tutorial, but the same error occures.

Unfortunately no solution is given in this thread.

Anybody who can help?

Greetz

bigphil October 6, 2009 13:16

I assume you have sorted the problem but for anyone else who has the same problem, you must copy gamma.org over gamma
ie cp 0/gamma.org 0/gamma
and type yes when it asks if you want to overwrite 0/gamma.

gamma starts off as a file with patch conditions (zeroGradient,symmetry,empty), then when setFields is run it reads this file and overwrites it with what I'm guessing is the values for the internal cells and the patches values are at the bottom.

So if you want to run setFields again (like if you changed your mesh) then you should copy gamma.org to gamma. gamma.org is a copy of the original gamma.

Hopefully this will help somebody.
Philip

idrama December 2, 2009 06:33

Hey there!

the copying help.

cheers,

Claus

bigphil December 2, 2009 06:49

Hi Claus,

As far as I know, the origin of the error is that the mesh (or mesh density) has been changed since the 'setFields' was last ran.

Is it the 'damBreak' case you are trying?

When you copy 'damBreak' from the '$FOAM_TUTORIALS/interFoam/' directory, you run 'blockMesh' first and then 'setFields', does 'setFields' work fine then?

Are you then changing the mesh density?

If you now run 'setFields' you will get the error above, so assuming 'gamma.org' was not altered, if you 'cp 0/gamma.org 0/gamma' then when you run 'setFields' it will work (I had a quick go with damBreak now and after copying the gamma.org file then 'setFields' works without the error).

In case 'gamma.org' was for some reason altered, just get it from $FOAM_TUTORIALS again ie 'cp $FOAM_TUTORIALS/interFoam/damBreak/0/gamma.org 0/gamma'


Hopefully this helps,
Btw I am assuming you are using the 'damBreak' case, let me know if the above doesn't help of if you are using a different case,

Philip

Linse December 14, 2010 16:05

Though it might be necromancy to get back a thread nobody posted in for that long a time:

I do not remember which one it actually was, but one of the two things happened:
Either the files in the "polyMesh" directory remained the same and deleting those (make a copy of your blockMeshDict and do rm casename/constant/polyMesh/* ) helped.
Or it was necessary to renew the files of the variables in the casename/0 directory, as these are altered by earlier setFields-commands. Again: Keep a copy of the original files (before altering them with setFields) and just make "rm casename/0/*".

In both cases you have to copy back the "old" files to the directory where they are needed. If you then do a "blockMesh -case casename" and a "setFields -case casename" everything should be okay again.

In case I forget, remind me via private message, and I will upload a small script I wrote for these things...

musahossein December 8, 2014 21:39

Quote:

Originally Posted by Linse (Post 287456)
Though it might be necromancy to get back a thread nobody posted in for that long a time:

I do not remember which one it actually was, but one of the two things happened:
Either the files in the "polyMesh" directory remained the same and deleting those (make a copy of your blockMeshDict and do rm casename/constant/polyMesh/* ) helped.
Or it was necessary to renew the files of the variables in the casename/0 directory, as these are altered by earlier setFields-commands. Again: Keep a copy of the original files (before altering them with setFields) and just make "rm casename/0/*".

In both cases you have to copy back the "old" files to the directory where they are needed. If you then do a "blockMesh -case casename" and a "setFields -case casename" everything should be okay again.

In case I forget, remind me via private message, and I will upload a small script I wrote for these things...

What do you do in the case of solshingTank2D in solver interDyMFoam? The error I get is similar to the ones posted in this thread:

Create mesh for time = 0.00

Reading set description:
WP1
WP3

Time = 0.00


--> FOAM FATAL IO ERROR:
size 30000 is not equal to the given value of 80000

file: /home/cfsengineers/OpenFOAM/cfsengineers-2.2.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0.00/alpha1 from line 18 to line 30046.

From function Field<Type>::Field(const word& keyword, const dictionary&, const label)
in file /home/opencfd/OpenFOAM/OpenFOAM-2.2.1/src/OpenFOAM/lnInclude/Field.C at line 236.

jhoepken December 9, 2014 07:08

Copy alpha* from 0.org to 0. Is this large pink font really necessary? It hurts in the eyes ;).

musahossein December 9, 2014 08:46

Quote:

Originally Posted by jhoepken (Post 523122)
Copy alpha* from 0.org to 0. Is this large pink font really necessary? It hurts in the eyes ;).

Sorry. I have no imagination when it colored fonts.

musahossein December 9, 2014 08:53

Quote:

Originally Posted by musahossein (Post 523152)
Sorry. I have no imagination when it colored fonts.

My ./Allrun looks like this, where I have copied alpha1.org to aplha1.

#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

runApplication blockMesh
cp 0/alpha1.org 0/alpha1
runApplication setFields
runApplication `getApplication`

# ----------------------------------------------------------------- end-of-file


But OpenFoam still complains. Any other suggestions?

musahossein December 9, 2014 08:58

Quote:

Originally Posted by musahossein (Post 523154)
My ./Allrun looks like this, where I have copied alpha1.org to aplha1.

#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

runApplication blockMesh
cp 0/alpha1.org 0/alpha1
runApplication setFields
runApplication `getApplication`

# ----------------------------------------------------------------- end-of-file


But OpenFoam still complains. Any other suggestions?

sorry. I forgot to mention that I am running in parallel, in which case, I dont run ./Allrun at all, but apply the command in the case directory as follows:

Code is in FORTRAN 90:

write(*,*) 'Cleaning files from previous run'
call system(cd_command // './Allclean') ! clean all files from previous run.

write(*,*) 'Running blockMesh'
call system(cd_command // 'blockMesh') ! set up the tank geometry and mesh size

write(*,*) 'recover phase file and run setFields'
call system(cd_command // 'cp 0/alpha1.org 0/alpha1') ! create new alpha1 file from alpha1.org file
call system(cd_command // 'setFields') ! coordinate mesh between geometry and phase file

write(*,*) 'Decompose subdomains for parallel processing'
call system(cd_command // 'decomposePar')

jhoepken December 9, 2014 14:42

check your alpha field before you run setFields. If it's not uniform, then you have found the source of your problem.

musahossein December 12, 2014 08:08

Quote:

Originally Posted by jhoepken (Post 523192)
check your alpha field before you run setFields. If it's not uniform, then you have found the source of your problem.

Thankyou for your advice. I made sure that the alpha field is ok, Then I noted that there were some extra folders with alpha in them that OpenFOAM was trying to read. The alpha field had the mesh from the previous models. I deleted those and now the code runs fine. I guess you can never check the codes enough to make sure that there are no glitches during run time.

jhoepken December 13, 2014 07:10

Great that you made it work. But I doubt that this is a "glitch at runtime", as this is coded to work like that. On purpose ;). Otherwise you would not be able to proceed from a previous state.

musahossein December 15, 2014 08:13

You are right. There were two files left over from a previous model/run which was the source of the misread by OpenFOAM. So no glitches there.I just have to make sure that there are no leftover files or data from other runs and models that may affect the new run.

Madi July 12, 2016 11:55

Hi to all,
I've got a familiar problem. I translate my mesh, with transformPoints -translate ... so that my coordinate system is in the outlet. But now I my setFields doesnt work anymore. I doenst write in the alpha.water case and the box which is in the case doesnt fit with the coordinates i put in setFields.

Can someone help me?

Thanks

gcordobaguerrero August 28, 2017 07:42

I just need to use new mesh
 
Dear all,
I am trying to run the compressible shocktube example, bu using a gmsh generated mesh.
I cannot follow your advices, because I think there is no point on copying 0/* exactly from the original problem.

How can I get correctly modified 0/*s?

Btw, setFields reports:
------------------
--> FOAM FATAL IO ERROR:
size 200 is not equal to the given value of 81612
-----------
because the original shocktube problem has 200 cells, whereas my problem contains 81612 cells.

Any idea?

Thanks.

walakaka January 24, 2018 10:06

Setfields no rewriting alpha.water file
 
Hi all,

I modified the dambreak case to simulate a two-phase flow for a horizontal pipe.

My mesh seems ok in Parafoam after running blockMesh.
However, when I run setFields, the alpha.water files are not being re-written. Therefore my horizontal pipe is still completely filled with water (alpha = 1) even after I tried making the top half air using boxtocell.

Anyone has got any idea what I'm missing?
(It works perfectly fine for the dambreak case)

Regards
Shafik


All times are GMT -4. The time now is 08:13.