Skip to content

Commit b88dfc8

Browse files
authored
Merge pull request #12 from METHODS-Group/typo
n -> n_g and minor QOL for julia
2 parents 8727bc7 + 8461fe9 commit b88dfc8

File tree

5 files changed

+37
-29
lines changed

5 files changed

+37
-29
lines changed

.github/workflows/build-docker-image.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ on:
33
push:
44
tags:
55
- "v*"
6-
pull_request:
7-
branches:
8-
- release
9-
- main
6+
# pull_request:
7+
# branches:
8+
# - release
9+
# - main
1010
workflow_dispatch:
1111

1212
env:
@@ -17,10 +17,10 @@ jobs:
1717
build-image:
1818
strategy:
1919
matrix:
20-
backend: ["firedrake", "dolfinx", "mfem"]
20+
backend: ["firedrake", "dolfinx", "mfem", "julia"]
2121
platform: [
2222
{ runner: "ubuntu-24.04", platform: amd64 },
23-
#{ runner: "ubuntu-24.04-arm", platform: arm64 }, # NOTE: Skip arm until repo is public
23+
{ runner: "ubuntu-24.04-arm", platform: arm64 }
2424
]
2525
runs-on: ${{ matrix.platform.runner }}
2626
permissions:
@@ -79,7 +79,7 @@ jobs:
7979
retention-days: 1
8080

8181
merge-and-publish:
82-
#if: github.event_name == 'push'
82+
if: github.event_name == 'push'
8383
strategy:
8484
matrix:
8585
backend: ["firedrake", "dolfinx", "mfem"]

.github/workflows/test_julia.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: Run Julia scripts
22

33
on:
4-
# push:
5-
# # The CI is executed on every push on to main
6-
# branches:
7-
# - main
8-
# pull_request:
9-
# # The CI is executed on every pull request to the main branch
10-
# branches:
11-
# - main
4+
push:
5+
# The CI is executed on every push on to main
6+
branches:
7+
- main
8+
pull_request:
9+
# The CI is executed on every pull request to the main branch
10+
branches:
11+
- main
1212

13-
# schedule:
14-
# # The CI is executed every day at 8am
15-
# - cron: "0 8 * * *"
16-
workflow_dispatch:
13+
schedule:
14+
# The CI is executed every day at 8am
15+
- cron: "0 8 * * *"
16+
workflow_dispatch:
1717
# The CI is executed manually
1818
jobs:
1919
run-script:
@@ -34,4 +34,4 @@ jobs:
3434

3535
- name: Run thermoform
3636
working-directory: ./examples/thermoforming_qvi
37-
run: julia thermoform.jl
37+
run: julia thermoforming_lvpp.jl

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ Then call
7474

7575
```bash
7676
python3 generate_mesh.py
77+
python3 run_lvpp_problem.py --disp=-0.1 --alpha_0=0.005 --output=small_disp file --filename=meshes/half_sphere.xdmf
78+
python3 run_lvpp_problem.py --disp=-0.15 --alpha_0=0.005 --output=med_disp file --filename=meshes/half_sphere.xdmf
79+
python3 run_lvpp_problem.py --disp=-0.2 --alpha_0=0.005 --output=large_disp file --filename=meshes/half_sphere.xdmf
7780
```
78-
7981
from within `examples/signorini` to generate the mesh file `"meshes/half_sphere.xdmf"`.
8082
Next, run the proximal Galerkin method with
8183

docker/Dockerfile.julia

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM julia:1.10.8
2+
3+
RUN julia -e 'using Pkg; Pkg.add(["ClassicalOrthogonalPolynomials", "MultivariateOrthogonalPolynomials", "Plots", "LaTeXStrings", "IterativeSolvers", "LinearMaps", "MatrixFactorizations", "Gridap", "LineSearches"])'
4+
5+
WORKDIR /root/examples
6+
ADD . .
7+
8+
ENTRYPOINT [ "/bin/bash" ]

examples/signorini/run_lvpp_problem.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ class CustomParser(
5959
physical_parameters.add_argument("--E", dest="E", type=float, default=2.0e4, help="Young's modulus")
6060
physical_parameters.add_argument("--nu", dest="nu", type=float, default=0.3, help="Poisson's ratio")
6161
physical_parameters.add_argument(
62-
"--disp", type=float, default=-0.2, help="Displacement in the y/z direction (2D/3D)"
62+
"--disp", type=float, default=-0.25, help="Displacement in the y/z direction (2D/3D)"
6363
)
6464
physical_parameters.add_argument(
65-
"--gap", type=float, default=-0.05, help="y/z coordinate of rigid surface (2D/3D)"
65+
"--gap", type=float, default=-0.00, help="y/z coordinate of rigid surface (2D/3D)"
6666
)
6767
fem_parameters = parser.add_argument_group("FEM parameters")
6868
fem_parameters.add_argument(
6969
"--degree",
7070
dest="degree",
7171
type=int,
72-
default=1,
72+
default=2,
7373
help="Degree of primal and latent space",
7474
)
7575
fem_parameters.add_argument(
@@ -81,7 +81,7 @@ class CustomParser(
8181
"--n-max-iterations",
8282
dest="newton_max_iterations",
8383
type=int,
84-
default=25,
84+
default=250,
8585
help="Maximum number of iterations of Newton iteration",
8686
)
8787
newton_parameters.add_argument(
@@ -113,7 +113,7 @@ class CustomParser(
113113
alpha_options.add_argument(
114114
"--alpha_scheme",
115115
type=str,
116-
default="constant",
116+
default="doubling",
117117
choices=typing.get_args(AlphaScheme),
118118
help="Scheme for updating alpha",
119119
)
@@ -240,7 +240,6 @@ def solve_contact_problem(
240240
# Define problem specific parameters
241241
mu = E / (2.0 * (1.0 + nu))
242242
lmbda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu))
243-
n = ufl.FacetNormal(mesh)
244243
n_g = dolfinx.fem.Constant(mesh, np.zeros(gdim, dtype=dst))
245244
n_g.value[-1] = -1
246245
alpha = dolfinx.fem.Constant(mesh, dst(alpha_0))
@@ -252,7 +251,7 @@ def solve_contact_problem(
252251
residual = alpha * ufl.inner(sigma(u, mu, lmbda), epsilon(v)) * ufl.dx(
253252
domain=mesh
254253
) - alpha * ufl.inner(f, v) * ufl.dx(domain=mesh)
255-
residual += -ufl.inner(psi - psi_k, ufl.dot(v, n)) * ds
254+
residual += -ufl.inner(psi - psi_k, ufl.dot(v, n_g)) * ds
256255
residual += ufl.inner(ufl.dot(u, n_g), w) * ds
257256
residual += ufl.inner(ufl.exp(psi), w) * ds - ufl.inner(g, w) * ds
258257

@@ -371,7 +370,6 @@ def assemble_penetration():
371370
return it, iterations
372371

373372

374-
# python3 script.py --alpha_0=0.1 --degree=2 file --filename=sphere.xdmf
375373
if __name__ == "__main__":
376374
args = parser.parse_args()
377375
if args.mesh == "native":

0 commit comments

Comments
 (0)