As a beginner in using the Modulus framework, I tried to follow the initial code given in the following link:

https://docs.nvidia.com/deeplearning/modulus/user_guide/notebook/notebook.html

In order to learn, I tried to change the existing code in order to solve the equation of the form u__x__x = x with boundary conditions (BC):

u(0) = 0 and u(2)=1, where x in [0, 2]. Considering that the analytical solution of this equation is u = x*(x^2-1)/6, unfortunately, I did not get even an approximate result using Modulus.

In order to set the appropriate BC, I made the following change:

from modulus.domain.constraint import PointwiseBoundaryConstraint, PointwiseInteriorConstraint

# bcs

bc = PointwiseBoundaryConstraint(

nodes=nodes,

geometry=geo,

outvar={“in”: (0, 1)},

batch_size=2,

)

domain.add_constraint(bc, “bc”)

Considering that I don’t have a good results, can the BC conditions: u(x=0) = 0 and u(x=2) = 1 be set with outvar={“u”: (0, 1)}?

Result is shown below:

Thanks in advance.