{"id":2293,"date":"2022-10-08T22:09:43","date_gmt":"2022-10-08T20:09:43","guid":{"rendered":"https:\/\/www.albertopassalacqua.com\/?p=2293"},"modified":"2022-10-08T22:09:43","modified_gmt":"2022-10-08T20:09:43","slug":"how-to-quickly-export-points-for-a-timevaryingfixedvalue-boundary-in-openfoam","status":"publish","type":"post","link":"https:\/\/www.albertopassalacqua.com\/?p=2293","title":{"rendered":"How to quickly export points for a timeVaryingFixedValue boundary in OpenFOAM"},"content":{"rendered":"\n<p style=\"text-align: justify;\">The <code>timeVaryingFixedValue<\/code> boundary in OpenFOAM allows data extracted from other simulations or experimental data to be mapped to be used as boundary condition. The boundary requires a directory structure containing the data to be set up as follows:<\/p>\n<ul style=\"text-align: justify;\">\n<li><code>caseName<\/code>\n<ul>\n<li><code>0<\/code><\/li>\n<li><code>constant<\/code>\n<ul>\n<li><code>boundaryData\/&lt;boundaryName&gt;<\/code>\n<ul>\n<li><code>TimeFolder0<\/code><\/li>\n<li><code>TimeFolder1<\/code><\/li>\n<li><code>points<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><code>system<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">The points file contains the coordinates of the points used to perform the data mapping. If data originate from another boundary conditions (e.g., the outlet of another simulation), it is straightforward to automatically generate such file.\u00a0<\/p>\n<p style=\"text-align: justify;\">Let us assume, for convenience, that the field <code>p<\/code> needs to be patched, and that the original simulation was executed with <code>pimpleFoam<\/code>. To extract the values of <code>p<\/code> and the <code>points<\/code> file, it suffices to define the following functionObject in the <code>controlDict<\/code> dictionary of the source simulation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">functions\n{\n\u00a0 \u00a0 extractPoints  \/\/ Arbitrary name\n\u00a0 \u00a0 {\n\u00a0 \u00a0 \u00a0 \u00a0 type \u00a0 \u00a0surfaces;\n\u00a0 \u00a0 \u00a0 \u00a0 libs \u00a0 \u00a0(sampling);\n\u00a0 \u00a0 \u00a0 \u00a0 log \u00a0 \u00a0 true;\n\n\n\u00a0 \u00a0 \u00a0 \u00a0 setFormat raw;\n\u00a0 \u00a0 \u00a0 \u00a0 surfaceFormat \u00a0 foam;\n\n\n\u00a0 \u00a0 \u00a0 \u00a0 writeControl \u00a0 \u00a0writeTime;\n\u00a0 \u00a0 \u00a0 \u00a0 writeInterval \u00a0 1;\n\n\n\u00a0 \u00a0 \u00a0 \u00a0 fields (p);\n\n\n\u00a0 \u00a0 \u00a0 \u00a0 surfaces\n\u00a0 \u00a0 \u00a0 \u00a0 {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/ Oversized sampling - for general testing\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 patchSample\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 type \u00a0 \u00a0 \u00a0patch;\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 patches\u00a0 \u00a0(massflowinlet);\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 }\n}<\/code><\/pre>\n\n\n\n<p style=\"text-align: justify;\">Note that the <code>surface Format<\/code> option is set to foam, to obtain the desired file.<\/p>\n<p style=\"text-align: justify;\">Executing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">pimpleFoam -postProcess<\/code><\/pre>\n\n\n\n<p style=\"text-align: justify;\">will produce the following directory structure in the case folder:<\/p>\n<ul style=\"text-align: justify;\">\n<li><code>postprocessing<\/code>\n<ul>\n<li><code>extractPoints<\/code>\n<ul>\n<li><code>timeFolder0<\/code>\n<ul>\n<li><code>patchSample<\/code>\n<ul>\n<li><code>scalarField<\/code>\n<ul>\n<li><code>scalarField<\/code>\n<ul>\n<li><code><strong>p<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><code>faceCentres<\/code><\/li>\n<li><code>faces<\/code><\/li>\n<li><code><strong>points<\/strong><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">which contains the desired <code>points<\/code> file and scalar field file <code>p<\/code> (in bold above).<\/p>\n<p style=\"text-align: justify;\"><strong>Note<\/strong>: change the name of the solver used to invoke the <code>-postProcess<\/code> option to be consistent with the one used for the specific simulation used as source of the data and points.<\/p>\n\n\n\n<p style=\"text-align: justify;\"><em>This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM\u00ae and OpenCFD\u00ae trade marks. Alberto Passalacqua is not associated to OpenCFD Ltd.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The timeVaryingFixedValue boundary in OpenFOAM allows data extracted from other simulations or experimental data to be mapped to be used as boundary condition. The boundary requires a directory structure containing the data to be set up as follows: caseName 0 constant boundaryData\/&lt;boundaryName&gt; TimeFolder0 TimeFolder1 points system The points file contains the coordinates of the points used to perform the data mapping. If data originate from another boundary conditions (e.g., the outlet of another simulation), it is straightforward to automatically generate such file.\u00a0 Let us assume, for convenience, that the field p needs to be patched, and that the original simulation was executed with pimpleFoam. To extract the values of p and the points file, it suffices to define the following functionObject in the controlDict dictionary of the source simulation: Note that the surface Format option is set to foam, to obtain the desired file. Executing: will produce the following directory structure in the case folder: postprocessing extractPoints timeFolder0 patchSample scalarField scalarField p faceCentres faces points which contains the desired points file and scalar field file p (in bold above). Note: change the name of the solver used to invoke the -postProcess option to be consistent with the one used for the specific simulation used as source of the data and points.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-2293","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/posts\/2293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2293"}],"version-history":[{"count":1,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/posts\/2293\/revisions"}],"predecessor-version":[{"id":2294,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=\/wp\/v2\/posts\/2293\/revisions\/2294"}],"wp:attachment":[{"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.albertopassalacqua.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}