# Time dependent boundary conditions

Hello all,

I want to solve a time-dependent diffusion problem where the boundary temperatures are a function of time.

Is it possible to implement time-dependent boundary conditions in Modulus ? If so, can we give some discrete data like a table that represents time vs temperature on a boundary?

Can you please give any suggestions on this? Thanks.

Hi @bvss89

Assuming that the current time is an input variable `t` and there’s a analytical function for the boundary condition `u_{boundary} = f(t,...)`. This should be achievable by providing a sympy expression as the output/target variable of boundary constraint.

An example of this (not a function of time, but of space) is in the annular ring example `examples/annular_ring/annular_ring/annular_ring.py` which can be found on the examples GitLab repo. This problem has a parabolic inlet velocity profile enforced using a sympy expression:

``````# inlet
inlet_sympy = parabola(
y, inter_1=channel_width, inter_2=channel_width, height=inlet_vel
)
inlet = PointwiseBoundaryConstraint(
nodes=nodes,
geometry=geo,
outvar={"u": inlet_sympy, "v": 0},
batch_size=cfg.batch_size.inlet,
criteria=Eq(x, channel_length),
)
``````

A similar approach can be used but with a function of time for a time dependent boundary condition.

Now for a discrete table of values, you will likely need to make a custom dictionary loader for your data. I.e. you will need to manually build a dictionary of input and output variables that reflect the different discrete points in time you have on file. The `PointwiseConstraint.from_numpy()` function should help here located in `modulus/domain/constraint/continuous.py`.

An example that uses this can be found in `examples/seismic_wave/wave_2d.py`.

Thanks a lot @ngeneva for the detailed explanation.

Hi @bvss89 ,

Hope the response was able to help you move forth with your use case. Would you be interested in speaking to the modulus team to share more details on the use case and we can try to share more insights on how to apply Modulus for you problem. You can reach out to us directly at modulus-team@exchange.nvidia.com.

Thanks
Ram

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.