Skip to content

Commit

Permalink
Changes in response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
atb1995 committed Nov 6, 2024
1 parent 8b21447 commit 3414a27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
16 changes: 6 additions & 10 deletions gusto/time_discretisation/implicit_runge_kutta.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class ImplicitRungeKutta(TimeDiscretisation):
For each i = 1, s in an s stage method
we have the intermediate solutions: \n
y_i = y^n + dt*(a_i1*k_1 + a_i2*k_2 + ... + a_ii*k_i) \n
We compute the gradient at the intermediate location, k_i = F(y_i) \n
For the increment form we compute the gradient at the \n
intermediate location, k_i = F(y_i), whilst for the \n
predictor form we solve for each intermediate solution y_i. \n
At the last stage, compute the new solution by: \n
y^{n+1} = y^n + dt*(b_1*k_1 + b_2*k_2 + .... + b_s*k_s)
Expand Down Expand Up @@ -110,14 +112,8 @@ def setup(self, equation, apply_bcs=True, *active_labels):
'Runge-Kutta formulation is not implemented'
)

def lhs(self):
return super().lhs

def rhs(self):
return super().rhs

def res(self, stage):
"""Set up the discretisation's residual for a given stage."""
"""Set up the residual for the predictor formulation for a given stage."""
# Add time derivative terms y_s - y^n for stage s
mass_form = self.residual.label_map(
lambda t: t.has_label(time_derivative),
Expand Down Expand Up @@ -150,7 +146,7 @@ def res(self, stage):

@property
def final_res(self):
"""Set up the discretisation's final residual."""
"""Set up the final residual fpr the predictor formulation."""
# Add time derivative terms y^{n+1} - y^n
mass_form = self.residual.label_map(lambda t: t.has_label(time_derivative),
map_if_false=drop)
Expand Down Expand Up @@ -194,7 +190,7 @@ def solver(self, stage):

@cached_property
def final_solver(self):
"""Set up a solver for the final solve to evaluate time level n+1."""
"""Set up a solver for the final solve for the predictor formulation to evaluate time level n+1."""
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.final_res, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
Expand Down
6 changes: 3 additions & 3 deletions gusto/time_discretisation/time_discretisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
operator F.
"""

from abc import ABCMeta, abstractmethod, abstractproperty
from abc import ABCMeta, abstractmethod
import math

from firedrake import (Function, TestFunction, TestFunctions, DirichletBC,
Expand Down Expand Up @@ -261,7 +261,7 @@ def setup(self, equation, apply_bcs=True, *active_labels):
def nlevels(self):
return 1

@abstractproperty
@property
def lhs(self):
"""Set up the discretisation's left hand side (the time derivative)."""
l = self.residual.label_map(
Expand All @@ -271,7 +271,7 @@ def lhs(self):

return l.form

@abstractproperty
@property
def rhs(self):
"""Set up the time discretisation's right hand side."""
r = self.residual.label_map(
Expand Down

0 comments on commit 3414a27

Please sign in to comment.