Skip to content

Commit

Permalink
Merge pull request #543 from RemDelaporteMathurin/formatting
Browse files Browse the repository at this point in the history
Formatting
  • Loading branch information
RemDelaporteMathurin authored Jun 29, 2023
2 parents cbf6f77 + fc92029 commit aa7d822
Show file tree
Hide file tree
Showing 28 changed files with 3 additions and 32 deletions.
1 change: 0 additions & 1 deletion festim/boundary_conditions/boundary_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BoundaryCondition:
"""

def __init__(self, surfaces, field) -> None:

if not isinstance(surfaces, list):
surfaces = [surfaces]
self.surfaces = surfaces
Expand Down
1 change: 0 additions & 1 deletion festim/boundary_conditions/dirichlets/custom_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def fun(T, solute, param1):
"""

def __init__(self, surfaces, function, field=0, **prms) -> None:

super().__init__(surfaces, field=field, value=None)
self.function = function
self.prms = prms
Expand Down
1 change: 0 additions & 1 deletion festim/boundary_conditions/dirichlets/dirichlet_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class BoundaryConditionExpression(f.UserExpression):
"""

def __init__(self, T, eval_function, **kwargs):

super().__init__()

self._T = T
Expand Down
1 change: 0 additions & 1 deletion festim/concentration/traps/extrinsic_trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def __init__(
id=None,
**kwargs,
):

super().__init__(
k_0,
E_k,
Expand Down
1 change: 0 additions & 1 deletion festim/concentration/traps/trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Trap(Concentration):
"""

def __init__(self, k_0, E_k, p_0, E_p, materials, density, id=None):

super().__init__()
self.id = id
self.k_0 = k_0
Expand Down
3 changes: 0 additions & 3 deletions festim/exports/derived_quantities/derived_quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def __init__(
nb_iterations_between_compute: int = 1,
nb_iterations_between_exports: int = None,
) -> None:

self.filename = filename
self.nb_iterations_between_compute = nb_iterations_between_compute
self.nb_iterations_between_exports = nb_iterations_between_exports
Expand Down Expand Up @@ -82,7 +81,6 @@ def assign_properties_to_quantities(self, materials):
quantity.H = materials.H

def compute(self, t):

