Skip to content

Commit

Permalink
ConservationCalculation.m: Add calculations to convert between primit…
Browse files Browse the repository at this point in the history
…ive and conserved variables
  • Loading branch information
ianhinder committed Oct 1, 2010
1 parent 9749a0f commit 6bb8de8
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Tools/CodeGen/ConservationCalculation.m
Expand Up @@ -30,6 +30,8 @@
ConservationCalculationDeclaredGroups;
ConservationDifferencingRealParameters;
hlleAlpha;
PrimitiveEquations;
ConservedEquations;

Begin["`Private`"];

Expand Down Expand Up @@ -161,19 +163,35 @@
Table[dot[v] -> dot[v] - PDplus[fluxSymbol[v], i], {v, consVars[calc]}]
};

primitivesCalc[calc_, thornName_] :=
{
Name -> lookup[calc, Name] <> "_primitives",
Schedule -> {"in MoL_PostStep after " <> thornName <>"_ApplyBCs"},
Equations -> lookup[calc, PrimitiveEquations]
};

conservedCalc[calc_] :=
{
Name -> lookup[calc, Name] <> "_conserved",
Schedule -> {"at POSTINITIAL"},
Equations -> lookup[calc, ConservedEquations]
};

(* Given a ConservationCalculation structure, return a list of
calculations which should be scheduled to solve that conservation
law. *)
ProcessConservationCalculation[calc_] :=
ProcessConservationCalculation[calc_, thornName_] :=
Module[{},
{
zeroRHSCalc[calc],
Sequence@@Flatten[
Table[
{reconstructCalc[calc, i],
{conservedCalc[calc],
reconstructCalc[calc, i],
(* conservedFluxCalc[i], *)
fluxCalc[calc, i],
rhs[calc, i]}, {i, 1, 1}], 1]
rhs[calc, i],
primitivesCalc[calc, thornName]}, {i, 1, 1}], 1]
}];

(* Return all the new groups which need to be created for this
Expand Down

0 comments on commit 6bb8de8

Please sign in to comment.