underworldcode / underworld2

underworld2: A parallel, particle-in-cell, finite element code for Geodynamics.
http://www.underworldcode.org/
Other
168 stars 58 forks source link

heat flow boundary condition and heat flow calculation precision #448

Closed tingyang2004 closed 4 years ago

tingyang2004 commented 4 years ago

Hi all,

I am trying to apply zero heat flow boundary condition to the bottom boundary for cookbook 02_Convection_Example.ipynb in the example.

The setup is simply removing bottomWall from the Dirichlet boundary condition, that is, the temperature boundary condition is as below tempBC1 = uw.conditions.DirichletCondition( variable = temperatureField, indexSetsPerDof = (topWall,) )

I think this should do the work (please correct me if there is something I missed). The calculated heat flow at the bottom boundary with temperatureField.fn_gradient seems indeed smaller than heat flow at the top, but still far away from zero, as shown below.

download

I guess this might be related to the heat flow calculation precision as when I tried to reproduce the heat flow in Blankenbach 1989 benchmark, there is over 10% error for large Ra number models. Any comments on this? Thanks.

lmoresi commented 4 years ago

Here is a simple check: the same boundary conditions applies at the side walls and you can check how well the temperature-gradient method gives the heat flux.

On 9 Jan 2020, 00:40 -0700, tingyang2004 notifications@github.com, wrote:

Hi all,

I am trying to apply zero heat flow boundary condition to the bottom boundary for cookbook 02_Convection_Example.ipynb in the example.

The setup is simply removing bottomWall from the Dirichlet boundary condition, that is, the temperature boundary condition is as below tempBC1 = uw.conditions.DirichletCondition( variable = temperatureField, indexSetsPerDof = (topWall,) )

I think this should do the work (please correct me if there is something I missed). The calculated heat flow at the bottom boundary with temperatureField.fn_gradient seems indeed smaller than heat flow at the top, but still far away from zero, as shown below.

[image]https://user-images.githubusercontent.com/26615840/72047523-abdd3a00-32f5-11ea-8ae6-f8d261692222.png

I guess this might be related to the heat flow calculation precision as when I tried to reproduce the heat flow in Blankenbach 1989 benchmark, there is over 10% error for large Ra number models. Any comments on this? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld2/issues/448?email_source=notifications&email_token=ADABPI6CZKCJCJI7KLSNPUTQ43IFHA5CNFSM4KET4ETKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IE7GZPA, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADABPIZTHL6PKDLIWB4FGG3Q43IFHANCNFSM4KET4ETA.

jmansour commented 4 years ago

What you've done seems reasonable to me. Note that we will still have difficulties extracting gradients of fields, and that may colour your results. How are you calculating heat flow?

You might also like to try explicitly setting a Neumann condition, though it shouldn't make a difference I believe.

tingyang2004 commented 4 years ago

heat flux at the side boundary is one order smaller, possibly due to smaller lateral temperature variations, but still not zero. @lmoresi temp download (1)

I used temperature gradient to represent heat flux directly, assuming thermal conductivity equals to 1 @jmansour . dTdz_Bottom = uw.utils.Integral( fn=temperatureField.fn_gradient[1],
mesh=mesh, integrationType='Surface', surfaceIndexSet=mesh.specialSets["MinJ_VertexSet"])

HF_Bottom = - dTdz_Bottom.evaluate()[0]

Setting a Neumann condition explicitly gives the same result, ipynb attached below.

HeatFluxBC.ipynb.txt

tingyang2004 commented 4 years ago

I guess this is not a big problem if the Dirichlet BCs are used in the model since heat flux (and so is stress) only concerns about post-process of the model output, but it might arouse larger computational errors when the Neumann BCs (heat flow, or stress) are used?

lmoresi commented 4 years ago

There is a difference, of course, between the flux the model uses as a result of the boundary condition and the value you compute in post processing.

On 9 Jan 2020, 18:02 -0700, tingyang2004 notifications@github.com, wrote:

I guess this is not a big problem if the Dirichlet BCs are used in the model since heat flux (and so is stress) only concerns about post-process of the model output, but it might arouse larger computational errors when the Neumann BCs (heat flow, or stress) are used?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld2/issues/448?email_source=notifications&email_token=ADABPIYSA43UYZ3WG5UI2PTQ47CJPA5CNFSM4KET4ETKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEISKGFQ#issuecomment-572826390, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADABPI76REDL3GBJCTH2UGTQ47CJPANCNFSM4KET4ETA.

adambeall commented 4 years ago

I had a similar 'issue' a while ago, looking at internally-heated convection at steady-state, in this notebook.

At steady-state I was getting the integrated heat-loss through the insulating bottom+side boundaries as <10% of the integrated heat-flow from the conducting top boundary.

I thought it was mainly an issue of resolution, particularly when convection generates strong thermal gradients close to the boundaries, as occurs in your example. I think it becomes less prominent for a higher resolution, more realistic boundary layer thickness and keeping up/downwellings away from the walls with a wide aspect ratio and lower mantle.

I would be very interested if you reproduce the actual flux used in the calculation, as Louis suggests and the problem goes away.

tingyang2004 commented 4 years ago

Thanks, Adam. Nice example, the resolution is indeed important.

tingyang2004 commented 4 years ago

To further Adam's work on internal heating, I have tried to reproduce Balankenbach 1989 case 3 which has internal heating and an insulated bottom boundary. I found the calculated surface heat flow lost is 1/10 the total heat generation, will double-check it later.

lmoresi commented 4 years ago

I would consider it more important to understand how this converges with increasing resolution.

I found it necessary to use some gradient reconstruction strategies when I did convection benchmarks for the cylindrical cases. I wonder if Rohan Byrne has some code for this - if not we can dig my stuff up.

L On 10 Jan 2020, 01:05 -0700, tingyang2004 notifications@github.com, wrote:

To further Adam's work on internal heating, I have tried to reproduce Balankenbach 1989 case 3 which has internal heating and an insulated bottom boundary. I found the calculated surface heat flow lost is 1/10 the total heat generation, will double-check it later.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld2/issues/448?email_source=notifications&email_token=ADABPI3PJZD2WAK3SUA3APTQ5AT4DA5CNFSM4KET4ETKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEITA73Y#issuecomment-572919791, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADABPI2VHIW74LSSSRJEVRDQ5AT4DANCNFSM4KET4ETA.

tingyang2004 commented 4 years ago

For my case, all the benchmarks (constant viscosity, temperature- and depth- dependent viscosity, and internal heating) can be well reproduced for a resolution of 64 with less than a few percent error. so I will just stop here in exploring the influence of resolution at the moment.

lmoresi commented 4 years ago

Ok - simply remember that those resolution tests are equivalent to error bars in an experiment- you can’t really interpret model data without them.

On 11 Jan 2020, 01:16 -0700, tingyang2004 notifications@github.com, wrote:

For my case, all the benchmarks (constant viscosity, temperature- and depth- dependent viscosity, and internal heating) can be well reproduced for a resolution of 64 with less than a few percent error. so I will just stop here in exploring the influence of resolution at the moment.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld2/issues/448?email_source=notifications&email_token=ADABPI36HSHH5Z4GX7D4ZKTQ5F56BA5CNFSM4KET4ETKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIV4O2A#issuecomment-573294440, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADABPI4KPEFWRGYWMWRH66DQ5F56BANCNFSM4KET4ETA.

tingyang2004 commented 4 years ago

Definitely.