|
[Sponsors] |
Initialization with two different initial states-Shock tube problem.!!! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 14, 2014, 05:32 |
Initialization with two different initial states-Shock tube problem.!!!
|
#1 |
Senior Member
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13 |
Hi, I would like to simulate shock tube problem, for which I need to set two different initial conditions. The tube is 800 unit long, first half portion of the domain need to be initialized with high pressure & second half to be low pressure. I tried the following in "SetInitialCondition" class and its not working. Its not starting the simulation.
Code:
if (shocktube) { double *Coord, Pressure, Temperature, Density, VelocityX, VelocityY, Energy, ModVel2; double Gamma_Minus_One = Gamma - 1.0; double Gas_Constant = config->GetGas_Constant(); for (iMesh = 0; iMesh <= config->GetMGLevels(); iMesh++) { for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { Coord = geometry[iMesh]->node[iPoint]->GetCoord(); if(Coord[0] <= 400) { Pressure = 5*101325.0; Temperature = 288.0; Density = Pressure/(Gas_Constant*Temperature); VelocityX = 0.0; VelocityY = 0.0; ModVel2 = 0.0; Energy = Pressure/(Density*Gamma_Minus_One)+0.5*ModVel2; solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(0, Density); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(1, VelocityX); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(2, VelocityY); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(nVar-1,Energy); } else { Pressure = 101325.0; Temperature = 288.0; Density = Pressure/(Gas_Constant*Temperature); VelocityX = 0.0; VelocityY = 0.0; ModVel2 = 0.0; Energy = Pressure/(Density*Gamma_Minus_One)+0.5*ModVel2; solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(0, Density); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(1, VelocityX); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(2, VelocityY); solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(nVar-1,Energy); } } /*--- Set the MPI communication ---*/ solver_container[iMesh][FLOW_SOL]->Set_MPI_Solution(geometry[iMesh], config); } } Thanks .!!!! |
|
October 20, 2014, 13:55 |
|
#2 | |
Senior Member
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13 |
Quote:
Could you please provide more detail about what you mean by "it is not starting the simulation"? Is there an error message? Are any output files produced? Does it freeze indefinitely? Also, have you tried introducing the following? solver_container[iMesh][FLOW_SOL]->Set_MPI_Solution_Old(geometry[iMesh], config); If the code is just freezing indefinitely, it may be that it is getting stuck because mpi is waiting for the old solution information somewhere - that shouldn't be a problem in serial, but it's something to check. You may also want to check that the code does execute the code snippet you posted - if no solution is being set at all that could be why the simulation does not proceed. One thing you could try is to look at the restart file format, and set up a restart file that has the initial conditions you want, and then set SU2 to restart a solution from that file with: RESTART_SOL = NO SOLUTION_FLOW_FILENAME = (your initial condition file).dat |
||
October 20, 2014, 14:07 |
|
#3 | |
Senior Member
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13 |
Quote:
Code:
if (shocktube && ExtIter==0) {} |
||
September 27, 2017, 19:32 |
SU2 Shock Tube Initialization
|
#4 |
Member
Mehdi Mortazawy
Join Date: Mar 2017
Posts: 30
Rep Power: 9 |
Hello All,
I am super new to SU2 and would like to know if there is any testcase or tutotial regarding the classical unsteady Shock Tube problem in 2D? I have created a 2D rectangular mesh in Pointwise with left side vertical line named as "inlet", right line as "outlet", top and bottom as "wall", and would like to know how I should define my Boundary conditions? Also, how can I initialize in SU2? Please be very generous in your explanation as I am very new to SU2 and would like to use SU2 for my Masters Thesis to validate an Experimental PHD Thesis. I would really appreciate any comment and advice. Thank you! https://www.dropbox.com/s/qxxbly4i68..._6034.JPG?dl=0 |
|
September 29, 2017, 16:09 |
|
#5 | |
Member
Mehdi Mortazawy
Join Date: Mar 2017
Posts: 30
Rep Power: 9 |
Quote:
I am trying to simulate a 2D shock tube using SU2, and I am having difficulty understanding how to initialize the high pressure and low pressure zones. I would really appreciate if you could please explain more in details which .cpp files are you editing and where do you input the above code? Thanks! |
||
October 1, 2017, 11:50 |
|
#6 |
Senior Member
Vino
Join Date: Mar 2013
Posts: 130
Rep Power: 13 |
Dear Mehdi,
To simulate shocktube, you need to specify left and right states (two different initial states). A quick fix will be to run the simulation for 1 iter, then modify the restart file to initialize left and right states, then restart the simulation from restart file. It should work. Another way is to add a initial condition specific to shocktube problem. in "solver_direct_mean.cpp" in "CEulerSolver::SetInitialCondition()" class { ...... if (shocktube) then specify different. initial conditions ...... } I don't know whether there is any better way to do. But this will help you to start with at least. It is difficult to post all the required modification here, hence I have added it in github. you can have a look at it. Its working, but results are not validated yet. https://github.com/vino-123/SU2_v.50_shock_tube thanks, vino. |
|
October 1, 2017, 12:25 |
|
#7 | |
Member
Mehdi Mortazawy
Join Date: Mar 2017
Posts: 30
Rep Power: 9 |
Quote:
Thank you so much for the detail reply. I really appreciate that and the fact that you posted the code along with the example. Its a great help and start for me to learn how to modify the source code towards my needs/ goals in future. It is interesting to note that the Shocktube (config file) example you have posted as a test case does not define any Unsteady Simulation parameter inside it. Regardless, I will give this a try tonight and will keep you updated about the results. We will be using SU2's shock capturing scheme to validate experimental work as a thesis. Once again, thank you very much for the detailed information! Mehdi |
||
October 2, 2017, 22:57 |
|
#8 | |
Member
Mehdi Mortazawy
Join Date: Mar 2017
Posts: 30
Rep Power: 9 |
Quote:
So just posting an update on this. It now works perfectly and the results look pretty interesting! |
||
May 22, 2018, 14:38 |
similar problem for simulate mixing layer
|
#9 | |
New Member
Chao
Join Date: Aug 2016
Posts: 1
Rep Power: 0 |
Dear Vino,
Your reply is very useful. In fact, recently I am trying to simulate mixing layer with su2. I also have such initialization problem. In my case I think only difference is just I have two flow which are parallel to each other with opposite velocity and placed horizontally. I am planning to use Navier-Stokes instead of Euler and trying to figure out where to initialize the flow properties and modify the code similarly as you did. I check your modified code but I found only Euler has CEulerSolver::SetInitialCondition(...). In Navier-Stokes solver, is there such initial condition setting function? I appreciate any response from you in advance! Thanks Chao Quote:
|
||
August 3, 2022, 12:20 |
|
#10 |
Senior Member
Ashwani
Join Date: Sep 2013
Location: Hyderabad
Posts: 154
Rep Power: 12 |
Though the post is old. However, if you follow the SU2 coding style, you shall use the same function mentioned in Euler Solver to set the initial condition.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 10:08 |
Unstabil Simulation with chtMultiRegionFoam | mbay101 | OpenFOAM Running, Solving & CFD | 13 | December 28, 2013 13:12 |
SLTS+rhoPisoFoam: what is rDeltaT??? | nileshjrane | OpenFOAM Running, Solving & CFD | 4 | February 25, 2013 04:13 |
Problems with simulating TurbFOAM | barath.ezhilan | OpenFOAM | 13 | July 16, 2009 05:55 |
Differences between serial and parallel runs | carsten | OpenFOAM Bugs | 11 | September 12, 2008 11:16 |