|
[Sponsors] |
July 7, 2017, 10:43 |
Loading New Solution Variable into SU2?
|
#1 |
Senior Member
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13 |
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.!!! |
|
August 20, 2017, 10:40 |
|
#2 |
Super Moderator
Francisco Palacios
Join Date: Jan 2013
Location: Long Beach, CA
Posts: 404
Rep Power: 15 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
2way FSi, Initialize with steady solution, Fluent, Transient Sturcural, System Coupli | mmkkeshavarzi | FLUENT | 1 | June 28, 2024 07:03 |
Stuck Loading Initial Solution Data | mattacker | FLUENT | 1 | July 15, 2016 07:48 |
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 |