Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Averaged flux

Please login with a confirmed email address before reporting spam

Hi,

how to average the time-dependent diffusive flux for pre-defined time intervals at a domain boundary and allocate those (averaged) values to the arithmetic mean of the time intervals? The evaluation of the averages is part of the computational (not post processing) phase.

Hence, I would like to evaluate the following expression at a given boundary:

Integral flux from t(i) until t(i+1) devided by the length of the time interval ( t(i+1) - t(i) ); that averaged flux value should be allocated to time point ( t(i+1) + t(i) ) /2, i.e. the middle of the time interval.

Many thanks for your appreciated help.

Best regards,

Andreas

4 Replies Last Post 14.02.2013, 04:13 GMT-5
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12.02.2013, 11:10 GMT-5
Hi

what often works is to add a new dependent variable that integrates your value over time (there are some examples on the Forum and in the KB (knowledge base)

For the postprocessing you have the table operations on the colums too, and in last version some special operators (check all the new ones in the help;)

--
Good luck
Ivar
Hi what often works is to add a new dependent variable that integrates your value over time (there are some examples on the Forum and in the KB (knowledge base) For the postprocessing you have the table operations on the colums too, and in last version some special operators (check all the new ones in the help;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13.02.2013, 02:40 GMT-5
Thanks Ivar for your hint with the new dependent variable; I will also check the "Konwledge base" .

Best regards,

Andreas
Thanks Ivar for your hint with the new dependent variable; I will also check the "Konwledge base" . Best regards, Andreas

Sven Friedel COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13.02.2013, 10:33 GMT-5
Dear Andreas,

if ,you pointed out in personal comm., the averaging has not to be done on run-time of the main computation,
I suggest the follwoing procedure:

1) Calculate the main physics of your problem in Study 1 (time-dependent)
2) Add a ODE (in the spatial dimension needed), to integrat the expression of your choice in time
The averaging can be done by multiplying your expression with a suitable window:
For instance if you want to obtain the average of chds.tfluxx_c in [t0,t1] integrate

chds.tfluxx_c*(t>t0)*(t<t1)/(t1-t0)

3) Add a Study 2 that solves only the ODE. Make sure to use "Values of dependent variables not solved for"
pointing to Study 1 and "All". This ensures that the Study 2 refers to synchronous time steps in Study 1.

4) In Results you can display the value of the time-integral exactly in the midel of your interval.

5) Finally, you can use a parametric sweep to apply that method to multiple time intervals and Derived Values to output the results in a table.

I attach two working examples, my points (1-4) are used in ja_averaging_single.mph, the parametric sweep (5)
is used in ja_averaging_parametric.mph.

I hope that helps you further!

Best regards,

Sven Friedel
Dear Andreas, if ,you pointed out in personal comm., the averaging has not to be done on run-time of the main computation, I suggest the follwoing procedure: 1) Calculate the main physics of your problem in Study 1 (time-dependent) 2) Add a ODE (in the spatial dimension needed), to integrat the expression of your choice in time The averaging can be done by multiplying your expression with a suitable window: For instance if you want to obtain the average of chds.tfluxx_c in [t0,t1] integrate chds.tfluxx_c*(t>t0)*(t


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.02.2013, 04:13 GMT-5
Dear Sven,

many thanks for your efforts and your detailed help – which is very appreciated.
I followed your recommendations and suggestions and I got exactly the result I wanted. In the attached figure you can see the outcome of a first preliminary calculation: Using black circles there are shown the experimental flux data at the downstream boundary of a tracer through-diffusion experiment through compacted clay. Each data point has been averaged over the sampling interval and the value is allocated to the mid-time point of the measurement interval. The blue zigzag line describes the (computed) diffusive flux when accounting also for the experimental sampling procedure, and the red squares denote the calculated averaged flux data allocated to the mid sampling intervals, too. Hence, a direct comparison between experimental data and modelling results is feasible.
With such a Comsol set-up it is possible to account in detail for additional information of the experiments which helps reducing uncertainties in the analysis. (Note: The model’s parameters have not been optimised yet.)

With such a solution Comsol clearly demonstrates again its modelling versatility and applicability to a broad variety of real-world observations and thereby allowing a modeller to focus primarily on the underlying physics and less on the basic numeric.

Best regards,

Andreas
Dear Sven, many thanks for your efforts and your detailed help – which is very appreciated. I followed your recommendations and suggestions and I got exactly the result I wanted. In the attached figure you can see the outcome of a first preliminary calculation: Using black circles there are shown the experimental flux data at the downstream boundary of a tracer through-diffusion experiment through compacted clay. Each data point has been averaged over the sampling interval and the value is allocated to the mid-time point of the measurement interval. The blue zigzag line describes the (computed) diffusive flux when accounting also for the experimental sampling procedure, and the red squares denote the calculated averaged flux data allocated to the mid sampling intervals, too. Hence, a direct comparison between experimental data and modelling results is feasible. With such a Comsol set-up it is possible to account in detail for additional information of the experiments which helps reducing uncertainties in the analysis. (Note: The model’s parameters have not been optimised yet.) With such a solution Comsol clearly demonstrates again its modelling versatility and applicability to a broad variety of real-world observations and thereby allowing a modeller to focus primarily on the underlying physics and less on the basic numeric. Best regards, Andreas

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.