How cooling is called/used in the code

The code's main program is scrambler.f90, of course. In it are the initialization sequence calls, like 'physics init'. One of the things physics init does is call cooling init.

Cooling Init is in Cooling.f90. It is commented to say "initializes cooling table", but actually doesn't do anything… (It is a stub). Perhaps it is the relic from an older version of the code.

Now, the main meat of the cooling functionality goes like this.

In source_control.f90, there is a function called "SrcDerivs". This function's main goal is to populate the dqdt array with the code's source functions. Dqdt array contains geometrical source terms (like cylindrical corrections), energy source terms (like cooling), etc. At the end of this function, we have, "SrcDerivs=dqdt" (arrays).

If cooling is turned on, this function SrcDerivs calls the function "Cooling" (located in the cooling module: cooling.f90). "Cooling" returns a dqdt for SrcDerivs, specific for the type of cooling that is switched on.

For instance, take IICooling. "Cooling" selects the type of cooling that is present with a case statement:

If Case(IICool), Call II_Cooling

Now, IICooling is located in !IICooling.f90 and it calculates a dqdt(iE) based on a heating/cooling rate which themselves are functions of the II Cooling Parameters (stored in the array !IICoolPars). Once dqdt(iE) is calculated for this cooling choice, it is stored in the iE's element of the array SrcDerivs.

SrcDerivs array is used to update the q array in the subroutine, "RKorder2" back in source_control.f90. This is something like: q(i)=SrcDerivs(i)*dt + q(i).

The procedure would be similar (i.e. SrcDeriv and q would be updated in a similar manner) if another cooling process was selected instead of IIcooling.

Thus, it would seem, the only things necessary for turning cooling on in the code are the following two steps:

  1. Select the type of cooling in physics.data, e.g. iCooling=3 (for II cool) (as long as iCooling/=0, cooling should be turned on in the code)
  2. Define any cooling params to be used by cooling module by adding these to both the problemdata namelist in problem.f90 (e.g. IICoolPars() array for the case of II Cooling), as well as define their corresponding values in problem.data.

You should now be ready to cool!

Comments

No comments.