Skip to content

Commit

Permalink
build based on c0d2739
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Nov 24, 2023
1 parent 4a114bd commit 9c73e60
Show file tree
Hide file tree
Showing 36 changed files with 1,296 additions and 1,331 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-11-24T17:19:00","documenter_version":"1.1.2"}}
{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-11-24T18:25:02","documenter_version":"1.1.2"}}
34 changes: 17 additions & 17 deletions dev/api/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
t ∈ Interval(0.0, π/2)]

@named pde_system = PDESystem(eqs, bcs, domains, [x,t], [u(x,t),v(x,t)])</code></pre><p>The <code>@parameters</code> macro defines the parameters of the PDE system, and the <code>@variables</code> macro defines the dependent variables. We use <code>Differential</code> to define the derivatives with respect to time and space. The <code>eqs</code> array defines the equations in the PDE system. The bcs array defines the boundary conditions. The <code>domains</code> array defines the spatial and temporal domains of the PDE system. Finally, we use the <code>@named</code> macro to give a name to the PDE system.</p><h2 id="Step-3:-Define-the-neural-network-architecture"><a class="docs-heading-anchor" href="#Step-3:-Define-the-neural-network-architecture">Step 3: Define the neural network architecture</a><a id="Step-3:-Define-the-neural-network-architecture-1"></a><a class="docs-heading-anchor-permalink" href="#Step-3:-Define-the-neural-network-architecture" title="Permalink"></a></h2><p>Next, we define the physics-informed neural network (PINN) using Sophon.jl. In this example, we will use a Siren network with 2 sine layers and 1 cosine layer for each variable, and 16 hidden dimensions per layer. We will use 4 layers for both variables, and set the frequency parameter <span>$\omega$</span> to 1.0.</p><pre><code class="language-julia hljs">pinn = PINN(u = Siren(2,1; hidden_dims=16,num_layers=4, omega = 1.0),
v = Siren(2,1; hidden_dims=16,num_layers=4, omega = 1.0)) </code></pre><p>We define a physics-informed neural network (PINN) with the pinn variable. The PINN macro takes a dictionary that maps the dependent variables to their corresponding neural network architecture. In this case, we use the Siren architecture for both u and v with 2 input dimensions, 1 output dimension, 16 hidden dimensions, and 4 layers. We also set the frequency of the sine activation functions to 1.0.</p><h2 id="Step-4:-Create-a-QuasiRandomSampler-object"><a class="docs-heading-anchor" href="#Step-4:-Create-a-QuasiRandomSampler-object">Step 4: Create a QuasiRandomSampler object</a><a id="Step-4:-Create-a-QuasiRandomSampler-object-1"></a><a class="docs-heading-anchor-permalink" href="#Step-4:-Create-a-QuasiRandomSampler-object" title="Permalink"></a></h2><p>Here, we create a QuasiRandomSampler object with 500 sample points, where the first argument corresponds to the number of data points for each equation, and the second argument corresponds to the number of data points for each boundary condition.</p><pre><code class="language-julia hljs">sampler = QuasiRandomSampler(500, (200,200,20,20))</code></pre><h2 id="Step-5:-Define-a-training-strategy"><a class="docs-heading-anchor" href="#Step-5:-Define-a-training-strategy">Step 5: Define a training strategy</a><a id="Step-5:-Define-a-training-strategy-1"></a><a class="docs-heading-anchor-permalink" href="#Step-5:-Define-a-training-strategy" title="Permalink"></a></h2><p>Here, we use a NonAdaptiveTraining strategy with <code>1</code> as the weight of all equations, and <code>(10,10,1,1)</code> for the four boundary conditions.</p><pre><code class="language-julia hljs">strategy = NonAdaptiveTraining(1,(10,10,1,1))</code></pre><h2 id="Step-6:-Discretize-the-PDE-system-using-Sophon"><a class="docs-heading-anchor" href="#Step-6:-Discretize-the-PDE-system-using-Sophon">Step 6: Discretize the PDE system using Sophon</a><a id="Step-6:-Discretize-the-PDE-system-using-Sophon-1"></a><a class="docs-heading-anchor-permalink" href="#Step-6:-Discretize-the-PDE-system-using-Sophon" title="Permalink"></a></h2><pre><code class="language-julia hljs">prob = Sophon.discretize(pde_system, pinn, sampler, strategy)</code></pre><h2 id="Step-7:-Solve-the-optimization-problem"><a class="docs-heading-anchor" href="#Step-7:-Solve-the-optimization-problem">Step 7: Solve the optimization problem</a><a id="Step-7:-Solve-the-optimization-problem-1"></a><a class="docs-heading-anchor-permalink" href="#Step-7:-Solve-the-optimization-problem" title="Permalink"></a></h2><pre><code class="language-julia hljs">res = Optimization.solve(prob, BFGS(); maxiters=2000)</code></pre></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/ode/">Introduction with Lotka-Volterra System »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 24 November 2023 17:19">Friday 24 November 2023</span>. Using Julia version 1.9.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
v = Siren(2,1; hidden_dims=16,num_layers=4, omega = 1.0)) </code></pre><p>We define a physics-informed neural network (PINN) with the pinn variable. The PINN macro takes a dictionary that maps the dependent variables to their corresponding neural network architecture. In this case, we use the Siren architecture for both u and v with 2 input dimensions, 1 output dimension, 16 hidden dimensions, and 4 layers. We also set the frequency of the sine activation functions to 1.0.</p><h2 id="Step-4:-Create-a-QuasiRandomSampler-object"><a class="docs-heading-anchor" href="#Step-4:-Create-a-QuasiRandomSampler-object">Step 4: Create a QuasiRandomSampler object</a><a id="Step-4:-Create-a-QuasiRandomSampler-object-1"></a><a class="docs-heading-anchor-permalink" href="#Step-4:-Create-a-QuasiRandomSampler-object" title="Permalink"></a></h2><p>Here, we create a QuasiRandomSampler object with 500 sample points, where the first argument corresponds to the number of data points for each equation, and the second argument corresponds to the number of data points for each boundary condition.</p><pre><code class="language-julia hljs">sampler = QuasiRandomSampler(500, (200,200,20,20))</code></pre><h2 id="Step-5:-Define-a-training-strategy"><a class="docs-heading-anchor" href="#Step-5:-Define-a-training-strategy">Step 5: Define a training strategy</a><a id="Step-5:-Define-a-training-strategy-1"></a><a class="docs-heading-anchor-permalink" href="#Step-5:-Define-a-training-strategy" title="Permalink"></a></h2><p>Here, we use a NonAdaptiveTraining strategy with <code>1</code> as the weight of all equations, and <code>(10,10,1,1)</code> for the four boundary conditions.</p><pre><code class="language-julia hljs">strategy = NonAdaptiveTraining(1,(10,10,1,1))</code></pre><h2 id="Step-6:-Discretize-the-PDE-system-using-Sophon"><a class="docs-heading-anchor" href="#Step-6:-Discretize-the-PDE-system-using-Sophon">Step 6: Discretize the PDE system using Sophon</a><a id="Step-6:-Discretize-the-PDE-system-using-Sophon-1"></a><a class="docs-heading-anchor-permalink" href="#Step-6:-Discretize-the-PDE-system-using-Sophon" title="Permalink"></a></h2><pre><code class="language-julia hljs">prob = Sophon.discretize(pde_system, pinn, sampler, strategy)</code></pre><h2 id="Step-7:-Solve-the-optimization-problem"><a class="docs-heading-anchor" href="#Step-7:-Solve-the-optimization-problem">Step 7: Solve the optimization problem</a><a id="Step-7:-Solve-the-optimization-problem-1"></a><a class="docs-heading-anchor-permalink" href="#Step-7:-Solve-the-optimization-problem" title="Permalink"></a></h2><pre><code class="language-julia hljs">res = Optimization.solve(prob, BFGS(); maxiters=2000)</code></pre></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/ode/">Introduction with Lotka-Volterra System »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 24 November 2023 18:25">Friday 24 November 2023</span>. Using Julia version 1.9.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/qa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
loss_2 = sum(abs2, Sophon.residual_function_1(prob.p[2], p))
println(&quot;loss: $loss_1, loss_2&quot;)
return false
end</code></pre><p>Finally, pass the callback function to <code>Optimization.solve</code> to monitor the loss as the training progresses.</p><h2 id="Q:-How-can-I-inspect-the-generated-symbolic-loss-function?"><a class="docs-heading-anchor" href="#Q:-How-can-I-inspect-the-generated-symbolic-loss-function?">Q: How can I inspect the generated symbolic loss function?</a><a id="Q:-How-can-I-inspect-the-generated-symbolic-loss-function?-1"></a><a class="docs-heading-anchor-permalink" href="#Q:-How-can-I-inspect-the-generated-symbolic-loss-function?" title="Permalink"></a></h2><p>A: Simply replace <code>Sophon.discretize</code> by <code>Sophon.symbolic_discretize</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/sod/">« SOD Shock Tube Problem</a><a class="docs-footer-nextpage" href="../api/">API Reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 24 November 2023 17:18">Friday 24 November 2023</span>. Using Julia version 1.9.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
end</code></pre><p>Finally, pass the callback function to <code>Optimization.solve</code> to monitor the loss as the training progresses.</p><h2 id="Q:-How-can-I-inspect-the-generated-symbolic-loss-function?"><a class="docs-heading-anchor" href="#Q:-How-can-I-inspect-the-generated-symbolic-loss-function?">Q: How can I inspect the generated symbolic loss function?</a><a id="Q:-How-can-I-inspect-the-generated-symbolic-loss-function?-1"></a><a class="docs-heading-anchor-permalink" href="#Q:-How-can-I-inspect-the-generated-symbolic-loss-function?" title="Permalink"></a></h2><p>A: Simply replace <code>Sophon.discretize</code> by <code>Sophon.symbolic_discretize</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/sod/">« SOD Shock Tube Problem</a><a class="docs-footer-nextpage" href="../api/">API Reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Friday 24 November 2023 18:25">Friday 24 November 2023</span>. Using Julia version 1.9.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 9c73e60

Please sign in to comment.