Skip to content

Commit dbc5a9b

Browse files
committed
dolfinx v0.8.0
2 parents 072f763 + 3d9e425 commit dbc5a9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+640
-405
lines changed

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Pierric Mora
2+
MassinaFengal
3+
mlehujeur

Dockerfile.lab

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM dolfinx/lab:v0.7.3
1+
FROM dolfinx/lab:v0.8.0
22
LABEL maintainer="Pierric Mora <pierric.mora@univ-eiffel.fr>"
33
LABEL description=" elastodynamics with FEniCSx/DOLFINx "
44

@@ -19,14 +19,15 @@ RUN pip3 install . &&\
1919
ARG PYTHON_VERSION=3.10
2020

2121
# Clone DOLFINX_MPC source dir
22-
RUN git clone --branch v0.7.0.post1 https://github.com/jorgensd/dolfinx_mpc.git
22+
RUN git clone --branch v0.8.1 https://github.com/jorgensd/dolfinx_mpc.git
2323

2424
# Install real mode
2525
RUN . /usr/local/bin/dolfinx-real-mode && \
2626
. /usr/local/dolfinx-real/lib/dolfinx/dolfinx.conf && \
2727
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-real -DCMAKE_BUILD_TYPE=Developer -B build-dir-real dolfinx_mpc/cpp/ && \
2828
ninja install -j4 -C build-dir-real && \
29-
python3 -m pip install -v --target /usr/local/dolfinx-real/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir dolfinx_mpc/python
29+
python3 -m pip install -v --break-system-packages --no-build-isolation --check-build-dependencies \
30+
--target /usr/local/dolfinx-real/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir ./dolfinx_mpc/python
3031

3132
# Clean repo to remove build dir from pip
3233
RUN rm -rf dolfinx_mpc/python/build
@@ -36,7 +37,8 @@ RUN . /usr/local/bin/dolfinx-complex-mode && \
3637
. /usr/local/dolfinx-complex/lib/dolfinx/dolfinx.conf && \
3738
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-complex -DCMAKE_BUILD_TYPE=Developer -B build-dir-complex dolfinx_mpc/cpp/ && \
3839
ninja install -j4 -C build-dir-complex && \
39-
python3 -m pip install -v --target /usr/local/dolfinx-complex/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir dolfinx_mpc/python
40+
python3 -m pip install --break-system-packages -v --no-build-isolation --check-build-dependencies \
41+
--target /usr/local/dolfinx-complex/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir ./dolfinx_mpc/python
4042

4143

4244
WORKDIR /root

Dockerfile.shell

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM dolfinx/dolfinx:v0.7.3
1+
FROM dolfinx/dolfinx:v0.8.0
22
LABEL maintainer="Pierric Mora <pierric.mora@univ-eiffel.fr>"
33
LABEL description=" elastodynamics with FEniCSx/DOLFINx "
44

@@ -26,14 +26,15 @@ RUN apt-get update && \
2626
ARG PYTHON_VERSION=3.10
2727

2828
# Clone DOLFINX_MPC source dir
29-
RUN git clone --branch v0.7.0.post1 https://github.com/jorgensd/dolfinx_mpc.git
29+
RUN git clone --branch v0.8.1 https://github.com/jorgensd/dolfinx_mpc.git
3030

3131
# Install real mode
3232
RUN . /usr/local/bin/dolfinx-real-mode && \
3333
. /usr/local/dolfinx-real/lib/dolfinx/dolfinx.conf && \
3434
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-real -DCMAKE_BUILD_TYPE=Developer -B build-dir-real dolfinx_mpc/cpp/ && \
3535
ninja install -j4 -C build-dir-real && \
36-
python3 -m pip install -v --target /usr/local/dolfinx-real/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir dolfinx_mpc/python
36+
python3 -m pip install -v --break-system-packages --no-build-isolation --check-build-dependencies \
37+
--target /usr/local/dolfinx-real/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir ./dolfinx_mpc/python
3738

3839
# Clean repo to remove build dir from pip
3940
RUN rm -rf dolfinx_mpc/python/build
@@ -43,7 +44,8 @@ RUN . /usr/local/bin/dolfinx-complex-mode && \
4344
. /usr/local/dolfinx-complex/lib/dolfinx/dolfinx.conf && \
4445
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-complex -DCMAKE_BUILD_TYPE=Developer -B build-dir-complex dolfinx_mpc/cpp/ && \
4546
ninja install -j4 -C build-dir-complex && \
46-
python3 -m pip install -v --target /usr/local/dolfinx-complex/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir dolfinx_mpc/python
47+
python3 -m pip install --break-system-packages -v --no-build-isolation --check-build-dependencies \
48+
--target /usr/local/dolfinx-complex/lib/python${PYTHON_VERSION}/dist-packages --no-dependencies --no-cache-dir ./dolfinx_mpc/python
4749

