Skip to content

Commit

Permalink
Update to v1.0 Beta (PaddlePaddle#55)
Browse files Browse the repository at this point in the history
* fix some bugs in static

* fix exe run startup program

* static graph can run

* to debug auto static

* for parallel

* fix dataset

* more outputs including loss and net out

* update inputspec definition

* rename condition to criteria

* add uniform discretization

* update uniform disc

* add solver static and data parallel

* backup

* dynamic mode can run

* fix bugs in computing loss

* backup

* to test entire ldc

* backup vtk

* fix bug in visu

* fix bugs in visu static mode

* solve uniform interface

* uniform dynamic static

* update dist static

* backup

* fix bug in bc loss

* bc weight

* rhs lambda

* wight pde

* fix bug in sampling disc

* update discretize

* backup to finish 3d

* backup cylinder in rec

* backup cyclinderinrec

* fix bug in circleinrec

* backup

* to fix vtk error

* fix bug in rec float32

* fix bug circle in rec

* cube disc to finish

* backup

* fix bug in cube

* fix 3d cube without cylinder

* fix bug in cube removing cylinder

* backup

* add cube

* add laplace and poission equ

* separte laplace and poisson

* update init

* discrete rhs

* update bc

* fix bug in bc

* to solve to_tensor error

* minor modifications

* fix pde wight tmp

* fix laplace3d

* bc loss loop on bc, not boundary

* complte bc confg

* backup create labels

* add create labels

* rename ins to inputs

* input label dynamic

* input label static

* auto dist update

* minor backup

* update name _n

* update name _n

* add feed u_n function

* backup

* clean pde definition

* backup, to fix u_n

* backup fixing bugs

* fix bugs in disc pde

* simplify variable name

* fix bc dist error

* fix bc disc error

* fix errror in static

* fix label shape

* separate solve and init

* static update data_n

* fix bug: lambda weight

* re-org files and directory

* support vtk with lambda input

* update copyright 2022

* laplace and darcy added

* Create cylinder3d_steady.py

* update ldc nu

* backup add data_loss

* backup padding

* fix padding error

* default padding

* cleaning

* fix dist

* fix padding error

* delete log files

* update solver

* update solver

* fix weight eq error

* update loss

* update weight name

* add mse

* fix L2 error computation

* fix reshape in padding

* fix auto dist

* fix data holder error

* add predict

* Create cylinder3d_unsteady.py

* fix data loss error

* update darcy2d vtk name

* split geometry

* visu multi process

* config float32 float64

* discretize time interval

* backup

* ic pass run

* fix unsteady error

* fix network error in laplace

* fix mse norm error

* update mse in darcy

* fix ldc norm computation

* update num epoch

* fix cylinder3d_unsteady

* fix bug in ns implicit

* fix ic

* update vtk for multiple time steps

* fix bc with more time steps

* bakcup

* tested ldc time continue

* delete unused files

* update cyclinder 3d steady

* update steady 3d

* update flow steady with real data

* add eq_loss for data points

* fix list/tuple in eq weight

* fix bug in data loss

* steady cylinder ok

* move kovasznay case

* Update cylinder3d_unsteady.py

* backup: reorg eqloss and dataloss

* backup

* backup: separate geo disc and pde disc

* backup examples

* backup 3d cylinder unsteady

* uddate laplace

* fix bug time space

* Update cylinder3d_unsteady.py

* delete discretize.py unused

* fix norm 2 in data loss

* backup

* update '__solve_static_auto_dist' predict

* fix weight in ns implcit

* Update laplace2d.py

* Update laplace2d.py

* Update cylinder3d_unsteady.py

* fix dynamic static diff

* backup doc pde

* backup

* update doc geometry

* update doc geometry api

* update bc

* fix kovasznay

* rm cylinder 3d continue

* bc ic rst

* update bc ic doc

* update minor

* update bc newmann

* Update bc.py

* Update bc.py

* backup predict

* Update cylinder3d_unsteady.py

* Update cylinder3d_unsteady.py

* Update cylinder3d_unsteady.py

* update bc

* fix ic

* backup solver

* fix solver auto dist

* uniform cylinder cube

* update cube faces

* update example in doc

* default static parallel

* add customized function

* update geometry

* fix user pde

* update pde

* update doc and readme

* Update cylinder3d_unsteady.py

* update doc

* add padding controller

* fix pow

* Update cylinder3d_unsteady.py

* Update cylinder3d_unsteady.py

* fix doc

* fix doc in geo

* update solver predict

* to numpy predict

* update solver

* update fcnet in module cfd fsi

* modify the doc

* modify File Permissions

* Add cylinder3d doc

* update cylinder3d

* modify the related doc in V1.0

* add README

* update doc

* update folder

* workaround for dist api static mode default issue

* move readme

* update doc for kovasznay

* remove modifications in pre-commit config

* update doc

* merge ad code

* delete useless

* move engine.prepare to init_static_auto

* add folder

* add folder

* add data_loss weight

* add data weight

* add data weight

* add data weight

* int -> float

* rm 0.1 tests

* fix code style error

Co-authored-by: Liu-xiandong <[email protected]>
Co-authored-by: zhaoyingli <[email protected]>
Co-authored-by: Liu-xiandong <[email protected]>
  • Loading branch information
4 people authored May 19, 2022
1 parent 7c6e1a5 commit 5ca1899
Show file tree
Hide file tree
Showing 119 changed files with 5,179 additions and 4,476 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ FETCH_HEAD
.npy

# vtk
.vtk
*.vtk
*.vtu
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved

Apache License
Version 2.0, January 2004
Expand Down
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Current version of PaddleScience is v0.1.*
*Current version of PaddleScience is v1.0 Beta.*

# Introduction
PaddleScience extends the PaddlePaddle framework with reusable
Expand All @@ -11,17 +11,17 @@ Its design is evolving and its APIs are subject to change.

PaddleScience currently focuses on the PINNs model. The core components are as follows.

- PDE, delineating partial differential equations in symbolic forms. Specific PDEs derive the
the base PDE class.

- Geometry, a declarative interface for defining the geometric domain. Automatic
discretization is supported

- Neural net, currently supporting fully connected layers with customizable size and depth.

- PDE, delineating partial differential equations in symbolic forms. Specific PDEs derive the
the base PDE class. Two native PDEs are currently included: Laplace2d and NavierStokes2d.

- Loss, defining what exact penalties are enforced during the training process. By default,
the L2 loss is applied. In the current design, the total loss is a weighted sum of
three parts, the equation loss, the boundary condition loss and the initial condition loss.
four parts, the equation loss, the boundary condition loss, the initial condition loss and the data loss.

- Optimizer, specifying which optimizer to use for training. Adam is the default option. More
optimizers, such as BFGS, will be available in the future.
Expand All @@ -41,7 +41,7 @@ The component organization is illustrated in the following figure.

Hardware requirements: NVIDIA GPU V100, NVIDIA GPU A100

Package dependencies: paddle, matplotlib, vtk.
Package dependencies: paddle, cuda (11.0 or higher), numpy, scipy, sympy, matplotlib, vtk, pyevtk, wget.

PaddleScience currently relies on new features of the Paddle framework so please be advised to download the latest version of Paddle on GitHub or on Gitee.

Expand All @@ -59,21 +59,29 @@ export PYTHONPATH=$PWD:$PYTHONPATH

## Run examples

Some simple examples are baked in for quick demonstration. Please find them in the `examples` directory. To run an example, just enter the subdirectory and run the demo code in Python commandline.
Some examples are baked in for quick demonstration. Please find them in the `examples` directory. To run an example, just enter the subdirectory and run the demo code in Python commandline.

```
cd examples/laplace2d
python3.7 laplace2d.py
cd examples/darcy2d
# Darcy flow (Poisson equation)
cd examples/darcy
python3.7 darcy2d.py
cd examples/ldc2d
python3.7 ldc2d.py
# LDC steady (Steady Navier-Stokes eqution)
cd examples/ldc
python3.7 ldc2d_steady.py
# Lid Driven Cavity unsteady with continue-time method (Unsteady Navier-Stokes equation)
cd examples/ldc
python3.7 ldc2d_unsteady_t.py
# Flow around a circular cylinder with discrete-time method (Unsteady Navier-Stokes equation)
cd examples/cylinder
python3.7 cylinder3d_unsteady.py
```

## Short tutorials on how to construct and solve a PINN model

[A tutorial on Lid Driven Cavity flow](./examples/ldc2d/README.md)
[A tutorial on Lid Driven Cavity flow](./examples/ldc/README.md)

[A tutorial on Darcy flow in porous medium](./examples/darcy2d/README.md)
[A tutorial on Darcy flow in porous medium](./examples/darcy/README.md)
9 changes: 5 additions & 4 deletions docs/builddoc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,10 +14,11 @@

# apt-get install python3-sphinx texlive-latex-recommended texlive-latex-extra dvipng
# pip3.7 install sphinx-rtd-theme recommonmark sphinx_copybutton sphinx_markdown_tables
# pip3.7 install jinja2==3.0.3

#python3.7 -m sphinx.cmd.quickstart --sep -p PaddleScience -a PaddlePaddle -v 0.1 -l en
#python3.7 -msphinx --sep -p PaddleScience -a PaddlePaddle -v 0.1 -l en
#sphinx-quickstart --sep -p PaddleScience -a PaddlePaddle -v 0.1 -l en
# python3.7 -m sphinx.cmd.quickstart --sep -p PaddleScience -a PaddlePaddle -v 1.0 -l en
# python3.7 -msphinx --sep -p PaddleScience -a PaddlePaddle -v 1.0Beta -l en
# sphinx-quickstart --sep -p PaddleScience -a PaddlePaddle -v 1.0Beta -l en

# sphinx-build -b html source build

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ readthedocs-sphinx-search==0.1.0
sphinx-copybutton==0.3.1
sphinx-markdown-tables==0.0.15

paddlepaddle >= 2.0.1
# paddlepaddle >= 2.0.1
6 changes: 6 additions & 0 deletions docs/source/api/bc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Boundary condition
==================

.. automodule:: paddlescience.bc.bc
:members:
:no-undoc-members:
3 changes: 0 additions & 3 deletions docs/source/api/data.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Data Process
============

.. automodule:: paddlescience.data.save_data
:members:
:no-undoc-members:
4 changes: 0 additions & 4 deletions docs/source/api/discretize.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/api/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Geometry
.. automodule:: paddlescience.geometry.rectangular
:members:
:no-undoc-members:
:inherited-members:

.. automodule:: paddlescience.geometry.geometry_discrete
:members:
:no-undoc-members:

6 changes: 6 additions & 0 deletions docs/source/api/ic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Initial condition
==================

.. automodule:: paddlescience.ic.ic
:members:
:no-undoc-members:
2 changes: 1 addition & 1 deletion docs/source/api/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Network
.. automodule:: paddlescience.network.network_fc
:members:
:no-undoc-members:

:exclude-members: parameters
22 changes: 15 additions & 7 deletions docs/source/api/pde.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
PDE (Partial Differential Equation)
===================================
=====================================

.. automodule:: paddlescience.pde.pde_laplace_2d
:members:


.. autoclass:: paddlescience.pde.pde_laplace::Laplace
:members: add_bc
:no-undoc-members:
:inherited-members:

.. automodule:: paddlescience.pde.pde_navier_stokes
:members:
.. autoclass:: paddlescience.pde.pde_poisson::Poisson
:members: add_bc
:no-undoc-members:
:inherited-members:

.. autoclass:: paddlescience.pde.pde_navier_stokes::NavierStokes
:members: add_bc, add_ic, discretize, set_time_interval
:no-undoc-members:

.. autoclass:: paddlescience.pde.pde_base::PDE
:members: add_bc, add_ic, set_time_interval
:no-undoc-members:
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 5ca1899

Please sign in to comment.