|
[Sponsors] |
March 11, 2021, 08:09 |
OpenFoam- Boundary condition from file
|
#1 |
New Member
Rida
Join Date: Mar 2021
Posts: 1
Rep Power: 0 |
Hello everyone,
I am working on a OpenFoam simulation with the energy equation. My problem is very simple. When setting initial boundary conditions for temperature, I aim to give specific values of temperature to each point of the mesh (or face ) from an external csv file containting ( xpos, ypos, zpos, T(xpos,ypos,zpos) ). I wrote this part of the code, but I get a warrning : " attempt to read beyond EOF " which I dont understand what It really means. CODE : boundaryField { ".*" { type codedFixedValue; code #{ std::ifstream file(file_temperature); if (file.is_open() ) { for ( long row=1 ; row<=csv_total_rows ; row++ ) { for(long column=1; column<=csv_total_columns; column++) { long index = (row-1)*csv_total_columns+column-1; scalar xpos = csv_data[index].nodeposition[0]; scalar ypos = csv_data[index].nodeposition[1]; scalar zpos = csv_data[index].nodeposition[2]; pos(xpos, ypos, zpos); scalar T = csv_data[index].nodeposition[3]; } } file.close(); } #}; codeInclude #{ #include <cmath> #include <iostream> #include <fstream> #}; } } I hope I can get some answers, thank you very much |
|
Tags |
boundary conditions, csv files |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 03:30 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 16:02 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 06:28 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 05:18 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 17:51 |