## Need distribution of an integrated quantity

General discussions about how to formulate a script for FlexPDE.

### Need distribution of an integrated quantity

I need the value of INTEGRAL(f(x), "path_name") as a function of distance along the path. The physical situation is where a coated substrate moves through a drying oven, and a solvent is baked out of the coating. The mass transfer rate varies with distance in the oven. I need to estimate the cumulative amount of solvent removed vs. distance into the oven so I can tell the location where the coating is dry.

In a previous forum discussion with another user, the Moderator recommended creating a variable, say fint, an equation like dx(fint) = f(x), and setting fint=0 at one end of the boundary.

However, implementing this has not given me reasonable or consistent results (sometime, inexplicably, I get no results - just fint = 0).

In the end I need to use values of fint(x) along a path in my calculations, so even if the calculations worked I'd need a way to extract the values of fint along the path. (In my current model the path is simply the x-axis.)

Is there any chance that a future update might include the ability to calculate the integral as a function of distance along a path?
CDLang1

Posts: 12
Joined: Tue May 16, 2017 12:41 pm

### Re: Need distribution of an integrated quantity

It would help if you could send some script examples of what you're trying to do and what fails.
moderator

Posts: 733
Joined: Tue Jan 11, 2011 1:45 pm

### Re: Need distribution of an integrated quantity

Maybe I'm looking at this wrong, but if I do successfully obtain fint from dx(fint)=f(x,y), how do I then use values of fint on a give path - even if just along a boundary - in a calculation?

Here are the key pieces of the script, it is time-dependent so I can ramp up an assortment of velocities, gas flows, etc. at realistic rates:

VARIABLES
v(1) = vector(vx,vy) ! gas velocities in oven
P(1000) ! pressure, solve using slightly compressible approx
cS(1e-9) ! solvent concentration in gas phase
psi ! streamlines
fint ! dummy variable

DEFINITIONS
flux=-D*grad(cS) ! D is solvent diffusivity in gas phase, this is the quantity I want to integrate along the x-axis, on the bottom boundary of the domain
...dozens of lines describing the geometry, the gas & solvent properties, ... gas density (dens) is assumed constand

EQUATIONS
p: div(grad(p)) = PENALTY*div_v ! continuity eqn expressed as "mildly compressible" form
THEN
psi: div(grad(psi)) + w = 0 ! streamlines
THEN
fint: dx(fint) = ycomp(flux) ...or, -D*dy(cS). I have to turn on this equation with a SWAGE function or the script spirals down to the low time increment limit.

For simplicity sake we can consider the domain a rectangular box. The BCs on fint are: value(fint)=0 on the left boundary of the geometry, natural(fint)=0 on all the other boundaries. The BCs on cS are value(cS)=saturation vapor pressure on most of the bottom boundary (the coated substrate), natural(cS)=0 everywhere else, except the exhaust of the oven (located on part of the right boundary) where it is natural(cS)=vx*cS-D*dx(cS).

fint often returns as 0, sometimes it actually has the correct shape when plotted on the substrate path. However, even if this worked, fint would be estimated everywhere on the domain, but I only want its values along, say, a boundary path for use in calculations.
CDLang1

Posts: 12
Joined: Tue May 16, 2017 12:41 pm

### Re: Need distribution of an integrated quantity

Declaring Fint as a Variable means it will have a defined value at every point in the mesh.
Any plot -- a contour or an elevation -- will simply look up the value at the required positions.
So for example you can plot Fint along the right edge and see the value of Integral(0 to Xright)(-D*dy(cs))dx for all values of y.
moderator

Posts: 733
Joined: Tue Jan 11, 2011 1:45 pm

### Who is online

Users browsing this forum: No registered users and 9 guests