{"id":3042,"date":"2022-02-28T14:20:35","date_gmt":"2022-02-28T13:20:35","guid":{"rendered":"https:\/\/silentdynamics.de\/?p=3042"},"modified":"2022-02-28T14:21:01","modified_gmt":"2022-02-28T13:21:01","slug":"vektoranalysis-im-bash","status":"publish","type":"post","link":"https:\/\/silentdynamics.de\/en\/2022\/02\/28\/vektoranalysis-im-bash\/","title":{"rendered":"Vektoranalysis in der Bash Shell"},"content":{"rendered":"\n<p>When performing preparatory operations for e.g. CFD or FEM analyses, it is often necessary to specify vector parameters. Vector constants are easy to handle:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DIR=\"1 0 0\"\n\nmyMesh --direction \"$DIR\"<\/pre>\n\n\n\n<p>However, it quickly becomes complicated if the vectors have to be manipulated, e.g. multiplied by scalars or rotated.<\/p>\n\n\n\n<p>A powerful solution is to use the Matlab Octave clone to perform the operations. Two features of octave are useful in this context:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the command line option &#8220;&#8211;eval&#8221; to specify the expression to handle<\/li><li>the function &#8220;disp&#8221; to output the results in plain format in a single line<\/li><\/ul>\n\n\n\n<p>An example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DIR=\"1 0 0\"\nVELOCITY=$(octave --eval \"disp( 11.*[$DIR] )\")\n\nmyMesh --direction \"$DIR\"\nmySolver --velocity \"$VELOCITY\"<\/pre>\n\n\n\n<p>More complicated operation are possible. Though one needs to take care to produce line vectors as results. Rotation as an example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DIR=\"1 0 0\"\nANG=45\n\nDIR_ROT=$(octave --eval \"pkg load linear-algebra; disp( (rotv([0 0 1], $ANG*pi\/180)*[$DIR]')' )\")\n\nmyMesh --direction \"$DIR_ROT\"<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When performing preparatory operations for e.g. CFD or FEM analyses, it is often necessary to specify vector parameters. Vector constants are easy to handle: DIR=&#8221;1 0 0&#8243; myMesh &#8211;direction &#8220;$DIR&#8221; However, it quickly becomes complicated if the vectors have to be manipulated, e.g. multiplied by scalars or rotated. A powerful solution is to use the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[951],"tags":[],"class_list":["post-3042","post","type-post","status-publish","format-standard","hentry","category-simulation"],"_links":{"self":[{"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/posts\/3042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/comments?post=3042"}],"version-history":[{"count":0,"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/posts\/3042\/revisions"}],"wp:attachment":[{"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/media?parent=3042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/categories?post=3042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/silentdynamics.de\/en\/wp-json\/wp\/v2\/tags?post=3042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}