underworldcode / UWGeodynamics

Underworld Geodynamics
Other
81 stars 32 forks source link

temperature gradient before model initialisation does not work #148

Closed HanyMKhalil closed 5 years ago

HanyMKhalil commented 5 years ago

Dear Romain, I tried a function to adjust the geothermal gradient manually, however it works perfectly when I put it after the model initialisation, however if I put it after the set temperature BC just before the model initialisation it has no effect at all and does not work? what might cause this? is there a difference?

here are the lines:

Model.set_temperatureBCs(top=293.15 u.degK, bottom=1643.15 u.degK, materials=[(mantle, 1643.15 u.degK), (air, 293.15 u.degK )])

Model.init_model()

Model.temperature.data[index] = 0.

for index, coord in enumerate(Model.mesh.data):

if coord[1] >= 0.:
    T = 293.15 * u.kelvin

elif coord[0] < GEO.nd(126. *u.kilometer) and (coord[1] <= 0. and coord[1] >= GEO.nd(-90. *u.kilometer)):
     T = (293.15 * u.kelvin + (-1*GEO.dim(coord[1], u.kilometer) * (1350/90) * u.kelvin/u.kilometer))
elif coord[0] < GEO.nd(126. *u.kilometer) and coord[1] <= GEO.nd(-90. *u.kilometer):
    T = 1643.15 * u.kelvin

elif (coord[0] > GEO.nd(126. *u.kilometer)  and coord[0] < GEO.nd(130. *u.kilometer)) and (coord[1] <= 0. and coord[1] >= GEO.nd(-75. *u.kilometer)):
    T = (293.15 * u.kelvin + (-1*GEO.dim(coord[1], u.kilometer) * (1350/75) * u.kelvin/u.kilometer))
elif (coord[0] > GEO.nd(126. *u.kilometer)  and coord[0] < GEO.nd(130. *u.kilometer)) and coord[1] <= GEO.nd(-75. *u.kilometer):
    T = 1643.15 * u.kelvin

elif coord[0] > GEO.nd(130. *u.kilometer) and (coord[1] <= 0. and coord[1] >= GEO.nd(-90. *u.kilometer)):
     T = (293.15 * u.kelvin + (-1*GEO.dim(coord[1], u.kilometer) * (1350/90) * u.kelvin/u.kilometer))
elif coord[0] > GEO.nd(130. *u.kilometer) and coord[1] <= GEO.nd(-90. *u.kilometer):
    T = 1643.15 * u.kelvin

Model.temperature.data[index] = GEO.nd(T)