|
[Sponsors] |
April 5, 2017, 21:29 |
Writing a data in the OpenFoam Case
|
#1 |
Senior Member
Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 13 |
Hi,
I am trying to achieve following using PyFoam. I know it can be done in a very trivial way, but not sure how to go about it. I have a data(scalarField(Numpy array)), I want to write it as a initial condition of a Passive scalar at a given time-step. Here is how I implemented it using PyFoam. Code:
fname= loc+"T"; f = ParsedParameterFile(fname) for j in range(0,len(data)): f["internalField"][j] = data[j]; f.writeFile() Following is I want, I want to use the a general T file of following format Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 1 0 0 0]; internalField uniform 0; boundaryField { inlet { type zeroGradient; } outlet { type zeroGradient; } wall.ceiling { type zeroGradient; } wall.1 { type zeroGradient; } wall.3 { type zeroGradient; } emptyZ { type empty; } } and some other too but couldn't accomplish, I am not able to get any detail documentations of using these functions.Any guidance will be really helpful. Edit: In simple words I would like to write the data in the openFoam format using the case file as a template. @gschaider any suggestions... Regards Last edited by himanshu28; April 6, 2017 at 12:27. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 02:36 |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 05:29 |
[snappyHexMesh] crash sHM | H25E | OpenFOAM Meshing & Mesh Conversion | 11 | November 10, 2014 11:27 |
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 12 | May 2, 2013 10:52 |
Need help to open an OpenFoam case with Paraviw | aaurouss | OpenFOAM | 2 | July 6, 2009 13:18 |