/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/sakura/sakura_io.c File Reference

#include "sakura.h"
#include "sakura_local.h"
#include <glib.h>
#include <utils/utils.h>
#include <sed/sed_sedflux.h>
#include <math.h>

Go to the source code of this file.

Functions

GQuark sakura_error_quark (void)
double ** sakura_wrapper (Sakura_bathy_st *b, Sakura_flood_st *f, Sakura_sediment_st *s, Sakura_const_st *c, gint *n_grains, gint *len)
Sakura_param_stsakura_scan_parameter_file (const gchar *file, GError **error)
Sakura_param_stsakura_check_params (Sakura_param_st *p, GError **error)
Sakura_bathy_stsakura_scan_bathy_file (const gchar *file, Sakura_param_st *p, GError **error)
Sakura_bathy_stsakura_update_bathy_data (Sakura_bathy_st *b, double **deposition, double **erosion, gint n_grains)
Sakura_bathy_stsakura_set_bathy_data (double **bathy, gint len, double dx, gint n_grains)
Sakura_bathy_stsakura_new_bathy_data (gint n_grains, gint len)
Sakura_bathy_stsakura_copy_bathy_data (Sakura_bathy_st *d, const Sakura_bathy_st *s)
Sakura_bathy_stsakura_destroy_bathy_data (Sakura_bathy_st *b)
Sakura_flood_st ** sakura_scan_flood_file (const gchar *file, Sakura_param_st *p, GError **error)
Sakura_flood_stsakura_set_flood_data (Sed_hydro h, double rho_river_water)
Sakura_flood_stsakura_sed_set_flood_data (Sed_hydro h, double rho_river_water)
Sakura_flood_stsakura_destroy_flood_data (Sakura_flood_st *f)
Sakura_sediment_stsakura_destroy_sediment_data (Sakura_sediment_st *s)
Sakura_sediment_stsakura_set_sediment_data (Sakura_param_st *p)
void sakura_set_width (Sakura_bathy_st *bathy_data, double river_width, double spreading_angle)
double sakura_settling_velocity (double rho_grain, double equiv_dia, double rho_river_water, double mu_river_water)
double sakura_reynolds_number (double rho_grain, double equiv_dia, double rho_river_water, double mu_river_water)
Sakura_const_stsakura_set_constant_data (Sakura_param_st *p, Sakura_bathy_st *b)
Sakura_const_stsakura_set_constant_output_data (Sakura_const_st *c, const gchar *file, gint *id, gint dt)
gint sakura_write_data (const gchar *file, Eh_dbl_grid deposit)
gint sakura_write_output (const gchar *file, Sakura_bathy_st *b, double **deposit, gssize n_grains)
void sakura_get_phe (Sakura_arch_st *data, double x, Sakura_phe_st *phe_data)
double sakura_add (Sakura_arch_st *data, double x, Sakura_cell_st *s)
double sakura_remove (Sakura_arch_st *data, double x, Sakura_cell_st *s)
double sakura_get_depth (Sakura_arch_st *data, double x)


Function Documentation

double sakura_add ( Sakura_arch_st data,
double  x,
Sakura_cell_st s 
)

Definition at line 928 of file sakura_io.c.

References Sakura_arch_st::b, Sakura_bathy_st::dep, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_require, Sakura_cell_st::id, Sakura_bathy_st::len, Sakura_cell_st::t, and Sakura_bathy_st::x.

Referenced by sakura_set_constant_data().

Sakura_param_st* sakura_check_params ( Sakura_param_st p,
GError **  error 
)

Definition at line 173 of file sakura_io.c.

References Sakura_param_st::bulk_density, Sakura_param_st::c_drag, Sakura_param_st::dep_start, Sakura_param_st::dt, Sakura_param_st::dx, Sakura_param_st::e_a, Sakura_param_st::e_b, eh_check_to_s(), eh_dbl_array_cmp_ge(), eh_dbl_array_each_ge(), eh_dbl_array_each_le(), eh_require, eh_return_val_if_fail, eh_set_error_strv(), Sakura_param_st::flow_fraction, Sakura_param_st::grain_density, Sakura_param_st::lambda, Sakura_param_st::mu_water, Sakura_param_st::n_grains, Sakura_param_st::rho_river_water, Sakura_param_st::rho_sea_water, SAKURA_ERROR, SAKURA_ERROR_BAD_PARAMETER, Sakura_param_st::sua, Sakura_param_st::sub, and Sakura_param_st::tan_phi.

