Reinit class¶
The Reinit class solve the Eikonal equation
where \(\phi\) is the current level set function, \(h\) is the mesh diameter, and
This class implements the Petrov Galerkin and two-step Adams-Bashforth methods to solve the diffusive Eikonal equation with fictitious time derivative.
Attributes:
| Name | Type | Description |
|---|---|---|
dt |
Constant
|
Time step. |
phi_ini |
Function
|
Store the initial level set function to be reinitialized. |
phi_prev |
Function
|
Store the previous iteration. |
w |
Function
|
Auxiliary function. |
uh |
Function
|
Solution function. |
problem0 |
LinearProblem
|
Solver used in the first iteration. |
problem |
LinearProblem
|
Solver used in subsequent iterations. |
Methods:
| Name | Description |
|---|---|
run |
Run the iterative method over a fixed number of time steps. |
Source code in code/formopt.py
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 | |
__init__(domain, space, phi, diam2)
¶
Set up the reinitialization method. Since the bilinear parts change across iterations (due to the Petrov-Galerkin test function), two solvers are created, which compile the equations at each call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
Mesh
|
Problem domain. |
required |
space
|
FunctionSpace
|
Space of functions. |
required |
phi
|
Function
|
Level set function. |
required |
diam2
|
float
|
Square of the mesh diameter. |
required |
Source code in code/formopt.py
1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 | |
run(phi, steps, tend)
¶
Run the iterative method over a fixed number of time steps. The solver for the first iteration is called only once, and then the main solver is called at each time step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi
|
Function
|
Level set function. |
required |
steps
|
int
|
Number of time steps. |
required |
tend
|
float
|
Final time. |
required |
Source code in code/formopt.py
2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 | |