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

Loading New Solution Variable into SU2?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2017, 10:43
Post Loading New Solution Variable into SU2?
  #1
Senior Member
 
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13
Vino is on a distinguished road
Dear All,

I would like to add 6 new turbulent solution variables into su2 from an external file/modified restart file. These solution variables should be accessible to turbulent solver, but will remain unchanged during simulation.

Can someone please help me out on how to proceed with this implementation?

Thank you very much in advance.!!!
Vino is offline   Reply With Quote

Old   August 20, 2017, 10:40
Default
  #2
Super Moderator
 
Francisco Palacios
Join Date: Jan 2013
Location: Long Beach, CA
Posts: 404
Rep Power: 15
fpalacios is on a distinguished road
Hi Vino, thanks for using SU2!
If you already have the variables in the SU2 restart file and you just want to read them the relevant subroutines are

void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) in solver_direct_turbulent.cpp

void CSolver::Read_SU2_Restart_ASCII(CGeometry *geometry, CConfig *config, string val_filename) in solver_structure.cpp at the end of this subroutine you have

for (iPoint_Global = 0; iPoint_Global < geometry->GetGlobal_nPointDomain(); iPoint_Global++ ) {

getline (restart_file, text_line);

istringstream point_line(text_line);

/*--- Retrieve local index. If this node from the restart file lives
on the current processor, we will load and instantiate the vars. ---*/

iPoint_Local = geometry->GetGlobal_to_Local_Point(iPoint_Global);

if (iPoint_Local > -1) {

/*--- The PointID is not stored --*/

point_line >> index;

/*--- Store the solution (starting with node coordinates) --*/

for (iVar = 0; iVar < Restart_Vars[1]; iVar++)
point_line >> Restart_Data[counter*Restart_Vars[1] + iVar];

/*--- Increment our local point counter. ---*/

counter++;

}
}

where you read the restart file (ASCII) and store the result in

Restart_Data[counter*Restart_Vars[1] + iVar]

the size of Restart_Data is defined above

/*--- Set the number of variables, one per field in the
restart file (without including the PointID) ---*/

Restart_Vars[1] = (int)config->fields.size() - 1;

/*--- Allocate memory for the restart data. ---*/

Restart_Data = new passivedouble[Restart_Vars[1]*geometry->GetnPointDomain()];

In your case you should add

Restart_Vars[1] +=6;

only for the turbulence equation

then your go back to

void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) in solver_direct_turbulent.cpp

and store the new data in Restart_Data in another variable that you can access like in the example:

if (iPoint_Local > -1) {

/*--- We need to store this point's data, so jump to the correct
offset in the buffer of data from the restart file and load it. ---*/

index = counter*Restart_Vars[1] + skipVars;
for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar];
node[iPoint_Local]->SetSolution(Solution);
iPoint_Global_Local++;

/*--- Increment the overall counter for how many points have been loaded. ---*/
counter++;
}

I hope this helps!

Thanks for using Su2,

Best,
Francisco
fpalacios is offline   Reply With Quote

Old   August 20, 2017, 10:58
Default
  #3
Senior Member
 
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13
Vino is on a distinguished road
Dear fpalacios,

Thank you very much for you detailed reply.
Vino is offline   Reply With Quote

Reply


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
Stuck Loading Initial Solution Data mattacker FLUENT 1 July 15, 2016 07:48
2way FSi, Initialize with steady solution, Fluent, Transient Sturcural, System Coupli mmkkeshavarzi FLUENT 0 June 22, 2016 08:26
emag beta feature: charge density charlotte CFX 4 March 22, 2011 09:14
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 20:09
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 01:16


All times are GMT -4. The time now is 07:53.