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

is there a command to restate after setFields?

Register Blogs Community New Posts Updated Threads Search

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 Search this Thread Display Modes
Old   April 30, 2013, 12: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,208
Rep Power: 27
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, 13:56
Default
  #2
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16
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, 17:14
Default
  #3
Senior Member
 
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23
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, 14:59
Default
  #4
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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, 05:57
Default
  #5
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
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, 07:29
Default
  #6
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
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.
akidess is offline   Reply With Quote

Old   June 30, 2013, 07:14
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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, 07:20
Default
  #8
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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, 07:55
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 11:10
Default
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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, 18:43
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 18:47
Default
  #12
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
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


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
how to use setFields in multiregionsolver lg88 OpenFOAM 18 June 12, 2022 19:57
setFields not working dsanza OpenFOAM 4 October 18, 2018 10:43
Problems with the execution of the setFields utility. foamer OpenFOAM Pre-Processing 5 June 3, 2013 13:24
setFields tool does not assign water volume for given mesh. paka OpenFOAM 2 June 7, 2012 10:17
question on setFields fijinx OpenFOAM Running, Solving & CFD 1 February 15, 2010 16:07


All times are GMT -4. The time now is 04:06.