4850

4951
WORKDIR /root

demo/eigs_3D_AluminumCube.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
extent = [[0., 0., 0.], [L1, L2, L3]]
3737
domain = mesh.create_box(MPI.COMM_WORLD, extent, [Nx, Ny, Nz])
3838

39-
V = fem.FunctionSpace(domain, ("Lagrange", 2, (domain.geometry.dim,)))
39+
V = fem.functionspace(domain, ("Lagrange", 2, (domain.geometry.dim,)))
4040
# -
4141

4242
# ### Define the material law

demo/eigs_3D_ElasticBeam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
domain = mesh.create_box(MPI.COMM_WORLD, extent, [Nx, Ny, Nz])
5353

5454
# create the function space
55-
V = fem.FunctionSpace(domain, ("Lagrange", 2, (domain.geometry.dim,)))
55+
V = fem.functionspace(domain, ("Lagrange", 2, (domain.geometry.dim,)))
5656

5757
# define some tags
5858
tag_left, tag_top, tag_right, tag_bottom, tag_back, tag_front = 1, 2, 3, 4, 5, 6

demo/freq_2D-PSV_FullSpace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
domain = mesh.create_rectangle(MPI.COMM_WORLD, extent, [Nx, Ny], mesh.CellType.triangle)
5151

5252
# create the function space
53-
V = fem.FunctionSpace(domain, ("Lagrange", degElement, (domain.geometry.dim,)))
53+
V = fem.functionspace(domain, ("Lagrange", degElement, (domain.geometry.dim,)))
5454

5555
tag_left, tag_top, tag_right, tag_bottom = 1, 2, 3, 4
5656
all_tags = (tag_left, tag_top, tag_right, tag_bottom)
@@ -131,7 +131,7 @@
131131
u_res = fem.Function(V, name='solution')
132132

133133
# Solve
134-
fdsolver.solve(omega=omega, out=u_res.vector)
134+
fdsolver.solve(omega=omega, out=u_res.x.petsc_vec)
135135

136136
# Plot
137137
if domain.comm.rank == 0:
@@ -190,7 +190,7 @@ def cbck_storeAtPoints(i, out):
190190
p = None
191191

192192
# Solve
193-
fdsolver.solve(omega=omegas, out=u_res.vector, callbacks=[cbck_storeAtPoints], live_plotter=p)
193+
fdsolver.solve(omega=omegas, out=u_res.x.petsc_vec, callbacks=[cbck_storeAtPoints], live_plotter=p)
194194
# -
195195

196196
# ### Post-processing

demo/freq_2D-SH_FullSpace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
domain = mesh.create_rectangle(MPI.COMM_WORLD, extent, [Nx, Ny], mesh.CellType.triangle)
5353

5454
# create the function space
55-
V = fem.FunctionSpace(domain, ("Lagrange", degElement))
55+
V = fem.functionspace(domain, ("Lagrange", degElement))
5656

5757
tag_left, tag_top, tag_right, tag_bottom = 1, 2, 3, 4
5858
all_tags = (tag_left, tag_top, tag_right, tag_bottom)
@@ -136,7 +136,7 @@
136136
u_res = fem.Function(V, name='solution')
137137

138138
# Solve
139-
fdsolver.solve(omega=omega, out=u_res.vector)
139+
fdsolver.solve(omega=omega, out=u_res.x.petsc_vec)
140140

141141
# Plot
142142
if domain.comm.rank == 0:
@@ -193,7 +193,7 @@ def cbck_storeAtPoints(i, out):
193193
p = None
194194

195195
# Solve
196-
fdsolver.solve(omega=omegas, out=u_res.vector, callbacks=[cbck_storeAtPoints], live_plotter=p)
196+
fdsolver.solve(omega=omegas, out=u_res.x.petsc_vec, callbacks=[cbck_storeAtPoints], live_plotter=p)
197197
# -
198198

199199
# ### Post-processing

demo/tdsdyn_3D_ElasticBeam.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
domain = mesh.create_box(MPI.COMM_WORLD, extent, [Nx, Ny, Nz])
4747

