![]() | ![]() | ![]() | Gerris Flow Solver Reference Manual | ![]() |
---|
#include <gfs.h> #define GFS_SIMULATION_CLASS (klass) #define GFS_SIMULATION (obj) #define GFS_IS_SIMULATION (obj) struct GfsSimulationClass; struct GfsSimulation; struct GfsTime; struct 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_event_init (GfsSimulation *sim,GSList *events);void gfs_simulation_set_timestep (GfsSimulation *sim);void gfs_simulation_event (GfsSimulation *sim,GSList *events);void gfs_simulation_adapt (GfsSimulation *simulation,GfsAdaptStats *s);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,GtsFile *fp);void gfs_physical_params_write (GfsPhysicalParams *p,FILE *fp);
struct GfsSimulationClass { GfsDomainClass parent_class; void (* run) (GfsSimulation *); };
struct GfsSimulation { GfsDomain parent; GfsTime time; GfsPhysicalParams physical_params; GfsMultilevelParams projection_params; GfsMultilevelParams approx_projection_params; GfsAdvectionParams advection_params; GfsMultilevelParams diffusion_params; GtsSurface * surface; GNode * stree; gboolean is_open; GtsSurface * interface; GNode * itree; gboolean i_is_open; GtsSListContainer * refines; GtsSListContainer * adapts; GfsAdaptStats adapts_stats; GtsSListContainer * events; GSList * modules; GSList * variables; gdouble tnext; };
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. |
GfsSimulation* gfs_simulation_read (GtsFile *fp);
Reads a simulation file from fp.
fp : | a |
Returns : | the GfsSimulation or NULL if an error occured, in which case the pos and error fields of fp are set. |
void gfs_simulation_refine (GfsSimulation *sim);
Calls the @refine()
gfs_domain_match()
.
sim : |
void gfs_simulation_event_init (GfsSimulation *sim,GSList *events);
Initalizes the events associated with sim. In particular, all the "init" events are activated by this function.
sim : | |
events : | a list of GfsEvent. |
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()
) 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 : |
void gfs_simulation_event (GfsSimulation *sim,GSList *events);
Checks if any event associated with sim must be activated and activates it if necessary.
sim : | |
events : | a list of GfsEvent. |
void gfs_simulation_adapt (GfsSimulation *simulation,GfsAdaptStats *s);
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 : | |
s : | where to put statistics (or NULL). |
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 : | |
max_depth : | the maximum depth at which to stop writing cell tree data (-1 means no limit). |
fp : | a file pointer. |
void gfs_time_init (GfsTime *t);
Initializes the time structure t with default values.
t : | the GfsTime. |
void gfs_time_read (GfsTime *t,GtsFile *fp);
Reads a time structure from fp and puts it in t.
t : | the GfsTime. |
fp : | the |
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. |
void gfs_physical_params_init (GfsPhysicalParams *p);
Initializes the physical parameters structure p with default values.
p : | the GfsPhysicalParams. |
void gfs_physical_params_read (GfsPhysicalParams *p,GtsFile *fp);
Reads a physical parameters structure from fp and puts it in p.
p : | the GfsPhysicalParams. |
fp : | the |
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. |
<<< Simulations, initialisations, events | Refinements >>> |