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.

post processing: project 2D data onto 1D axis

Please login with a confirmed email address before reporting spam

Hi, I was trying to compute the profile of molecule concentration (which is the result of certain stationary or time-dependent study) by projecting the 2D data onto a 1D axis. Like showing in the attached graph, molecules can only diffuse in the blue region and I want to look at it concentration profile in the horizontal direction (x-direction) by averaging its concentration in the vertical direction at every x location. I understand this can be done by exporting all of the data and using MATLAB to do the averaging part. But the exported data files are huge for the real geometry I am looking at. I wonder if this can be done within COMSOL? Thank you!



5 Replies Last Post 2018年11月9日 GMT-5 11:07
Niklas Rom COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年11月2日 GMT-4 04:26
Updated: 6 years ago 2018年11月2日 GMT-4 04:30

Hi Emily, in COMSOL Multiphysics, use the Linear Projection, or General Projection couplings.

Read up on this is the documentation (Press F1 in COMSOL to bring the doc up). Then go to the section COMSOL Multiphysics Reference Manual > Global and Local Definitions > Component Couplings and Coupling Operators.

Attached is an example:

http://cds.comsol.com/mg/25bdc08cc48522.zip Estimated size: 4.8 MB This link expires November 9, 2018. Please make sure to download before that date.

Included files: * ProjectionCouplingExample.mph * ProjectionCouplingExampleV43a.pptx

Kind regards

Niklas Rom, COMSOL

Hi Emily, in COMSOL Multiphysics, use the Linear Projection, or General Projection couplings. Read up on this is the documentation (Press F1 in COMSOL to bring the doc up). Then go to the section COMSOL Multiphysics Reference Manual > Global and Local Definitions > Component Couplings and Coupling Operators. Attached is an example: [http://cds.comsol.com/mg/25bdc08cc48522.zip](http://cds.comsol.com/mg/25bdc08cc48522.zip) Estimated size: 4.8 MB This link expires November 9, 2018. Please make sure to download before that date. Included files: * ProjectionCouplingExample.mph * ProjectionCouplingExampleV43a.pptx Kind regards Niklas Rom, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年11月8日 GMT-5 16:14
Updated: 6 years ago 2018年11月8日 GMT-5 16:55

Hi Niklas, Thank you very much for your reply. I tried the General Projection on a simple rectangular domain but still have trouble getting the correct solution. The model file is attached and the model problem is described as follows.

Molecules undergo diffusion (with rate D2) and degradation (with rate kdl) in a rectangle, where the concentration of the molecule on the left boundary is fixed at c_max. When I solve the system using Time Dependent study, it works fine. But the stationary study gives oscillatory negative values, which I don't quite understand. I wonder if you have any idea what is wrong here? Thank you very much.

Best, Emily

Hi Niklas, Thank you very much for your reply. I tried the General Projection on a simple rectangular domain but still have trouble getting the correct solution. The model file is attached and the model problem is described as follows. Molecules undergo diffusion (with rate D2) and degradation (with rate kdl) in a rectangle, where the concentration of the molecule on the left boundary is fixed at c_max. When I solve the system using Time Dependent study, it works fine. But the stationary study gives oscillatory negative values, which I don't quite understand. I wonder if you have any idea what is wrong here? Thank you very much. Best, Emily


Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年11月9日 GMT-5 02:54

Hi

Steady-state has a closed form solution

c/c_max = cosh[lambda·L(z-1)]/cosh[lambda·L]

where z = x/L, lambda² = kdl/D2 and L = the length of the domain (50 m).

As you see, the problem is in 1-D, really. I also was pondering the dimensions of the simulation domain (50 m) but then realised that your diffusion coefficient was 0.1 m²/s, making lambda·L ≈ 1.58. Did you think of making the problem dimensionless?

I also got an oscillatory steady-state :)

Hi Steady-state has a closed form solution c/c_max = cosh[lambda·L(z-1)]/cosh[lambda·L] where z = x/L, lambda² = kdl/D2 and L = the length of the domain (50 m). As you see, the problem is in 1-D, really. I also was pondering the dimensions of the simulation domain (50 m) but then realised that your diffusion coefficient was 0.1 m²/s, making lambda·L ≈ 1.58. Did you think of making the problem dimensionless? I also got an oscillatory steady-state :)

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年11月9日 GMT-5 07:03

Aargh!

The reaction term must be of course -kdl*c. The it works fine

Aargh! The reaction term must be of course -kdl*c. The it works fine

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年11月9日 GMT-5 11:07

Thank you Lasse! Yes, the reaction term should be -kdl*c. That's a stupid mistake.

Thank you Lasse! Yes, the reaction term should be -kdl*c. That's a stupid mistake.

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.