Closed umgraftw closed 3 years ago
At the end of the day, the only thing that matters is that all 5 (4 if using an isothermal eos) components of phydro->u
are set. You can do this manually, or, if you prefer primitive variables, you can set all 5 (or 4) components of phydro->w
and then call peos->PrimitiveToConserved(...)
to set u
given w
. Of the example pgens included with the code, I believe only the GR ones do this latter method, but it is always an option.
After the problem is initialized, phydro->w
will be recalculated from phydro->u
automatically to ensure consistency.
With your example, it's important to remember that phydro->u
is kinetic + internal (+ magnetic) energy, so by only setting it to internal energy, the code will calculate a state that is not what you think. Also, while the arrays are probably 0-initialized, it's not a bad idea to explicitly set the IM3
component of momentum to 0 if that's what you intend it to be.
On this page of the wiki in the problem generators section it says that primitive variables (such as pressure) are automatically generated by the code. What I'm wondering is: how exactly is the code generating these primitive variables and is there any way they (specifically pressure) can be set as initial conditions in the problem generator.
So far I have tried using phydro->u(IEN,k,j,i) and phydro->w(IPR,k,j,i) to control the initial pressure but when I look at the t=0 output the pressure profile doesn't look like what I think it should.
I think the problem may be that I am trying to evolve an isothermal equilibrium using an adiabatic equation of state (ie there are adiabatic perturbations on an isothermal equilibrium) to see how instabilities might emerge. I think I may have to use a general equation of state to achieve this but I thought that since the isothermal part is only in the initial conditions I would be able to have a simple adiabatic equation of state.
I have attached a section of my problem generator and an image of the initial pressure (and density) profile of the t=0 output.
My intention is that there should be a linear relationship between rho and press at t=0 but clearly there isn't. I'm not sure how to manipulate the initial conditions to allow that.
Any help would be greatly appreciated, thank you very much in advance.
Will