|
|
|
|
|
# Run Hydro
|
|
|
|
|
|
|
|
|
|
|
|
# Run Tracer
|
|
|
|
|
|
## Online
|
|
|
Running the tracer online request running the hydrodynamic at the same time
|
|
|
|
|
|
In the same python file as Run Hydro:
|
|
|
|
|
|
Create the Tracer equation
|
|
|
'''python
|
|
|
eqTracer = slim.ShallowWaterTracer2d(domain, "implicit",eq, name="tracer", offline = False, initial_time=initial_time, final_time=final_time)
|
|
|
'''
|
|
|
Import the tracer initial condition from the file created in pre-processing
|
|
|
'''python
|
|
|
eqTracer.set_initial_condition(pre_data_dir+"/tracer/tracer.idx")
|
|
|
'''
|
|
|
Set the diffusivity model used
|
|
|
'''python
|
|
|
eqTracer.set_diffusivity("okubo")
|
|
|
'''
|
|
|
Add the boundary condition
|
|
|
'''python
|
|
|
eqTracer.set_boundary_coast("Wall")
|
|
|
'''
|
|
|
Compute the total mass of tracer in the domain
|
|
|
'''python
|
|
|
eqTracer.compute_mass("tracer.dat")
|
|
|
'''
|
|
|
## Offline
|
|
|
Running the tracer offline is much quicker than online. It request the output file from a hydrodynamic run with the option '''export_every_sub_time_step'''
|
|
|
|
|
|
Path to the pre-processing file
|
|
|
'''python
|
|
|
pre_data_dir_base = param.data_dir+'_'+slimPre.partition_nb()+'/'
|
|
|
pre_data_dir = pre_data_dir_base+slimPre.partition_id()+'/'
|
|
|
'''
|
|
|
|
|
|
Import mesh info in python
|
|
|
'''python
|
|
|
mesh = slimPre.Mesh( pre_data_dir+"mesh.msh", mesh_proj='+proj=utm +ellps=WGS84 +zone=17')
|
|
|
'''
|
|
|
|
|
|
Create the domain (it has to be the same as the one used for the hydro equation
|
|
|
'''python
|
|
|
domain = slim.Domain(param.mesh,pre_data_dir_base+param.bathy_acc+"/"+param.bathy_acc+".idx", g=(pre_data_dir+"gravity.nc","gravity"), density=param.rho)
|
|
|
'''
|
|
|
Create the Tracer equation
|
|
|
'''python
|
|
|
eqTracer = slim.ShallowWaterTracer2d(domain, "implicit","output_offline/", name="tracer", offline = True, initial_time=param.initial_time, final_time=param.final_time)
|
|
|
'''
|
|
|
Import the tracer initial condition from the file created in pre-processing
|
|
|
'''python
|
|
|
eqTracer.set_initial_condition(pre_data_dir+"/tracer/tracer.idx")
|
|
|
'''
|
|
|
Set the diffusivity model used
|
|
|
'''python
|
|
|
eqTracer.set_diffusivity("okubo")
|
|
|
'''
|
|
|
Add the boundary condition
|
|
|
'''python
|
|
|
eqTracer.set_boundary_coast("Wall")
|
|
|
'''
|
|
|
Compute the total mass of tracer in the domain
|
|
|
'''python
|
|
|
eqTracer.compute_mass("tracer.dat")
|
|
|
''' |