Referenced by sakura_scan_parameter_file().

Sakura_bathy_st* sakura_copy_bathy_data ( Sakura_bathy_st d,
const Sakura_bathy_st s 
)

Definition at line 373 of file sakura_io.c.

References Sakura_bathy_st::dep, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_require, Sakura_bathy_st::len, Sakura_bathy_st::n_grains, sakura_new_bathy_data(), Sakura_bathy_st::slope, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by main().

Sakura_bathy_st* sakura_destroy_bathy_data ( Sakura_bathy_st b  ) 

Definition at line 400 of file sakura_io.c.

References Sakura_bathy_st::dep, Sakura_bathy_st::depth, eh_free, eh_free_2, Sakura_bathy_st::slope, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by sed_sakura().

Sakura_flood_st* sakura_destroy_flood_data ( Sakura_flood_st f  ) 

Definition at line 509 of file sakura_io.c.

References eh_free, and Sakura_flood_st::fraction.

Referenced by sed_sakura().

Sakura_sediment_st* sakura_destroy_sediment_data ( Sakura_sediment_st s  ) 

Definition at line 520 of file sakura_io.c.

References Sakura_sediment_st::bulk_density, eh_free, Sakura_sediment_st::grain_density, Sakura_sediment_st::lambda, Sakura_sediment_st::reynolds_no, Sakura_sediment_st::size_equiv, and Sakura_sediment_st::u_settling.

GQuark sakura_error_quark ( void   ) 

Definition at line 8 of file sakura_io.c.

double sakura_get_depth ( Sakura_arch_st data,
double  x 
)

Definition at line 1003 of file sakura_io.c.

References Sakura_arch_st::b, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_require, Sakura_bathy_st::len, and Sakura_bathy_st::x.

Referenced by sakura_set_constant_data().

void sakura_get_phe ( Sakura_arch_st data,
double  x,
Sakura_phe_st phe_data 
)

Get the grain size distribution of bottom sediments.

Get the fractions of each grain type of bottom sediments from a Sed_cube. This function is intended to be used within another program that needs to communicate with the sedflux architecture but is otherwise separate from sedflux.

Note that the member, eroded_depth may be changed to reflect the actual amount of bottom sediment available to be eroded. That is, we may be trying to erode more sediment than is actually present.

In this case, the data pointer should point to a Sakura_get_phe_t structure that contains the grain size distribution and the number of grains. This information is simply copied to the location pointed to by phe.

Parameters:
query_data The fraction of each grain type in the bottom sediments.
bed_data A structure that contains the necessary data for the function to retreive the grain type fracitons.
Returns:
A pointer to the array of grain type fractions.

Definition at line 901 of file sakura_io.c.

References eh_new, eh_require, Sakura_phe_st::n_grains, Sakura_arch_st::n_grains, Sakura_phe_st::phe, and Sakura_arch_st::phe.

Referenced by sakura_set_constant_data().

Sakura_bathy_st* sakura_new_bathy_data ( gint  n_grains,
gint  len 
)

Definition at line 350 of file sakura_io.c.

References Sakura_bathy_st::dep, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_new, eh_new_2, Sakura_bathy_st::len, Sakura_bathy_st::n_grains, Sakura_bathy_st::slope, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by sakura_copy_bathy_data().

double sakura_remove ( Sakura_arch_st data,
double  x,
Sakura_cell_st s 
)

Definition at line 972 of file sakura_io.c.

References Sakura_arch_st::b, Sakura_bathy_st::dep, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_require, Sakura_cell_st::id, Sakura_bathy_st::len, Sakura_cell_st::t, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by sakura_set_constant_data().

double sakura_reynolds_number ( double  rho_grain,
double  equiv_dia,
double  rho_river_water,
double  mu_river_water 
)

Definition at line 632 of file sakura_io.c.

References eh_require, G, log10, and sed_gravity().

Sakura_bathy_st* sakura_scan_bathy_file ( const gchar *  file,
Sakura_param_st p,
GError **  error 
)

Definition at line 237 of file sakura_io.c.

