Comments (1)
Hi @engsbk, please check out the latest FBPINN release - it is a major update and this should be easily implementable with the new fbpinns.problems.Problem
class. Something like this:
import jax.numpy as jnp
import numpy as np
from fbpinns.domains import RectangularDomainND
from fbpinns.problems import WaveEquationConstantVelocity3D
from fbpinns.networks import FCN
from fbpinns.constants import Constants
from fbpinns.trainers import PINNTrainer
class WaveEquationInterfaceVelocity3D(WaveEquationConstantVelocity3D):
@staticmethod
def init_params(c0=1, c1=2,
source=np.array([[-0.5, 0., 0.1, 1.]])):
static_params = {
"dims":(1,3),
"c0":c0,
"c1":c1,
"c_fn":WaveEquationInterfaceVelocity3D.c_fn,# velocity function
"source":jnp.array(source),# location, width and amplitude of initial gaussian sources (k, 4)
}
return static_params, {}
@staticmethod
def c_fn(all_params, x_batch):
"Computes the velocity model"
p = all_params["static"]["problem"]
c0, c1 = p["c0"], p["c1"]
x = x_batch[:,0:1]
c = c0 + (c1-c0)*(1+jnp.tanh(x/0.1))/2
return c
c = Constants(
domain=RectangularDomainND,
domain_init_kwargs=dict(
xmin=np.array([-1,-1,0]),
xmax=np.array([1,1,1]),
),
problem=WaveEquationInterfaceVelocity3D,
problem_init_kwargs=dict(
c0=1,
c1=2,
),
network=FCN,
network_init_kwargs=dict(
layer_sizes=[3,32,32,32,1],
),
decomposition_init_kwargs=dict(
unnorm=(0.,0.1),
),
ns=((50,50,50),),
n_test=(100,100,5),
n_steps=15000,
clear_output=True,
)
run = PINNTrainer(c)
_ = run.train()
from fbpinns.
Related Issues (10)
- Am I too late? HOT 2
- About the dataset HOT 1
- some confusion about unormalization HOT 1
- Running Error HOT 3
- Modifiying the wave 3D Problem HOT 4
- running error HOT 1
- Environment Setting HOT 1
- Empty gradient when the dim of u is 2 HOT 1
- Run Error, need help! HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fbpinns.