# TODO need to support for soret flag in surface flux
row = [t]
for quantity in self.derived_quantities:
Expand Down Expand Up @@ -182,7 +180,6 @@ def filter(

# iterate through derived_quantities
for quantity in self.derived_quantities:

# initialise flags to False
match_surface, match_volume, match_field, match_instance = (
False,
Expand Down
1 change: 0 additions & 1 deletion festim/exports/derived_quantities/derived_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class DerivedQuantity(Export):
"""

def __init__(self, field) -> None:

super().__init__(field=field)
self.dx = None
self.ds = None
Expand Down
1 change: 0 additions & 1 deletion festim/exports/derived_quantities/maximum_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class MaximumSurface(DerivedQuantity):
"""

def __init__(self, field, surface) -> None:

super().__init__(field)
self.surface = surface
self.title = "Maximum {} surface {}".format(self.field, self.surface)
Expand Down
1 change: 0 additions & 1 deletion festim/exports/derived_quantities/minimum_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class MinimumSurface(DerivedQuantity):
"""

def __init__(self, field, surface) -> None:

super().__init__(field)
self.surface = surface
self.title = "Minimum {} surface {}".format(self.field, self.surface)
Expand Down
1 change: 0 additions & 1 deletion festim/exports/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def __init__(self, exports=[]) -> None:
def write(self, label_to_function, dt):
for export in self.exports:
if isinstance(export, festim.DerivedQuantities):

# compute derived quantities
if export.is_compute(self.nb_iterations):
# check if function has to be projected
Expand Down
1 change: 0 additions & 1 deletion festim/exports/trap_density_xdmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class TrapDensityXDMF(XDMFExport):
"""

def __init__(self, trap, **kwargs) -> None:

super().__init__(
field="1", **kwargs
) # field is "1" just to make the code not crash
Expand Down
2 changes: 0 additions & 2 deletions festim/exports/txt_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class TXTExport(festim.Export):
"""

def __init__(self, field, times, label, folder) -> None:

super().__init__(field=field)
self.times = sorted(times)
self.label = label
Expand All @@ -40,7 +39,6 @@ def when_is_next_time(self, current_time):
return None

def write(self, current_time, dt):

# create a DG1 functionspace
V_DG1 = f.FunctionSpace(self.function.function_space().mesh(), "DG", 1)

Expand Down
2 changes: 0 additions & 2 deletions festim/exports/xdmf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class XDMFExport(Export):
def __init__(
self, field, label=None, filename=None, mode=1, checkpoint=True, folder=None
) -> None:

super().__init__(field=field)
self.label = label
self.folder = folder
Expand Down Expand Up @@ -123,7 +122,6 @@ def write(self, t):
self.function.rename(self.label, "label")

if self.checkpoint:

# warn users if checkpoint is True and 1D
dimension = self.function.function_space().mesh().topology().dim()
if dimension == 1:
Expand Down
1 change: 0 additions & 1 deletion festim/generic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def __init__(
exports=None,
log_level=40,
):

self.log_level = log_level

self.settings = settings
Expand Down
1 change: 0 additions & 1 deletion festim/initial_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class InitialCondition:
def __init__(
self, field=0, value=0.0, component=None, label=None, time_step=None
) -> None:

# TODO make an inherited class InitialConditionXDMF
self.field = field
self.value = value
Expand Down
1 change: 0 additions & 1 deletion festim/materials/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def __init__(
solubility_law="sievert",
name=None,
) -> None:

self.id = id
self.name = name
self.D_0 = D_0
Expand Down
1 change: 0 additions & 1 deletion festim/materials/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Materials:
"""

def __init__(self, materials=[]):

self.materials = materials
self.D = None
self.S = None
Expand Down
1 change: 0 additions & 1 deletion festim/meshing/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Mesh:
def __init__(
self, mesh=None, volume_markers=None, surface_markers=None, type="cartesian"
) -> None:

self.mesh = mesh
self.volume_markers = volume_markers
self.surface_markers = surface_markers
Expand Down
1 change: 0 additions & 1 deletion festim/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def __init__(
update_jacobian=True,
linear_solver=None,
):

# TODO maybe transient and final_time are redundant
self.transient = transient
self.final_time = final_time
Expand Down
1 change: 0 additions & 1 deletion festim/stepsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def __init__(
stepsize_stop_max=None,
dt_min=None,
) -> None:

self.adaptive_stepsize = None
if stepsize_change_ratio is not None:
self.adaptive_stepsize = {
Expand Down
1 change: 0 additions & 1 deletion test/simulation/test_postprocessing_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def test_pure_diffusion(self, my_sim):
assert data[i][4] == pytest.approx(11)

def test_fluxes(self, my_sim):

my_sim.T = festim.Temperature(100 * festim.x + 200)
my_sim.T.create_functions(my_sim.mesh)

Expand Down
1 change: 0 additions & 1 deletion test/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ def test_run_MMS_steady_state(tmpdir):
g = sp.diff(v, festim.t) + p * v - k * u * (n_trap - v)

def run(h):

my_materials = festim.Materials(
[festim.Material(name="mat", id=1, D_0=D_0, E_D=E_D)]
)
Expand Down
3 changes: 2 additions & 1 deletion test/unit/test_boundary_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ def test_create_expression_dc_custom():
"""Creates a dc_custom bc and checks create_expression returns
the correct expression
"""

# build
def func(T, prm1, prm2):
return 2 * T + prm1 * prm2
Expand Down Expand Up @@ -455,6 +456,7 @@ def test_create_form_flux_custom():
create_form returns
the correct form
"""

# build
def func(T, c, prm1, prm2):
return 2 * T + c + prm1 * prm2
Expand All @@ -481,7 +483,6 @@ def func(T, c, prm1, prm2):
expected_expr = 2 * expr_T + expr_c + expr_prm1 * expr_prm2
expected_expr = fenics.Expression(sp.printing.ccode(expected_expr), t=0, degree=1)
for t in range(10):

expected_expr.t = t
for expr in my_BC.sub_expressions + expressions:
expr.t = t
Expand Down
1 change: 0 additions & 1 deletion test/unit/test_concentration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def test_get_comp_from_expression(self):
assert comp(x) == 1 + t - x

def test_get_comp_from_xdmf(self, tmpdir):

# build
value = 1 + festim.t - festim.x

Expand Down
1 change: 0 additions & 1 deletion test/unit/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def eval(self, x, values):


def test_as_constant_or_expression():

# constants
assert isinstance(as_constant_or_expression(3), Constant)
assert isinstance(as_constant_or_expression(3.0), Constant)
Expand Down
2 changes: 0 additions & 2 deletions test/unit/test_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def test_surface_markers(self):


def test_create_mesh_xdmf(tmpdir):

# write xdmf file
mesh = fenics.UnitSquareMesh(10, 10)
file1 = tmpdir.join("mesh.xdmf")
Expand Down Expand Up @@ -202,7 +201,6 @@ def test_create_mesh_xdmf(tmpdir):


def test_subdomains_from_xdmf(tmpdir):

# create mesh functions
mesh = fenics.UnitCubeMesh(6, 6, 6)
mf_cells = fenics.MeshFunction("size_t", mesh, mesh.topology().dim())
Expand Down
1 change: 0 additions & 1 deletion test/unit/test_traps/test_extrinsic_trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class TestExtrinsicTrap:

my_trap = festim.ExtrinsicTrap(
1,
1,
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_traps/test_trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def test_user_expression_as_density(self):
"""Test that create_trapping_form creates the correct formulation when
a fenics.UserExpression is given as density
"""

# build
class CustomExpression(f.UserExpression):
def eval(self, value, x):
Expand Down

0 comments on commit aa7d822

Please sign in to comment.