Version 4 (modified by 12 years ago) ( diff ) | ,
---|
Primitive Source Terms
Previously, We've been using conservative source terms for anything we do in Cylindrical. This made sense, seeing as we need the conservative differential equations to make our finite difference approximations sensible. However, we can convert our q-array from conservative to primitive in i_src.f90, pass these conservative terms into Derivatives2D and Stiff, update the source terms in primitive form, and then convert these back to conservative form to pass along from src. The reason we would want to do this is because the Jacobian is much simpler in primitive form than conservative. Primitive variables are supported for both pure Cyl2D hydro and Cyl2D MHD.
Changes
There are a few changes. For now, the switch over to conservative source terms is optional. Put a line in your physics.data file (Mine is in the block where you set your symmetry axis) to toggle between conservative or primitive source terms (lPrimitive). Remember, that this will only influence your runs if you are using cylindrical coordinates. The default for this parameter is .TRUE. because of the promising increase in speed.
In globaldeclarations.f90, irDir, izDir, iE, ib1Dir, ib2Dir, qb3 were all made global quantities, as was lPrimitive. Because they were used only in i_setprob, i_src, and i_i_ODEs, it didn't make sense to have them stuck in CellInfo.
In i_src.f90, there are two new subroutines, conservative_to_primitive and primitive_to_conservative. These are pretty self-explanatory, but the order of inputs for cons to prim should be (q, qStar) and for prim to cons it is (qStar, q). qStar will always be the primitive version, q will still be conservative. qScale is expressed in terms of qStar, so the scaling should hold through the src and stiff routines.
i_i_ODEs.f90 has the actual source terms and updated Jacobians. DMcool also has a conservative counterpart, as does Uniform Gravity and Gravity. NEQcooling doesn't reference anything specific to either form, so it should be compatible with both. Analytic Cooling isn't supported with primitive source terms, and will Stop if you tell it to run.
i_press.f90 has a new function, PrimPress, which will return the pressure and pressure derivatives assuming the inputs are primitive variables.
There will be coming changes to i_setprob.f90 that will make a mapping of variables that are influenced by different combinations of source terms so as to specify the size of the arrays dqdt & dfdq. If we can make these smaller, there is an opportunity to increase the speed of the Stiff routine. However, this isn't in effect yet.
Attachments (1)
- Source_Terms.pdf (40.5 KB ) - added by 16 years ago.
Download all attachments as: .zip