hystrath / hyStrath

Hypersonic / Rarefied gas dynamics code developments (GPL-3.0)
https://hystrath.github.io/
GNU General Public License v3.0
219 stars 109 forks source link

Help regarding varying Mach number for FireII Case #126

Closed SRH-MSVD closed 1 year ago

SRH-MSVD commented 1 year ago

I am using OpenFOAM v1706 and I have been able to run the FireII No and 5 reaction cases. I want to change the velocity for these cases. The default velocity is 1.147e4 m/s which is roughly Mach 39. To change the Mach number to values such as 5 and 20, I change the value of the xVelocityInlet present in the fireII_NR\0\include\initialConditions file to the appropriate value of speed in m/s.

xVelocityInlet 1.147e4; velocityInlet ($xVelocityInlet 0 0); velocityField (0 0 0); velocityWall (0 0 0);

However, while recording the values (say p, shear stress), they stay the same for all Mach cases and don't vary. Is there any other file to provide the initial condition, or any mistake in what I am doing?

Thanks

vincentcasseau commented 1 year ago

Hi Hari, Did you rerun the case from startTime or latestTime? What you did is correct if you are starting a new simulation from scratch. Otherwise, you have to manually edit the value of U at the inlet in the latestTime folder. Thanks

SRH-MSVD commented 1 year ago

Hi Vincent,

Thanks for the reply. I checked the conditions in the controlDict file which I had given as:

startFrom latestTime; startTime 0; stopAt /writeNow;/endTime; endTime 2.0e-03; deltaT 1.0e-10;

For different cases of Mach numbers, I copied the base case to different folders and cleaned the existing data before I modified the velocity value. I wait for the simulation to reach the endTime and always start any new run in a new folder. Will this still result in the values getting affected due to startFrom condition?

vincentcasseau commented 1 year ago

Hi Hari,

Everything that you did is right. One way to check that the new inlet velocity value has been read correctly would be to open 0.002/U, scroll down to the inlet patch and check that the fixed value corresponds to that in given 0/include/initialConditions. If you are not comfortable using 0/include/initialConditions, you could delete 0/include and set values/BCs for U/p/T/Y in their respective files.

Could you please confirm that 0.002/U/inlet/value differ from folder to folder? Thanks

SRH-MSVD commented 1 year ago

Thank you. I did check the 0.002\U file for two different cases - M 5 and M 30. They are the same. So, I double-checked the 0\include\initialConditions file for both cases, and they were different.

I then checked the 0\U\inlet\value for the two cases, and their values are the same as 0.002\U\inlet\value. So could this be the issue, and requires changing the values in 0\include\initialConditions and 0\U, or try your method mentioned above of deleting 0\include and directly changing the values?

vincentcasseau commented 1 year ago

If possible, please send me the M5 and M30 folders with their 0/ sub-folders and 0.002\U only. Thanks

SRH-MSVD commented 1 year ago

Yes, I have mailed the files to hystrath@gmail.com

vincentcasseau commented 1 year ago

Thanks Hari.

The inlet velocity BCs in 0/U file for M5 and M30 are identical:

boundaryField
{
    inlet
    {
        type            rampInlet;
        refValue        uniform (1 0 0);
        offset          (0 0 0);
        amplitude       constant 11370;
        tRamp           constant 0.0001;
    }
}

as opposed to

#include "include/initialConditions"

boundaryField
{
    inlet
    {
        type            rampInlet;
        refValue        uniform (1 0 0);
        offset          (0 0 0);
        amplitude       $xVelocityInlet;
        tRamp           1e-4;
    }
}

See one example here: hy2Foam/bluntedCone/0/U

You can use 0/include/initialConditions when you are truly running your case from scratch. The variables in 0/include/initialConditions are called using a "$" (see above). Once you run the code however, the variables are substituted by their numerical values (and the link with 0/include/initialConditions is broken).

So, you should indeed edit 0/U/inlet/amplitude directly. That said, you may want to keep and edit 0/include/initialConditions as well in M5 because it is sometimes used to pass the freestream velocity value to the system/forces dict.

SRH-MSVD commented 1 year ago

Thank you very much. I made the necessary changes and obtained this result for 0.002\U for the M30 case:

boundaryField
{
    inlet
    {
        type            rampInlet;
        value           uniform (8756 0 0);
        refValue        uniform (1 0 0);
        offset          (0 0 0);
        amplitude       constant 8756;
        tRamp           constant 0.0001;
    }

I also verified other values such as p with the base case in ParaView and they now vary.