4848
# create the function space
49-
V = fem.FunctionSpace(domain, ("Lagrange", 1, (domain.geometry.dim,)))
49+
V = fem.functionspace(domain, ("Lagrange", 1, (domain.geometry.dim,)))
5050

5151
# define some tags
5252
tag_left, tag_top, tag_right, tag_bottom, tag_back, tag_front = 1, 2, 3, 4, 5, 6
@@ -152,7 +152,9 @@
152152
kwargsTScheme = dict(scheme='g-a-newmark', alpha_m=alpha_m, alpha_f=alpha_f)
153153

154154
# Time integration: define a TimeStepper instance
155-
tStepper = TimeStepper.build(V, pde.m, pde.c, pde.k, pde.L, dt, bcs=bcs, **kwargsTScheme)
155+
tStepper = TimeStepper.build(V,
156+
pde.M_fn, pde.C_fn, pde.K_fn, pde.b_fn, dt, bcs=bcs,
157+
**kwargsTScheme)
156158

157159
# Set the initial values
158160
tStepper.set_initial_condition(u0=[0, 0, 0], v0=[0, 0, 0], t0=0)
@@ -184,9 +186,19 @@
184186
u_n = tStepper.timescheme.u # The displacement at time t_n
185187
v_n = tStepper.timescheme.v # The velocity at time t_n
186188
comm = V.mesh.comm
187-
Energy_elastic = lambda *a: comm.allreduce(fem.assemble_scalar(fem.form(1/2 * pde.k(u_n, u_n))), op=MPI.SUM)
188-
Energy_kinetic = lambda *a: comm.allreduce(fem.assemble_scalar(fem.form(1/2 * pde.m(v_n, v_n))), op=MPI.SUM)
189-
Energy_damping = lambda *a: dt * comm.allreduce(fem.assemble_scalar(fem.form(pde.c(v_n, v_n))), op=MPI.SUM)
189+
190+
191+
def Energy_elastic():
192+
return comm.allreduce(fem.assemble_scalar(fem.form(1/2 * pde.K_fn(u_n, u_n))), op=MPI.SUM)
193+
194+
195+
def Energy_kinetic():
196+
return comm.allreduce(fem.assemble_scalar(fem.form(1/2 * pde.M_fn(v_n, v_n))), op=MPI.SUM)
197+
198+
199+
def Energy_damping():
200+
return dt * comm.allreduce(fem.assemble_scalar(fem.form(pde.C_fn(v_n, v_n))), op=MPI.SUM)
201+
190202

191203
# -> live plotting parameters
192204
clim = 0.4 * L_ * B_ * H_ / (E * B_ * H_**3 / 12) * np.amax(F_0) * np.array([0, 1])

demo/weq_2D-PSV_FullSpace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
domain = mesh.create_rectangle(MPI.COMM_WORLD, extent, [Nx, Ny], cell_type)
6060

6161
# create the function space
62-
V = fem.FunctionSpace(domain, specFE)
62+
V = fem.functionspace(domain, specFE)
6363

6464
# define some tags
6565
tag_left, tag_top, tag_right, tag_bottom = 1, 2, 3, 4
@@ -165,7 +165,7 @@ def F_body_function(t): # source(x) at a given time
165165
# Time integration
166166
# diagonal=True assumes the left hand side operator is indeed diagonal
167167
tStepper = TimeStepper.build(V,
168-
pde.m, pde.c, pde.k, pde.L, dt, bcs=bcs,
168+
pde.M_fn, pde.C_fn, pde.K_fn, pde.b_fn, dt, bcs=bcs,
169169
scheme='leapfrog', diagonal=True)
170170

171171
# Set the initial values

demo/weq_2D-PSV_HalfSpace_Lamb_KomatitschVilotte_BSSA1998.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
domain, cell_tags, facet_tags = gmshio.model_to_mesh(model, comm, gmsh_model_rank, gdim=2)
6767

6868
# Create the function space
69-
V = fem.FunctionSpace(domain, specFE)
69+
V = fem.functionspace(domain, specFE)
7070

7171

7272
def y_surf(x):
@@ -174,7 +174,7 @@ def T_N_function(t):
174174
# Time integration
175175
# diagonal=True assumes the left hand side operator is indeed diagonal
176176
tStepper = TimeStepper.build(V,
177-
pde.m, pde.c, pde.k, pde.L, dt, bcs=bcs,
177+
pde.M_fn, pde.C_fn, pde.K_fn, pde.b_fn, dt, bcs=bcs,
178178
scheme='leapfrog', diagonal=True)
179179

180180
# Set the initial values

0 commit comments

Comments
 (0)