CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

OpenFoam- Boundary condition from file

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 11, 2021, 08:09
Default OpenFoam- Boundary condition from file
  #1
New Member
 
Rida
Join Date: Mar 2021
Posts: 1
Rep Power: 0
Rida_B is on a distinguished road
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
Rida_B is offline   Reply With Quote

 

Tags
boundary conditions, csv files


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 00:48.