|
[Sponsors] |
is there a command to restate after setFields? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16 ![]() |
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.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 ![]() |
Indeed, as Matthew suggests, make a habit of doing
Code:
cp -r 0 0.orig Putting the files back is then simply done as Code:
cp 0.orig/* 0/ L |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
Greetings to all!
@Ehsan: I have not tried this, but the help text seems very clear to me!
Best regards, Bruno
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#11 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128 ![]() ![]() ![]() ![]() ![]() ![]() |
According to the error message, you should run like this:
Code:
pyFoamClearInternalField.py 0/p --value=0.0
__________________
|
|
![]() |
![]() |
![]() |
![]() |
#12 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 ![]() |
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. |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to use setFields in multiregionsolver | lg88 | OpenFOAM | 18 | June 12, 2022 18:57 |
setFields not working | dsanza | OpenFOAM | 4 | October 18, 2018 09:43 |
Problems with the execution of the setFields utility. | foamer | OpenFOAM Pre-Processing | 5 | June 3, 2013 12:24 |
setFields tool does not assign water volume for given mesh. | paka | OpenFOAM | 2 | June 7, 2012 09:17 |
question on setFields | fijinx | OpenFOAM Running, Solving & CFD | 1 | February 15, 2010 15:07 |