fix: corregge segno Robin BC a x=0 (era + doveva essere -)
A x=0 la normale uscente è -x, quindi la condizione Robin corretta è dT/dx - (h/k)(T-T_amb) = 0, speculare a x=L dove vale dT/dx + (h/k)(T-T_amb) = 0. Il segno errato causava T(0,t) sotto T_amb (~12°C) con sorgente attiva. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,7 @@ def heat_pinn_loss(model, x_f, t_f, x_ic, t_bc,
|
||||
x_left = torch.zeros(t_bc.shape[0], device=t_bc.device).requires_grad_(True)
|
||||
T_left = model(torch.stack([x_left, t_bc.detach()], dim=1))
|
||||
dT_dx_left = torch.autograd.grad(T_left.sum(), x_left, create_graph=True)[0]
|
||||
L_bc_left = ((dT_dx_left + (config.H_CONV / config.K) * (T_left.squeeze() - config.T_AMB)) ** 2).mean() / _bc_scale
|
||||
L_bc_left = ((dT_dx_left - (config.H_CONV / config.K) * (T_left.squeeze() - config.T_AMB)) ** 2).mean() / _bc_scale
|
||||
|
||||
# BC x=L: Robin — dT/dx + H_CONV/K * (T(L,t) - T_AMB) = 0
|
||||
x_right = torch.full((t_bc.shape[0],), config.L, device=t_bc.device).requires_grad_(True)
|
||||
|
||||
Reference in New Issue
Block a user