Welcome, Guest
Username: Password: Remember me

TOPIC: Define thermocline by depth

Define thermocline by depth 7 years 3 months ago #27616

  • Schmirre
  • Schmirre's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Thank you received: 1
Hello friends!

I've been looking around for a while on the forum to find good solutions for starting a simulation with a nice thermocline.

I am modelling a deep lake (130m) with 11 layers, sigma on the top and bottom. Is it possible to define temperature for a layer, or even better, for specified depths? Of course vertical diffusion will change the temperatures, but at least it's a good start!

I found something similar:

www.opentelemac.org/index.php/community-...e-by-depth-not-layer

But don't really know how to use this informations!

Cheers, schmirre
The administrator has disabled public write access.

Define thermocline by depth 7 years 3 months ago #27618

  • Schmirre
  • Schmirre's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Thank you received: 1
With limited fortran knowledge, I tried something like this in condim.f:

IF(IPLAN.EQ.5) THEN
IF(ITRAC.EQ.1) THEN
TRACER=20.D0
END IF
END IF

But of course TRACER is not a variable in this script, so how do i define the tracer value?
The administrator has disabled public write access.

Define thermocline by depth 7 years 3 months ago #27620

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Hello Schmirre,

You'll have to code something, but it's quite simple for a start. No deep fortran knowledge needed.

First things to note:
The variable MESH3D%Z%R holds the elevation of each 3D mesh node.
The variable TA%ADR(ITRAC)%P%R holds the value of the tracer n° ITRAC at each 3D mesh node.

So first you'll have to know what is the number of the tracer that corresponds to the temperature (as you defined in the steering file).

Then you'll need to define the depth thresholds of temperature.

Let's say, for an example, that the temperature is in tracer n° 2 and that I want 10°C for points below 10 m depth, and 20°C for everything else. The code would be something like this:
DO IP = 1,NPOIN ! LOOPING THROUGH ALL THE MESH NODES
! IF ( THE DEPTH IS  LESS THAN -10 M) THEN
  IF ( MESH3D%Z%R(IP)  .LT.  -10.D0 ) THEN
!   THE TRACER 2 OF THE NODE IP IS 10°C
    TA%ADR(2)%P%R(IP) = 10.D0
! OTHERWISE
  ELSE
!   THE TRACER 2 OF THE NODE IP IS 20°C
    TA%ADR(2)%P%R(IP) = 20.D0
  ENDIF
ENDDO

This may throw an error because you user the variable IP without declaring it, then just add "INTEGER :: IP" to the declaration section of the code.

This is a simple example with a hard limit between layers. You could embellish this code to make a vertical gradient of temperature according to the depth. Just an idea ;)

Hope this helps.

Regards,

Phelype
The administrator has disabled public write access.
The following user(s) said Thank You: Schmirre

Define thermocline by depth 7 years 2 months ago #27623

  • Schmirre
  • Schmirre's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Thank you received: 1
Thanks a lot Phelype for the beginners guide!

But since condim.f is loaded before the simulation starts and the keyword 'INITIAL VALUES OF TRACERS' is implemented, the predefined temperature profile is overrided.

Any ideas on how to deal with this?

Thanks again, schmirre
The administrator has disabled public write access.

Define thermocline by depth 7 years 2 months ago #27625

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Schmirre,

Actually, the keyword "INITIAL VALUES OF TRACERS" takes effect only in condim.f, specifically at the line "CALL OS( 'X=C ', X=TA%ADR(I)%P, C=TRAC0(I))". So anything you put after it will take effect for the rest of the simulation.

Look, for example, at the test case "lock-exchange". There the salinity profile is modified based on the X coordinates of the mesh. Very similar to what you want to do (and similar to the code snippet I posted before).

Also, I changed a little the fortran file of this test case just to make sure it works. I modified it so the salinity is prescribed with a value equal to the depth, only when X is smaller than 15 (attachment, line 286-292). Just replace the fortran file in the "lock-exchange" test case and run it to see the effect.



PL,

I checked to see if what you suggested would be a problem, but in condim.f the "MESH3D%Z%R" is already initialized.

But your suggestion could also be useful.


Regards,

Phelype


File Attachment:

File Name: t3d_lock-exchange.f
File Size: 10 KB
The administrator has disabled public write access.
The following user(s) said Thank You: Schmirre

Define thermocline by depth 7 years 2 months ago #27624

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 584
  • Thank you received: 106
Hello here!

I was also wondering about such a thing in the past.

The question is if you can use MESH3D%Z%R since the tracer profile needs to be specified in subroutine condim, just after the step where you specify your vertical mesh transformation. I never tried it but it wouldn't suprise me if MESH3D%Z%R is still empty while executing the condim subroutine.

In the end I only did something simple by specifying each temp and salt values at each plane but if you use MESH TRANSFORMATION = 3 with specified elevations at each plane you could introduce a formula using the plane elevation at each plane ZPLANE%R(iplan) in condim.

Good luck!
PL
The administrator has disabled public write access.
The following user(s) said Thank You: Schmirre

Define thermocline by depth 4 years 3 months ago #36539

  • rosparsw
  • rosparsw's Avatar
Hello,

Could you share your fortran file if you still have it ?


Regards

William
The administrator has disabled public write access.
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.