References Sakura_param_st::dx, eh_dlm_read_swap(), eh_free_2, eh_require, eh_return_val_if_fail, Sakura_param_st::n_grains, sakura_set_bathy_data(), and SAKURA_TEST_BATHY_FILE.

Referenced by main().

Sakura_flood_st** sakura_scan_flood_file ( const gchar *  file,
Sakura_param_st p,
GError **  error 
)

Definition at line 415 of file sakura_io.c.

References eh_free, eh_new0, eh_return_val_if_fail, Sakura_param_st::rho_river_water, sakura_set_flood_data(), SAKURA_TEST_FLOOD_FILE, sed_hydro_destroy(), and sed_hydro_scan().

Referenced by main().

Sakura_param_st* sakura_scan_parameter_file ( const gchar *  file,
GError **  error 
)

Definition at line 128 of file sakura_io.c.

References Sakura_param_st::dep_start, eh_dbl_array_mult(), eh_free, eh_key_file_scan_from_template(), eh_new, eh_return_val_if_fail, Sakura_param_st::lambda, Sakura_param_st::mu_water, Sakura_param_st::n_grains, S_DAYS_PER_SECOND, sakura_check_params(), SAKURA_TEST_PARAM_FILE, and Sakura_param_st::tan_phi.

Referenced by main().

Sakura_flood_st* sakura_sed_set_flood_data ( Sed_hydro  h,
double  rho_river_water 
)

Definition at line 475 of file sakura_io.c.

References Sakura_flood_st::depth, Sakura_flood_st::duration, eh_free, eh_new, Sakura_flood_st::fraction, Sakura_flood_st::n_grains, Sakura_flood_st::q, Sakura_flood_st::rho_flow, sed_hydro_depth(), sed_hydro_duration_in_seconds(), sed_hydro_flow_density(), sed_hydro_fraction(), sed_hydro_size(), sed_hydro_velocity(), sed_hydro_water_flux(), sed_hydro_width(), Sakura_flood_st::velocity, and Sakura_flood_st::width.

Referenced by sed_sakura().

Sakura_bathy_st* sakura_set_bathy_data ( double **  bathy,
gint  len,
double  dx,
gint  n_grains 
)

Definition at line 299 of file sakura_io.c.

References Sakura_bathy_st::dep, Sakura_bathy_st::depth, Sakura_bathy_st::dx, eh_new, eh_new_2, eh_require, eh_uniform_array(), interpolate(), Sakura_bathy_st::len, Sakura_bathy_st::n_grains, Sakura_bathy_st::slope, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by sakura_scan_bathy_file(), and sakura_set_bathy_data_from_cube().

Sakura_const_st* sakura_set_constant_data ( Sakura_param_st p,
Sakura_bathy_st b 
)

Definition at line 659 of file sakura_io.c.

References Sakura_const_st::add, Sakura_const_st::add_data, Sakura_arch_st::b, Sakura_param_st::bottom_fraction, Sakura_const_st::c_drag, Sakura_param_st::c_drag, Sakura_const_st::channel_len, Sakura_param_st::channel_len, Sakura_const_st::channel_width, Sakura_param_st::channel_width, Sakura_const_st::dep_start, Sakura_param_st::dep_start, Sakura_const_st::depth_data, Sakura_const_st::dt, Sakura_param_st::dt, Sakura_const_st::e_a, Sakura_param_st::e_a, Sakura_const_st::e_b, Sakura_param_st::e_b, eh_new, Sakura_const_st::get_depth, Sakura_const_st::get_phe, Sakura_const_st::get_phe_data, Sakura_const_st::mu_water, Sakura_param_st::mu_water, Sakura_arch_st::n_grains, Sakura_param_st::n_grains, Sakura_arch_st::phe, Sakura_const_st::remove, Sakura_const_st::remove_data, Sakura_const_st::rho_river_water, Sakura_param_st::rho_river_water, Sakura_const_st::rho_sea_water, Sakura_param_st::rho_sea_water, sakura_add(), sakura_get_depth(), sakura_get_phe(), sakura_remove(), Sakura_const_st::sua, Sakura_param_st::sua, Sakura_const_st::sub, Sakura_param_st::sub, Sakura_const_st::tan_phi, and Sakura_param_st::tan_phi.

Referenced by main().

