Replies: 1 comment 2 replies
-
I understood what my mistake was. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!!
Firstly I have to appreciate the developer of this library and after that I have a question.
I'm new with PINNs and I'm trying to simulate the step fluid flow field around a cylinder and here is the code:
`def wall_top_boundary(x, on_boundary):
"""Checks for points on top wall boundary"""
return on_boundary and np.isclose(x[1], 2.0)
def wall_bottom_boundary(x, on_boundary):
"""Checks for points on bottom wall boundary"""
return on_boundary and np.isclose(x[1], 0.0)
def wall_mid_horizontal_boundary(x, on_boundary):
"""Check for points on step horizontal boundary"""
return on_boundary and (np.isclose(x[1], 1.0) and x[0] < 2.0)
def wall_mid_vertical_boundary(x, on_boundary):
"""Check for points on step horizontal boundary"""
return on_boundary and (x[1] < 1.0 and np.isclose(x[0], 2.0))
def outlet_boundary(x, on_boundary):
"""Implements the outlet boundary with zero y-velocity component"""
return on_boundary and np.isclose(x[0], 12.0)
def inlet_boundary(x, on_boundary):
"""Implements the inlet boundary with parabolic x-velocity component"""
return on_boundary and np.isclose(x[0], 0.0)
def boundary_circle(x, on_boundary):
#centre (4, 1), radius 0.3
return on_boundary and disk_domain.on_boundary(x)
def parabolic_velocity(x):
"""Parabolic velocity"""
return (6 * (x[:, 1] - 1) * (2 - x[:, 1])).reshape(-1, 1)
def zero_velocity(x):
"""Zero velocity"""
return np.zeros((x.shape[0], 1))
def output_transformer(inputs, outputs):
"""Apply output transforms to strictly enforce boundary conditions"""
def navier_stokes(x, y):
"""Navier-Stokes equation"""
rho = 1.0
nu = 0.01
eps = 1e-8
if name == 'main':
geom1 = dde.geometry.geometry_2d.Polygon([
[0.0, 2.0], [12.0, 2.0], [12.0, 0.0], [2.0, 0.0], [2.0, 1.0],
[0.0, 1.0]
])
disk_domain = dde.geometry.Disk([4,1],0.3)
geom = geom1-disk_domain
and this is the result:
while it should be like this:
I do not know how to fix the issue, any help would be appreciated
Beta Was this translation helpful? Give feedback.
All reactions