Hello,

Instead of hard-enforcing periodic boundary conditions by imposing a sinusoidal function for my neural network, I’d like to instead optimize for the periodic boundary condition using a custom node. However, I’m not sure how to go about implementing this.

Any advice?

Thank you,

Mathieu

Hi, have you solved this issue?

I am faced with the same problem, and I have an imperfect solution.

First, I use the Graph to contract a node that can calculate the output that I need.

from modulus.sym.graph import Graph

Second, I write a function that takes invar(x,y,x) as input to calculate the value at the other periodic surface. This function is called at one of the periodic surfaces, changes the invar(x,y,z) according to the geometry relationship, and calculates the targeted value(u(x) = u(x’)).

Finally, I sent the function into the PointwiseBoundaryConstraint and modified the calculation of the outvar.

In this way, I based on the existing PointwiseBoundaryConstraint realized the loss function of u(x) = u(x’)