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/)
-   -   using transformPoints in a bash script (https://www.cfd-online.com/Forums/openfoam-pre-processing/220763-using-transformpoints-bash-script.html)

koful September 22, 2019 07:16

using transformPoints in a bash script
 
Hi everyone.

I would like to ask a "probably" very easy question. I am a little bit newbie at linux bash scripting.

I have a center of mass point "p", which comes from another calculation. How can I use it in tansformPoints command? I tried these different ways below but it does not work...

p="(0 0 0)"
transformPoints -translate '($p)'

p=\'\(\ 0\ 0\ 0\ \)\'
transformPoints -translate $p

trans='transformPoints'\ '-translate'\ \'\(0\ 0\ 0\)\'
$trans

I do not know should I post it at linux forums or openfoam forums.

HPE September 22, 2019 08:04

Have you sourced OpenFOAM bashrc before executing the bash script or inside the bash script?

Don't know the error type you get, yet the bash script should be informed regarding the OpenFOAM command 'transformPoints'.

koful September 22, 2019 09:10

Quote:

Originally Posted by HPE (Post 745166)
Have you sourced OpenFOAM bashrc before executing the bash script or inside the bash script?

Don't know the error type you get, yet the bash script should be informed regarding the OpenFOAM command 'transformPoints'.

Hi. Thank you for your response.

Yes I did. The other commands at my script are working. Like blockMesh or checkMesh. The error I got is:

"--> FOAM FATAL ERROR:
Wrong number of arguments, expected 0 found 2


FOAM exiting"

HPE September 22, 2019 09:30

Have a go, if possible:

Code:

#!/bin/sh                                                                                                                                                                                   
cd ${0%/*} || exit 1                        # Run from this directory         
                                                                               
vector="(0 0 20)"                                                             
                                                                               
transformPoints -translate "$vector"


koful September 22, 2019 10:22

Quote:

Originally Posted by HPE (Post 745181)
Have a go, if possible:

Code:

#!/bin/sh                                                                                                                                                                                   
cd ${0%/*} || exit 1                        # Run from this directory         
                                                                               
vector="(0 0 20)"                                                             
                                                                               
transformPoints -translate "$vector"


Thank you very much sir. It worked.

I tried lots of configurations but seems like I missed this one.

Thanks again, have a nice day.


All times are GMT -4. The time now is 05:24.