Skip to content

Commit 801b6b8

Browse files
dario-cosciandem0
authored andcommitted
Update RBAPINN
1 parent 5d2ca62 commit 801b6b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pina/solvers/pinns/rbapinn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(
117117
# initialize weights
118118
self.weights = {}
119119
for condition_name in problem.conditions:
120-
self.weights[condition_name] = 0
120+
self.weights[condition_name] = 1
121121

122122
# define vectorial loss
123123
self._vectorial_loss = deepcopy(loss)
@@ -158,7 +158,7 @@ def loss_phys(self, samples, equation):
158158
residual = self.compute_residual(samples=samples, equation=equation)
159159
cond = self.current_condition_name
160160

161-
r_norm = self.eta * torch.abs(residual) / torch.max(torch.abs(residual))
161+
r_norm = self.eta * torch.abs(residual) / (torch.max(torch.abs(residual))+1e-12)
162162
self.weights[cond] = (self.gamma * self.weights[cond] + r_norm).detach()
163163

164164
loss_value = self._vectorial_loss(

0 commit comments

Comments
 (0)