Simulations

Name

Simulations -- 

Synopsis


#include <gfs.h>


#define             GFS_SIMULATION_CLASS                (klass)
#define             GFS_SIMULATION                      (obj)
#define             GFS_IS_SIMULATION                   (obj)

                    GfsSimulationClass;
                    GfsSimulation;
                    GfsTime;
                    GfsPhysicalParams;

void                gfs_init                            (int *argc,
                                                         char ***argv);
GfsSimulationClass* gfs_simulation_class                (void);
GfsSimulation*      gfs_simulation_new                  (GfsSimulationClass *klass);
GfsSimulation*      gfs_simulation_read                 (GtsFile *fp);
void                gfs_simulation_refine               (GfsSimulation *sim);
void                gfs_simulation_set_timestep         (GfsSimulation *sim);
void                gfs_simulation_adapt                (GfsSimulation *simulation);
void                gfs_simulation_write                (GfsSimulation *sim,
                                                         gint max_depth,
                                                         FILE *fp);
void                gfs_simulation_run                  (GfsSimulation *sim);
#define             gfs_object_simulation               (o)
void                gfs_time_init                       (GfsTime *t);
void                gfs_time_read                       (GfsTime *t,
                                                         GtsFile *fp);
void                gfs_time_write                      (GfsTime *t,
                                                         FILE *fp);
void                gfs_physical_params_init            (GfsPhysicalParams *p);
void                gfs_physical_params_read            (GfsPhysicalParams *p,
                                                         GfsDomain *domain,
                                                         GtsFile *fp);
void                gfs_physical_params_write           (GfsPhysicalParams *p,
                                                         FILE *fp);

Description

Details

GFS_SIMULATION_CLASS()

#define             GFS_SIMULATION_CLASS(klass)

klass :


GFS_SIMULATION()

#define             GFS_SIMULATION(obj)

obj :


GFS_IS_SIMULATION()

#define             GFS_IS_SIMULATION(obj)

obj :


GfsSimulationClass

typedef struct {
  GfsDomainClass parent_class;

  void (* run) (GfsSimulation *);
} GfsSimulationClass;


GfsSimulation

typedef struct {
  GfsDomain parent;

  GfsTime time;
  GfsPhysicalParams physical_params;

  GfsMultilevelParams projection_params;
  GfsMultilevelParams approx_projection_params;

  GfsAdvectionParams advection_params;

  GtsSListContainer * refines;

  GtsSListContainer * adapts;
  GfsAdaptStats adapts_stats;

  GtsSListContainer * events, * maps;
  GSList * modules, * globals;

  GtsSListContainer * solids;
  guint thin;
  gboolean output_solid;

  gboolean deferred_compilation;

  gdouble tnext;
} GfsSimulation;


GfsTime

typedef struct {
  gdouble t, start, end;
  guint i, istart, iend;
  gdouble dtmax;
} GfsTime;


GfsPhysicalParams

typedef struct {
  gdouble L, g;
  GfsFunction * alpha;
} GfsPhysicalParams;


gfs_init ()

void                gfs_init                            (int *argc,
                                                         char ***argv);

Initializes the Gerris library. This function must be called before any other function of the library.

argc :

a pointer on the number of command line arguments passed to the program.

argv :

a pointer on the command line arguments passed to the program.


gfs_simulation_class ()

GfsSimulationClass* gfs_simulation_class                (void);

Returns :


gfs_simulation_new ()

GfsSimulation*      gfs_simulation_new                  (GfsSimulationClass *klass);

klass :

Returns :


gfs_simulation_read ()

GfsSimulation*      gfs_simulation_read                 (GtsFile *fp);

Reads a simulation file from fp.

fp :

a GtsFile.

Returns :

the GfsSimulation or NULL if an error occured, in which case the pos and error fields of fp are set.


gfs_simulation_refine ()

void                gfs_simulation_refine               (GfsSimulation *sim);

Calls the @refine() methods of the GfsRefine of sim. Matches the boundaries by calling gfs_domain_match().

sim :

a GfsSimulation.


gfs_simulation_set_timestep ()

void                gfs_simulation_set_timestep         (GfsSimulation *sim);

Sets the time step for the next iteration of sim using the CFL (computed using gfs_domain_cfl()), the stability conditions for source terms and taking into account the timings of the various GfsEvent associated to sim.

More precisely, the time step is adjusted (if necessary) so that the time of the closest event is exactly reached after the iteration.

sim :

a GfsSimulation.


gfs_simulation_adapt ()

void                gfs_simulation_adapt                (GfsSimulation *simulation);

Checks if any mesh adaptation is necessary and adapts the mesh using an OR combination of all the regular criteria defined in simulation->adapts.

If any one or several criteria are defined as "not" refinements, the mesh will be refined only if all of this criteria AND any other regular criterion is verified.

simulation :

a GfsSimulation.


gfs_simulation_write ()

void                gfs_simulation_write                (GfsSimulation *sim,
                                                         gint max_depth,
                                                         FILE *fp);

Writes in fp a text representation of sim. If max_depth is smaller or equal to -2, no cell tree data is written.

sim :

a GfsSimulation.

max_depth :

the maximum depth at which to stop writing cell tree data (-1 means no limit).

fp :

a file pointer.


gfs_simulation_run ()

void                gfs_simulation_run                  (GfsSimulation *sim);

Runs sim.

sim :

a GfsSimulation.


gfs_object_simulation()

#define              gfs_object_simulation(o)     GFS_SIMULATION(GTS_OBJECT (o)->reserved)

o :


gfs_time_init ()

void                gfs_time_init                       (GfsTime *t);

Initializes the time structure t with default values.

t :

the GfsTime.


gfs_time_read ()

void                gfs_time_read                       (GfsTime *t,
                                                         GtsFile *fp);

Reads a time structure from fp and puts it in t.

t :

the GfsTime.

fp :

the GtsFile.


gfs_time_write ()

void                gfs_time_write                      (GfsTime *t,
                                                         FILE *fp);

Writes in fp a text representation of the time structure t.

t :

the time structure.

fp :

a file pointer.


gfs_physical_params_init ()

void                gfs_physical_params_init            (GfsPhysicalParams *p);

Initializes the physical parameters structure p with default values.

p :

the GfsPhysicalParams.


gfs_physical_params_read ()

void                gfs_physical_params_read            (GfsPhysicalParams *p,
                                                         GfsDomain *domain,
                                                         GtsFile *fp);

Reads a physical parameters structure from fp and puts it in p.

p :

the GfsPhysicalParams.

domain :

a GfsDomain.

fp :

the GtsFile.


gfs_physical_params_write ()

void                gfs_physical_params_write           (GfsPhysicalParams *p,
                                                         FILE *fp);

Writes in fp a text representation of the physical parameters structure p.

p :

the physical parameters structure.

fp :

a file pointer.