CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

custom boundary conditions in SU2

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2021, 01:47
Post custom boundary conditions in SU2
  #1
New Member
 
NDP
Join Date: Sep 2021
Posts: 3
Rep Power: 4
ndpiitb is on a distinguished road
I am trying to add custom boundary conditions for my CFD analysis in which i have to provide dritchlet B.C. on a marker using a text file having variable values stored. I tried to add my own BC_custom code but it seems its not working. Plz help me regarding implementation of BC_Custom
ndpiitb is offline   Reply With Quote

Old   September 18, 2021, 13:29
Default
  #2
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 499
Rep Power: 17
bigfootedrockmidget is on a distinguished road
Hi,

Do you mean you would like to use the option SPECIFIED_INLET_PROFILE= YES ?

We have a number of testcases here, split into config files and meshes :
https://github.com/su2code/TestCases
https://github.com/su2code/SU2/tree/master/TestCases

An example using an inlet profile is here:
https://github.com/su2code/SU2/blob/...poiseuille.cfg

if the file containing the inlet profile does not exist yet, SU2 will create a default file for you and exit. You can then edit this file.


bigfootedrockmidget is offline   Reply With Quote

Old   October 6, 2021, 13:35
Default BC_Custom
  #3
New Member
 
NDP
Join Date: Sep 2021
Posts: 3
Rep Power: 4
ndpiitb is on a distinguished road
No I am talking about providing the solution for a boundary marker as custom boundary condition. I have made some changes in the else condition of BC_custom function of CFVMFlowSolverBase.inl , but still i am not getting the correct solution.

code which i have written in th else condition

unsigned short iVar;
unsigned long iVertex, iPoint, total_index, iLine, iBnd;
bool fndBnd;


/*--- Identify the boundary by string name ---*/
string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
cout<<"marker name"<<Marker_Tag<<endl;

unsigned long bc_dat_point[geometry->nVertex[val_marker]];
double bc_dat[geometry->nVertex[val_marker]][nVar];

int rank = MASTER_NODE;

//Expect custom b.c. data in an ASCII file with filename same as the marker
//and extension ".txt"

char bc_filename[MAX_STRING_SIZE];
strcpy(bc_filename, (Marker_Tag+".txt").c_str());
ifstream bc_file;
bc_file.open(bc_filename, ios::in);
if (bc_file.fail()) {
if (rank == MASTER_NODE)
cout << endl << "Custom bc file (" << bc_filename << ") missing!" << endl;
exit(EXIT_FAILURE);
}

string text_line;

/*--- Parse the custom bc data file ---*/
//It is a space-delimited ASCII file, with each line corresponding to a
//boundary point; in each line, the first entry is the point index (w.r.t. the
//global mesh), and the remaining entries are the solution values at the point

getline (bc_file, text_line);
stringstream linestream1(text_line);
int nVertFile, nVarFile;
linestream1 >> nVertFile >> nVarFile;
if (nVertFile != geometry->nVertex[val_marker]) {
cout << "Mismatch of no. of vertices in custom bc file " << nVertFile << endl;
exit(EXIT_FAILURE);
}
if (nVarFile != nVar) {
cout << "Mismatch of no. of variables in custom bc file " << nVarFile << endl;
exit(EXIT_FAILURE);
}

cout<<"nVar="<<nVar<<"nVarfile="<<nVarFile<<endl;

iLine = 0;
while (getline (bc_file, text_line)) {
stringstream linestream(text_line);
linestream >> bc_dat_point[iLine]; //Global index of boundary point
cout<<"bc_dat_point="<<bc_dat_point[iLine]<<endl;
for (iVar = 0; iVar < nVar; iVar++) {linestream >> bc_dat[iLine][iVar];
cout<<"bc_dat="<<bc_dat[iLine][iVar]<<endl;
}
iLine++;
}


/*--- Loop over all of the vertices on this boundary marker ---*/

SU2_OMP_FOR_STAT(OMP_MIN_SIZE)
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {

/*--- Get the point index for the current node. ---*/
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();

/*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
su2double Solution[MAXNVAR] = {0.0};
su2double SOL[MAXNVAR] = {0.0};
if (geometry->nodes->GetDomain(iPoint)) {
fndBnd = false; //Haven't found this boundary point as yet
for (iBnd = 0; iBnd < geometry->nVertex[val_marker]; iBnd++) {
if (bc_dat_point[iBnd] == geometry->nodes->GetGlobalIndex(iPoint)) {
for (iVar = 0; iVar < nVar; iVar++) {Solution[iVar] = bc_dat[iBnd][iVar];
cout<<"solution"<<Solution[iVar]<<endl;
}
fndBnd = true;
break;
}
}
if (!fndBnd) {
if (rank == MASTER_NODE)
cout << "Failed to find solution for point index "
<< geometry->nodes->GetGlobalIndex(iPoint) << " in "
<< bc_filename << endl;
exit(EXIT_FAILURE);
}

/*--- Set Solution and zero Residual ---*/
for (iVar =0;iVar<nVar;iVar++){
nodes->SetSolution_Old(iPoint,iVar, Solution[iVar]);
nodes->SetSolution(iPoint,iVar, Solution[iVar]);

}
LinSysRes.SetBlock_Zero(iPoint);
nodes->SetRes_TruncErrorZero(iPoint);


for (iVar =0;iVar<nVar;iVar++){
SOL[iVar]=GetNodes()->GetSolution(iPoint,iVar);
cout<<"Solution updated"<<SOL[iVar]<<endl;
}

}

END_SU2_OMP_FOR
}
}
}




I am unable to find what mistake i am doing, plz help.
ndpiitb is offline   Reply With Quote

Reply

Tags
bc_custom, su2 7.1.1


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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
Centrifugal fan j0hnny CFX 13 October 1, 2019 13:55
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28


All times are GMT -4. The time now is 01:23.