Skip to content

Pressure Dacy flow Init #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d7a2512
Pressure Dacy flow Init
bojunZhang-heng Jul 14, 2025
740d145
./Model_Script/Transolver_Darcy.sh update
bojunZhang-heng Jul 14, 2025
78df777
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 14, 2025
06068c8
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 14, 2025
e22ccb3
My_python_job/Model_Script/ Init
bojunZhang-heng Jul 14, 2025
8bcea5f
My_python_job/Pressure_train.lsf update
bojunZhang-heng Jul 14, 2025
f2023ec
My_python_job/model Init
bojunZhang-heng Jul 14, 2025
b6fda09
My_python_job/model_dict.py Init
bojunZhang-heng Jul 14, 2025
520290d
My_python_job/utils update
bojunZhang-heng Jul 14, 2025
fa5855d
My_python_job/utils_Dri.py update
bojunZhang-heng Jul 14, 2025
feee2f3
Usage_Python/ Init
bojunZhang-heng Jul 15, 2025
909ebb9
My_python_job/Model_Script/ update
bojunZhang-heng Jul 15, 2025
4996a40
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 15, 2025
25f3111
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 17, 2025
809d9fc
My_python_job/Usage_Python/Usage_Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 17, 2025
2380699
Usage_Python/Usage_Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 17, 2025
a9e9d48
model/Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 17, 2025
a946c18
PDE-Solving-StandardBenchmark/My_python_job/tmp_foo.py update
bojunZhang-heng Jul 17, 2025
6322a63
My_python_job/Pressure_train.lsf update
bojunZhang-heng Jul 21, 2025
4dcc888
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 21, 2025
05ae7d1
My_python_job/model/Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 21, 2025
5988c5b
Model_Script/Transolver_Darcy.sh
bojunZhang-heng Jul 21, 2025
fab83fe
Usage_Python/Usage_Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 21, 2025
740d745
exp_darcy.py update
bojunZhang-heng Jul 21, 2025
8e76352
model/Transolver_Structured_Mesh_2D.py upadte
bojunZhang-heng Jul 21, 2025
95e0225
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 21, 2025
61395a7
My_python_job/model/Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 21, 2025
077d07c
My_python_job/Pressure_train.lsf update
bojunZhang-heng Jul 21, 2025
10d8c86
My_python_job/Usage_Python/Usage_Transolver_Structured_Mesh_2D.py .ge…
bojunZhang-heng Jul 21, 2025
d762637
My_python_job/exp_darcy.py .get_grd() update
bojunZhang-heng Jul 21, 2025
86b1f2f
My_python_job/model/Transolver_Structured_Mesh_2D.py .get_grid() update
bojunZhang-heng Jul 21, 2025
2b0dbef
My_python_job/Usage_Python/Usage_Transolver_Structured_Mesh_2D.py MLP…
bojunZhang-heng Jul 21, 2025
277e8c1
My_python_job/exp_darcy.py MLP class Update
bojunZhang-heng Jul 21, 2025
af5d516
My_python_job/model/Transolver_Structured_Mesh_2D.py MLP class Update
bojunZhang-heng Jul 21, 2025
4760c68
Usage_Python/Usage_Physics_Attention.py Init
bojunZhang-heng Jul 21, 2025
7ceab96
model/Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 21, 2025
37355c8
My_python_job/Model_Script/Transolver_Darcy.sh update
bojunZhang-heng Jul 23, 2025
462da16
My_python_job/Pressure_train.lsf update
bojunZhang-heng Jul 23, 2025
9cf3d7f
My_python_job/Usage_Python/Usage_Physics_Attention.py update
bojunZhang-heng Jul 23, 2025
06e60b1
My_python_job/exp_darcy.py update
bojunZhang-heng Jul 23, 2025
3696a6b
My_python_job/Usage_Python/Usage_Physics_Attention.py Update kernel_s…
bojunZhang-heng Jul 23, 2025
b8f3be4
My_python_job/Usage_Python/Usage_Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 23, 2025
b8f9e7e
My_python_job/Usage_Python/Usage_Physics_Attention.py Update
bojunZhang-heng Jul 25, 2025
94a50a3
My_python_job/exp_darcy.py Update
bojunZhang-heng Jul 25, 2025
d478a5f
My_python_job/model/Physics_Attention.py update
bojunZhang-heng Jul 25, 2025
3830bfa
My_python_job/model/Transolver_Structured_Mesh_2D.py update
bojunZhang-heng Jul 25, 2025
844abcc
My_python_job/Usage_Python/Usage_Physics_Attention.py update
bojunZhang-heng Jul 25, 2025
6fb7971
My_python_job/Pressure_train.lsf update
bojunZhang-heng Jul 25, 2025
f519c08
My_python_job/Usage_Python/Usage_Physics_Attention.py Update
bojunZhang-heng Jul 25, 2025
a12bded
My_python_job/model/Physics_Attention.py update
bojunZhang-heng Jul 25, 2025
dc73a09
Usage_Python/Usage_Physics_Attention.py update
bojunZhang-heng Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
My_python_job/utils update
  • Loading branch information
