Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 25631

use modulo for periodic step function

$
0
0
Hi!

I want to create a periodic step function to control the input concentration of a contaminant in an aquifer. I want the concentration to be 1 for 3 months and 0 for the rest 9 months.

I have created a rect function with upper limit=0, lower limit=3*24*30*3600 (months in sec), and a rise time=0.5*24*30*3600 (1/2 month for smoothing).

Then I use as a dirichlet boundary condition that C=1 * rect1(mod(t,12*24*30*3600)).

This should work, no? Is there a way to plot the input function before runing the model? (the model is very big with many meshes and it takes a long time to solve).

When I try to run it I get an error at time=1 year (12*24*30*3600). It says that solver can not converge to a solution. Any idea why I get this? I thought that it could be the sharp step increase.. however it worked ok at t=3months where there was a step decrease... I have also used a 1/2 month smoothing which should be ok.. I have set the solver to take "free" time steps while solving it, so I was hoping that it will take smaller time steps around the concentration changes.

thank you so much!

Viewing all articles
Browse latest Browse all 25631

Latest Images

Trending Articles



Latest Images