Skip to content

Commit

Permalink
try to add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lamBOOO committed Oct 14, 2024
1 parent 8eec932 commit bd0a0e8
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Doc

on:
push:
branches:
- master
pull_request:

jobs:
docs:
name: Doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: Test

on:
push:
Expand Down
48 changes: 47 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

julia_version = "1.10.2"
manifest_format = "2.0"
project_hash = "de4af1fb3390e68a97ccc9215147284c1486a39a"
project_hash = "851282b9d4540d4f1d1d921b1dd41c97e2e71062"

[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
version = "0.0.1"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -363,6 +368,12 @@ git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.9.3"

[[deps.Documenter]]
deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"]
git-tree-sha1 = "5a1ee886566f2fa9318df1273d8b778b9d42712d"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "1.7.0"

[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand Down Expand Up @@ -572,6 +583,18 @@ git-tree-sha1 = "43ba3d3c82c18d88471cfd2924931658838c9d8f"
uuid = "61579ee1-b43e-5ca0-a5da-69d92c66a64b"
version = "9.55.0+4"

[[deps.Git]]
deps = ["Git_jll"]
git-tree-sha1 = "04eff47b1354d702c3a85e8ab23d539bb7d5957e"
uuid = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2"
version = "1.3.1"

[[deps.Git_jll]]
deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"]
git-tree-sha1 = "ea372033d09e4552a04fd38361cd019f9003f4f4"
uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb"
version = "2.46.2+0"

[[deps.Glib_jll]]
deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"]
git-tree-sha1 = "7c82e6a6cd34e9d935e9aa4051b66c6ff3af59ba"
Expand Down Expand Up @@ -631,6 +654,12 @@ git-tree-sha1 = "20b6765a3016e1fca0c9c93c80d50061b94218b7"
uuid = "a51ab1cf-af8e-5615-a023-bc2c838bba6b"
version = "69.1.0+0"

[[deps.IOCapture]]
deps = ["Logging", "Random"]
git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.2.5"

[[deps.ImageAxes]]
deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"]
git-tree-sha1 = "2e4520d67b0cef90865b3ef727594d2a58e0e1f8"
Expand Down Expand Up @@ -830,6 +859,11 @@ git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.1"

[[deps.LazilyInitializedFields]]
git-tree-sha1 = "8f7f3cabab0fd1800699663533b6d5cb3fc0e612"
uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf"
version = "1.2.2"

[[deps.LazyArtifacts]]
deps = ["Artifacts", "Pkg"]
uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
Expand Down Expand Up @@ -1000,6 +1034,12 @@ version = "0.4.2"
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[deps.MarkdownAST]]
deps = ["AbstractTrees", "Markdown"]
git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899"
uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
version = "0.1.2"

[[deps.MathTeXEngine]]
deps = ["AbstractTrees", "Automa", "DataStructures", "FreeTypeAbstraction", "GeometryBasics", "LaTeXStrings", "REPL", "RelocatableFolders", "UnicodeFun"]
git-tree-sha1 = "96ca8a313eb6437db5ffe946c457a401bbb8ce1d"
Expand Down Expand Up @@ -1406,6 +1446,12 @@ git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"

[[deps.RegistryInstances]]
deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"]
git-tree-sha1 = "ffd19052caf598b8653b99404058fce14828be51"
uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3"
version = "0.1.0"

[[deps.RelocatableFolders]]
deps = ["SHA", "Scratch"]
git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864"
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.1.0"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
<img src="https://github.com/lamBOOO/GenMatFlow.jl/actions/workflows/test.yml/badge.svg" alt="Testing workflow badge"/>
</div>

# GenMatFlow.jl
# GenMatFlow.jl: A Navier-Stokes-Fourier Solver for generalized material laws

- Navier-Stokes-Fourier Solver for generalized material laws, including:
- Different material laws, including:
- Newtonian fluids: $\boldsymbol{\sigma} = \boldsymbol{D}(\boldsymbol{u}) = \frac12 (\boldsymbol{\nabla} \boldsymbol{u} + \boldsymbol{\nabla} \boldsymbol{u}^T)$
- Non-Newtonian fluids with power-law: $\boldsymbol{\sigma} = K {\left(2 \boldsymbol{D} \boldsymbol{\colon} \boldsymbol{D} \right)}^{\frac{1-n}{2}} \boldsymbol{D}(\boldsymbol{u})$
- Discretization using Finite Elements in [Gridap.jl](https://github.com/gridap/Gridap.jl)
- Solve nonlinear systems using Newtons method


## Installation

Expand All @@ -28,5 +30,6 @@ julia --project -e 'import Pkg; Pkg.instantiate()'

- Run examples by navigating to the folder and execute the examples from the shell:
```bash
cd TODO
cd examples/validation-basak
include("basak.jl")
```
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/**
19 changes: 19 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
push!(LOAD_PATH,"../src/")
push!(LOAD_PATH,"src/")

using GenMatFlow
using Documenter

makedocs(
sitename="GenMatFlow.jl",
remotes = nothing,
pages = Any[
"Home" => "index.md",
"API" => "api.md",
]
)

# optionally deploy docs to github pages
deploydocs(
repo = "github.com/lamBOOO/GenMatFlow.jl.git",
)
14 changes: 14 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Developer Documentation

## API

```@autodocs
Modules = [GenMatFlow]
Private = true
Order = [:function, :type]
```

## Index

```@index
```
Empty file added docs/src/assets/.gitkeep
Empty file.
26 changes: 26 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```@eval
using Markdown
# Read the README.md file as a string
readme = read("../../README.md", String)
# Find the position of the first '#' character (first headline)
pos = findfirst(r"#", readme)[1]
# Check if a '#' was found
if isnothing(pos)
error("No '#' found in README.md")
end
print(readme)
print(pos)
# Extract the content from the first headline onward
readme_content = readme[pos:end]
# Parse the extracted content as Markdown and include it
Markdown.parse(readme_content)
```

## API

- See [API reference](./api.md)
38 changes: 38 additions & 0 deletions src/Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,44 @@ using LineSearches: BackTracking, StrongWolfe
using Random
Random.seed!(1234)

export simulate

"""
simulate(;name="sim",Pr=1.0,Ra=1.0,n=1.0,n_elems=20,nlsolver_opts=(;show_trace=true,method=:newton,linesearch=BackTracking(),ftol=1E-8,xtol=1E-10),levels=(;T=5,psi=5,Sth=5,Sfl=5),T_diri_tags=["leftline","rightline","botleftpoint","botrightpoint","topleftpoint","toprightpoint"],T_diri_expressions=[0.0,1.0,0.0,1.0,0.0,1.0])
Simulate the flow in a square cavity with a moving lid and a temperature gradient.
# Arguments
- `name::String`: Name of the simulation.
- `Pr::Float64`: Prandtl number.
- `Ra::Float64`: Rayleigh number.
- `n::Float64`: Power of the viscosity.
- `n_elems::Int`: Number of elements in each direction.
- `nlsolver_opts::Dict`: Options for the nonlinear solver.
- `levels::Dict`: Levels for the contour plots.
- `T_diri_tags::Array{String}`: Tags for the Dirichlet boundary conditions for the temperature.
- `T_diri_expressions::Array{Float64}`: Expressions for the Dirichlet boundary conditions for the temperature.
# Returns
- `uh::FEFunction`: Velocity field.
- `ph::FEFunction`: Pressure field.
- `Th::FEFunction`: Temperature field.
- `psih::FEFunction`: Stream function.
- `Nu::Interpolable`: Nusselt number.
- `Sth::FEFunction`: Local heat entropy.
- `Sfl::FEFunction`: Local fluid entropy.
- `btrian::BoundaryTriangulation`: Boundary triangulation.
- `model::CartesianDiscreteModel`: Model.
- `Ωₕ::Triangulation`: Triangulation.
- `Pr::Float64`: Prandtl number.
- `Ra::Float64`: Rayleigh number.
# Example
```julia
simulate(;name="sim",Pr=1.0,Ra=1.0,n=1.0,n_elems=20,nlsolver_opts=(;show_trace=true,method=:newton,linesearch=BackTracking(),ftol=1E-8,xtol=1E-10),levels=(;T=5,psi=5,Sth=5,Sfl=5),T_diri_tags=["leftline","rightline","botleftpoint","botrightpoint","topleftpoint","toprightpoint"],T_diri_expressions=[0.0,1.0,0.0,1.0,0.0,1.0])
```
"""
function simulate(;
name="sim",
Pr=1.0,
Expand Down

0 comments on commit bd0a0e8

Please sign in to comment.