Sakura_const_st* sakura_set_constant_output_data ( Sakura_const_st c,
const gchar *  file,
gint *  id,
gint  dt 
)

Definition at line 698 of file sakura_io.c.

References Sakura_const_st::data_fp, Sakura_const_st::data_id, Sakura_const_st::data_int, eh_fopen(), and eh_require.

Referenced by main().

Sakura_flood_st* sakura_set_flood_data ( Sed_hydro  h,
double  rho_river_water 
)

Definition at line 454 of file sakura_io.c.

References Sakura_flood_st::depth, Sakura_flood_st::duration, eh_new, Sakura_flood_st::fraction, Sakura_flood_st::n_grains, Sakura_flood_st::q, Sakura_flood_st::rho_flow, sed_hydro_depth(), sed_hydro_duration_in_seconds(), sed_hydro_flow_density(), sed_hydro_fraction(), sed_hydro_size(), sed_hydro_velocity(), sed_hydro_water_flux(), sed_hydro_width(), Sakura_flood_st::velocity, and Sakura_flood_st::width.

Referenced by sakura_scan_flood_file().

Sakura_sediment_st* sakura_set_sediment_data ( Sakura_param_st p  ) 

Definition at line 536 of file sakura_io.c.

References Sakura_sediment_st::bulk_density, Sakura_param_st::bulk_density, eh_dbl_array_dup(), eh_new, Sakura_param_st::flow_fraction, Sakura_sediment_st::grain_density, Sakura_param_st::grain_density, Sakura_sediment_st::lambda, Sakura_param_st::lambda, Sakura_param_st::n_grains, Sakura_sediment_st::n_grains, S_DAYS_PER_SECOND, S_SECONDS_PER_DAY, sed_removal_rate_to_settling_velocity(), and Sakura_sediment_st::u_settling.

Referenced by main().

void sakura_set_width ( Sakura_bathy_st bathy_data,
double  river_width,
double  spreading_angle 
)

Definition at line 574 of file sakura_io.c.

References Sakura_bathy_st::len, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by main(), and sed_sakura().

double sakura_settling_velocity ( double  rho_grain,
double  equiv_dia,
double  rho_river_water,
double  mu_river_water 
)

Definition at line 600 of file sakura_io.c.

References eh_require, eh_watch_dbl, G, log10, and sed_gravity().

Sakura_bathy_st* sakura_update_bathy_data ( Sakura_bathy_st b,
double **  deposition,
double **  erosion,
gint  n_grains 
)

Definition at line 274 of file sakura_io.c.

References Sakura_bathy_st::depth, Sakura_bathy_st::len, Sakura_bathy_st::slope, and Sakura_bathy_st::x.

double** sakura_wrapper ( Sakura_bathy_st b,
Sakura_flood_st f,
Sakura_sediment_st s,
Sakura_const_st c,
gint *  n_grains,
gint *  len 
)

Definition at line 49 of file sakura_io.c.

References Sakura_sediment_st::bulk_density, Sakura_bathy_st::depth, Sakura_flood_st::depth, Sakura_const_st::dt, Sakura_flood_st::duration, Sakura_bathy_st::dx, eh_free, eh_new, eh_require, Sakura_flood_st::fraction, Sakura_sediment_st::grain_density, Sakura_sediment_st::lambda, Sakura_bathy_st::len, Sakura_sediment_st::n_grains, Sakura_flood_st::rho_flow, sakura(), Sakura_sediment_st::u_settling, Sakura_flood_st::velocity, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by sakura_run_flood(), and sed_sakura().

gint sakura_write_data ( const gchar *  file,
Eh_dbl_grid  deposit 
)

Definition at line 722 of file sakura_io.c.

References eh_dbl_grid_data(), eh_grid_n_x(), eh_grid_n_y(), eh_open_file(), and eh_require.

Referenced by main().

gint sakura_write_output ( const gchar *  file,
Sakura_bathy_st b,
double **  deposit,
gssize  n_grains 
)

Definition at line 754 of file sakura_io.c.

References Sakura_bathy_st::depth, eh_open_file(), Sakura_bathy_st::len, Sakura_bathy_st::width, and Sakura_bathy_st::x.

Referenced by main().


Generated on Fri Jan 4 18:04:17 2008 for sedflux by  doxygen 1.5.2