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

is there a command to restate after setFields?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree7Likes
  • 1 Post By mgdenno
  • 1 Post By Lieven
  • 1 Post By colinB
  • 3 Post By akidess
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   April 30, 2013, 11:58
Default is there a command to restate after setFields?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
I have changed the mesh after setFields command and it now gives an error
.so I like to know if is there a command or way to delete non uniform initial values and set it again after such changes?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 30, 2013, 12:56
Default
  #2
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 137
Rep Power: 7
mgdenno is on a distinguished road
I am not aware of a utility to reset the fields, however you can just open the text files in the 0 directory and delete the internal fields data so that the file only contains the boundary conditions. In general, I think the approach is to create a copy of the field files before running to setFields to avoid having to do it manually.
immortality likes this.
mgdenno is offline   Reply With Quote

Old   April 30, 2013, 16:14
Default
  #3
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Mol, Belgium
Posts: 295
Rep Power: 13
Lieven will become famous soon enough
Indeed, as Matthew suggests, make a habit of doing
Code:
cp -r 0 0.orig
before modifying the fields in the 0-folder. This will save you a lot of time ;-).
Putting the files back is then simply done as
Code:
cp 0.orig/* 0/
Cheers,

L
immortality likes this.
Lieven is offline   Reply With Quote

Old   June 21, 2013, 13:59
Default
  #4
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
but it would be nice that a tool be provided like in Swak4Foam for this purpose(if there is not any now!)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 25, 2013, 04:57
Default
  #5
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 9
colinB is on a distinguished road
actually the method suggested by Lieven is very simple
so there is no need for a separate tool,

however if you have recognized the need for a tool you can exploit the
great advantage of OpenFoam:
You can do everything yourself.
Along with the advantage comes a disadvantage:
You have to do everything yourself.

Still a simple search and replace function like

sed
(use google on that one in combination with keywords like
command and terminal or type: sed --help to get further advice on
how to use it)

in a bash script should do the work.

Deriving a separate c++ code or anything else from that problem
is breaking butterflies on a wheel in my opinion.

I hope I could contribute
regards
immortality likes this.
colinB is offline   Reply With Quote

Old   June 25, 2013, 06:29
Default
  #6
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
I think pyFoamClearInternalField.py is what you are looking for.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   June 30, 2013, 06:14
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
what does mean fieldfile?what should I replace it in the command?
Code:
=====
  pyFoamClearInternalField.py [options] <fieldfile>

pyFoamClearInternalField.py: error: Too few arguments (1 needed, 0 given)
ehsan@Ehsan-com:~/Desktop/two_parted$ clearInternalFields -help
clearInternalFields: command not found
ehsan@Ehsan-com:~/Desktop/two_parted$  pyFoamClearInternalField.py -help
Usage
=====
  pyFoamClearInternalField.py [options] <fieldfile>

Takes a field-file and makes the whole internal field uniform. Either taking
the value from a patch or using a user-specified value

Options
=======
--version               show program's version number and exit
--help, -h              show this help message and exit
--patch=PATCH           The name of the patch that should provide the value
--value=VALUE           The value that should be used for the internal field
--test                  Does not write the file but only prints it to the
                        screen
--source-key=SRCKEY     The key that should be read from the source patch:
                        value

Default
-------
Options common to all PyFoam-applications

--psyco-accelerated     Accelerate the script using the psyco-library
                        (EXPERIMENTAL and requires a separatly installed
                        psyco)
--profile-python        Profile the python-script (not the OpenFOAM-program) -
                        mostly of use for developers
--profile-cpython       Profile the python-script (not the OpenFOAM-program)
                        using the better cProfile library - mostly of use for
                        developers
--profile-hotshot       Profile the python-script using the hotshot-library
                        (not the OpenFOAM-program) - mostly of use for
                        developers - EXPERIMENTAL
--traceback-on-error    Prints a traceback when an error is encountered (for
                        debugging)
--interactive-debugger  In case of an exception start the interactive debugger
                        PDB. Also implies --traceback-on-error
--dump-application-data
                        Print the dictionary with the generated application
                        data after running
--pickle-application-data=PICKLEAPPLICATIONDATA
                        Write a pickled version of the application data to a
                        file. If the filename given is 'stdout' then the
                        pickled data is written to stdout. The usual standard
                        output is then captured and added to the application
                        data as an entry 'stdout' (same for 'stderr'). Be
                        careful with these option for commands that generate a
                        lot of output
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 30, 2013, 06:20
Default
  #8
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
according to the error I set a patch(right) and a value(p as a field) but nothing done.
Code:
ehsan@Ehsan-com:~/Desktop/two_parted$ pyFoamClearInternalField.py p
Error in /usr/local/bin/pyFoamClearInternalField.py : Either a patch or a value must be specified 
ehsan@Ehsan-com:~/Desktop/two_parted$ pyFoamClearInternalField.py right
Error in /usr/local/bin/pyFoamClearInternalField.py : Either a patch or a value must be specified
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 30, 2013, 06:55
Default
  #9
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,318
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@Ehsan: I have not tried this, but the help text seems very clear to me!
  • Need to modify the internal field by using the value that is currently already defined on the patch "right"? Then use:
    Code:
    pyFoamClearInternalField.py p --patch=right
  • Need to modify the internal field with the specified value? Then use:
    Code:
    pyFoamClearInternalField.py p --value=0.0

Best regards,
Bruno
immortality likes this.
wyldckat is offline   Reply With Quote

Old   June 30, 2013, 10:10
Default
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
the files are compressed.have to decompressed them at first?
Code:
ehsan@Ehsan-com:~/Desktop/two_parted$ pyFoamClearInternalField.py p --value=0.0
Error in /usr/local/bin/pyFoamClearInternalField.py : Problem with file p : [Errno 2] No such file or directory: '/home/ehsan/Desktop/two_parted/p.gz'
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 30, 2013, 17:43
Default
  #11
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,318
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
According to the error message, you should run like this:
Code:
pyFoamClearInternalField.py 0/p --value=0.0
wyldckat is offline   Reply With Quote

Old   June 30, 2013, 17:47
Default
  #12
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
I think so.
then should repeat it for all fields one after another.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with the execution of the setFields utility. foamer OpenFOAM Pre-Processing 5 June 3, 2013 12:24
how to use setFields in multiregionsolver lg88 OpenFOAM 8 January 15, 2013 06:01
setFields tool does not assign water volume for given mesh. paka OpenFOAM 2 June 7, 2012 09:17
setFields not working dsanza OpenFOAM 2 September 14, 2011 09:00
question on setFields fijinx OpenFOAM Running, Solving & CFD 1 February 15, 2010 16:07


All times are GMT -4. The time now is 18:54.