CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Problem about setFields

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 18, 2007, 13:36
Default Hello I am running the damB
  #1
New Member
 
weiyan
Join Date: Mar 2009
Posts: 10
Rep Power: 17
williamscn is on a distinguished road
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 is offline   Reply With Quote

Old   May 18, 2007, 13:47
Default I got the problem. Thanks
  #2
New Member
 
weiyan
Join Date: Mar 2009
Posts: 10
Rep Power: 17
williamscn is on a distinguished road
I got the problem.
Thanks
williamscn is offline   Reply With Quote

Old   May 18, 2007, 23:53
Default From memory, this is something
  #3
New Member
 
Richard Morgans
Join Date: Mar 2009
Posts: 16
Rep Power: 17
rmorgans is on a distinguished road
From memory, this is something to do with not copying gamma.org to gamma (check out the Allrun script).

Rick
rmorgans is offline   Reply With Quote

Old   July 30, 2009, 08:01
Default
  #4
New Member
 
Join Date: Jul 2009
Posts: 1
Rep Power: 0
student0815 is on a distinguished road
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
student0815 is offline   Reply With Quote

Old   October 6, 2009, 14:16
Default
  #5
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
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
bghp and Giannis_Kaz like this.

Last edited by bigphil; October 9, 2009 at 08:37.
bigphil is offline   Reply With Quote

Old   December 2, 2009, 07:33
Default
  #6
Senior Member
 
Claus Meister
Join Date: Aug 2009
Location: Wiesbaden, Germany
Posts: 241
Rep Power: 18
idrama is on a distinguished road
Hey there!

the copying help.

cheers,

Claus
idrama is offline   Reply With Quote

Old   December 2, 2009, 07:49
Default
  #7
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
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

Last edited by bigphil; December 2, 2009 at 08:06.
bigphil is offline   Reply With Quote

Old   December 14, 2010, 17:05
Default
  #8
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 16
Linse is on a distinguished road
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...
Linse is offline   Reply With Quote

Old   December 8, 2014, 22:39
Default
  #9
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by Linse View Post
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.
musahossein is offline   Reply With Quote

Old   December 9, 2014, 08:08
Default
  #10
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 159
Rep Power: 17
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
Copy alpha* from 0.org to 0. Is this large pink font really necessary? It hurts in the eyes .
__________________
Blog: sourceflux.de/blog
"The OpenFOAM Technology Primer": sourceflux.de/book
Twitter: @sourceflux_de
Interested in courses on OpenFOAM?
jhoepken is offline   Reply With Quote

Old   December 9, 2014, 09:46
Default
  #11
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by jhoepken View Post
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 is offline   Reply With Quote

Old   December 9, 2014, 09:53
Default
  #12
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by musahossein View Post
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 is offline   Reply With Quote

Old   December 9, 2014, 09:58
Default
  #13
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by musahossein View Post
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')
musahossein is offline   Reply With Quote

Old   December 9, 2014, 15:42
Default
  #14
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 159
Rep Power: 17
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
check your alpha field before you run setFields. If it's not uniform, then you have found the source of your problem.
anraw likes this.
__________________
Blog: sourceflux.de/blog
"The OpenFOAM Technology Primer": sourceflux.de/book
Twitter: @sourceflux_de
Interested in courses on OpenFOAM?
jhoepken is offline   Reply With Quote

Old   December 12, 2014, 09:08
Default
  #15
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by jhoepken View Post
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.
anraw likes this.
musahossein is offline   Reply With Quote

Old   December 13, 2014, 08:10
Default
  #16
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 159
Rep Power: 17
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
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.
__________________
Blog: sourceflux.de/blog
"The OpenFOAM Technology Primer": sourceflux.de/book
Twitter: @sourceflux_de
Interested in courses on OpenFOAM?
jhoepken is offline   Reply With Quote

Old   December 15, 2014, 09:13
Default
  #17
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
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.
musahossein is offline   Reply With Quote

Old   July 12, 2016, 12:55
Default
  #18
New Member
 
Madeleine
Join Date: Jun 2016
Posts: 14
Rep Power: 10
Madi is on a distinguished road
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
Madi is offline   Reply With Quote

Old   August 28, 2017, 08:42
Default I just need to use new mesh
  #19
New Member
 
Gustavo Cordoba
Join Date: Aug 2017
Location: Pasto, Colombia
Posts: 9
Rep Power: 9
gcordobaguerrero is on a distinguished road
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.
gcordobaguerrero is offline   Reply With Quote

Old   January 24, 2018, 11:06
Default Setfields no rewriting alpha.water file
  #20
Member
 
Shafik Walakaka
Join Date: Oct 2017
Posts: 38
Rep Power: 9
walakaka is on a distinguished road
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
walakaka is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFields runs with no errors but doesnbt change fields adamsview OpenFOAM Pre-Processing 3 December 12, 2014 22:03
InterDyMFoam and problem with setFields chris_sev OpenFOAM Running, Solving & CFD 1 March 23, 2009 22:23
Setfields inoutlet and water and air patches erik023 OpenFOAM Pre-Processing 1 September 29, 2008 11:05
Regarding setFields file 21kalee OpenFOAM Running, Solving & CFD 0 January 14, 2008 06:42
problem in solving "wave generation" problem san FLUENT 2 April 4, 2006 00:37


All times are GMT -4. The time now is 16:39.