bojunZhang-heng committed Jul 14, 2025
commit 520290d1394c082922d6ae289308132d180a78d7
114 changes: 114 additions & 0 deletions PDE-Solving-StandardBenchmark/My_python_job/utils/normalizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import torch
from tqdm import *


class IdentityTransformer():
def __init__(self, X):
self.mean = X.mean(dim=0, keepdim=True)
self.std = X.std(dim=0, keepdim=True) + 1e-8

def to(self, device):
self.mean = self.mean.to(device)
self.std = self.std.to(device)
return self

def cuda(self):
self.mean = self.mean.cuda()
self.std = self.std.cuda()

def cpu(self):
self.mean = self.mean.cpu()
self.std = self.std.cpu()

def encode(self, x):
return x

def decode(self, x):
return x


class UnitTransformer():
def __init__(self, X):
self.mean = X.mean(dim=(0, 1), keepdim=True)
self.std = X.std(dim=(0, 1), keepdim=True) + 1e-8

def to(self, device):
self.mean = self.mean.to(device)
self.std = self.std.to(device)
return self

def cuda(self):
self.mean = self.mean.cuda()
self.std = self.std.cuda()

def cpu(self):
self.mean = self.mean.cpu()
self.std = self.std.cpu()

def encode(self, x):
x = (x - self.mean) / (self.std)
return x

def decode(self, x):
return x * self.std + self.mean

def transform(self, X, inverse=True, component='all'):
if component == 'all' or 'all-reduce':
if inverse:
orig_shape = X.shape
return (X * (self.std - 1e-8) + self.mean).view(orig_shape)
else:
return (X - self.mean) / self.std
else:
if inverse:
orig_shape = X.shape
return (X * (self.std[:, component] - 1e-8) + self.mean[:, component]).view(orig_shape)
else:
return (X - self.mean[:, component]) / self.std[:, component]


class UnitGaussianNormalizer(object):
def __init__(self, x, eps=0.00001, time_last=True):
super(UnitGaussianNormalizer, self).__init__()

self.mean = torch.mean(x, 0)
self.std = torch.std(x, 0)
self.eps = eps
self.time_last = time_last # if the time dimension is the last dim

def encode(self, x):
x = (x - self.mean) / (self.std + self.eps)
return x

def decode(self, x, sample_idx=None):
# sample_idx is the spatial sampling mask
if sample_idx is None:
std = self.std + self.eps # n
mean = self.mean
else:
if self.mean.ndim == sample_idx.ndim or self.time_last:
std = self.std[sample_idx] + self.eps # batch*n
mean = self.mean[sample_idx]
if self.mean.ndim > sample_idx.ndim and not self.time_last:
std = self.std[..., sample_idx] + self.eps # T*batch*n
mean = self.mean[..., sample_idx]
# x is in shape of batch*(spatial discretization size) or T*batch*(spatial discretization size)
x = (x * std) + mean
return x

def to(self, device):
if torch.is_tensor(self.mean):
self.mean = self.mean.to(device)
self.std = self.std.to(device)
else:
self.mean = torch.from_numpy(self.mean).to(device)
self.std = torch.from_numpy(self.std).to(device)
return self

def cuda(self):
self.mean = self.mean.cuda()
self.std = self.std.cuda()

def cpu(self):
self.mean = self.mean.cpu()
self.std = self.std.cpu()
45 changes: 45 additions & 0 deletions PDE-Solving-StandardBenchmark/My_python_job/utils/testloss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import torch


class TestLoss(object):
def __init__(self, d=2, p=2, size_average=True, reduction=True):
super(TestLoss, self).__init__()

assert d > 0 and p > 0

self.d = d
self.p = p
self.reduction = reduction
self.size_average = size_average

def abs(self, x, y):
num_examples = x.size()[0]

h = 1.0 / (x.size()[1] - 1.0)

all_norms = (h ** (self.d / self.p)) * torch.norm(x.view(num_examples, -1) - y.view(num_examples, -1), self.p,
1)

if self.reduction:
if self.size_average:
return torch.mean(all_norms)
else:
return torch.sum(all_norms)

return all_norms

def rel(self, x, y):
num_examples = x.size()[0]

diff_norms = torch.norm(x.reshape(num_examples, -1) - y.reshape(num_examples, -1), self.p, 1)
y_norms = torch.norm(y.reshape(num_examples, -1), self.p, 1)
if self.reduction:
if self.size_average:
return torch.mean(diff_norms / y_norms)
else:
return torch.sum(diff_norms / y_norms)

return diff_norms / y_norms

def __call__(self, x, y):
return self.rel(x, y)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy