• The added line is THIS COLOR.
  • The deleted line is THIS COLOR.
* Tutorial [#f5c9dfdb]
#freeze
* How to simulate [#f5c9dfdb]

** Normal simulation procedure [#le4c697d]
** To perform normal simulation [#le4c697d]

- Obtain an appropriate sample UDF file for your purpose from our examples.

- Start "Gourmet" and open the UDF file. Modify it for your own purpose and save it as "input.udf".
- Start GOURMET and open the UDF file. Modify it for your own purpose and save it as "input.udf".

- Run KAPSEL as follows. (remove "./" if you use Windows command prompt)

    > ./kapsel -Iinput.udf -Ooutput.udf -Ddefine.udf -Rrestart.udf
    > ./kapsel -Iinput.udf -Ooutput.udf -Ddefine_2.10.udf -Rrestart.udf

-- "-I" option defines the name of UDF file which contains details of simulation (type of simulation, initial conditions, physical and simulation parameters, etc...).
-- "-O" option defines the name of UDF file which contains the results (time-dependent positions and velocities of all the particles, etc...) of the simulation.
-- "-D" option defines the name of UDF file which contains definitions of KAPSEL data dormat. This is common for any simulations.
-- "-R" option defines the name of UDF file which contains values of all dynamical variables at the end of the simulation See "Re-start run" below.
-- "''-I''" option defines the name of UDF file which contains details of simulation (type of simulation, initial conditions, physical and simulation parameters, etc...).
-- "''-O''" option defines the name of UDF file which contains the results (time-dependent positions and velocities of all the particles, etc...) of the simulation.
-- "''-D''" option defines the name of UDF file which contains definitions of KAPSEL data dormat. This is common for any simulations.
-- "''-R''" option defines the name of UDF file which contains values of all dynamical variables at the end of the simulation See "Re-start run" below.
-- Field data (fluid velocities, ionic densitied, etc...) is saved in a subdirectory specified in "input.udf" if "output.AVS" = "on". This requires huge disk space (GB order). No field data is saved if "output.AVS" = "off".

- Start "Gourmet" and open "output.udf". 
-- Instantaneous  positions and velocities of all the particles can be seen as variables in "Particles[]". Use slide bar at the bottom of Gourmet window to see variables at different time steps.
- Start GOURMET and open "output.udf". 
-- Instantaneous  positions and velocities of all the particles can be seen as variables in "Particles[]". Use slide bar at the bottom of GOURMET viewer window to see variables at different time steps.
-- Load "plot.py" to plot time evolutions of the variables. ([[See STEP4>InstallB]])
-- Load "particleshow.py" to visualize motions of particles. ([[See STEP4>InstallB]])

** To re-start previous simulation  [#u7810c9a]

** Re-start run  [#u7810c9a]

- One can re-start simulations from the end of the previous run.

- Start "Gourmet", and open "restart.udf"
- Start GOURMET, and open "restart.udf"

- Set "resume.Calculation" = "CONTINUE"

- Increase "output.Num_step", and save it as "input2.udf"

- Run KAPSEL as follows.  (remove "./" if you use Windows command prompt)

    > ./kapsel -Iinput2.udf -Ooutput2.udf -Ddefine.udf -Rrestart2.udf
    > ./kapsel -Iinput2.udf -Ooutput2.udf -Ddefine_2.10.udf -Rrestart2.udf

** UDF file [#t734b792]
** To analyze simulation data [#hcc313c6]

- UDF is a text file. One can browse and edit it using a text editor, but it.can be more easily handled with "Gourmet".
- The history of simulation run (instantaneous positions and velocities of particles) is stored in "output.udf". One can access to this file by one of the following methods.

- First, choose the type of problem you want to simulate by selecting "constitutive_eq" from the following.
-- Navier_Stokes:
-- Shear_Navier_Stokes:
-- Electrolyte:
-- Python program. Read the manual below.
--- English: &ref(pythoninterface_eng.pdf); 
--- Japanese: &ref(PythonInterface_jpn.pdf);
--- &ref(sk.py); is a sample python script to calculate the static structure factor S(k) from the temporal particle positions stored in "output.udf". Read and edit the script for your purpose. 
 - For Windows
   "Start Menu" > "All Programs" > "OCTA2007" > "StartGourmetTerm"
   > python sk.py  (sample only, can be abnormally terminated)

- Then, set the other parameters as you want.
-- Fortran or C program with libplatform (library to access UDF). Read the manual below.
--- English: &ref(Install/libplatform_eng.pdf);
--- Japanese: &ref(Install/libplatform_jpn.pdf);

 - constitutive_eq
   - type: {Navier_Stokes, Shear_Navier_Stokes, Electrolyte}
   - Navier_Stokes
      - DX
      - RHO
      - ETA
      - kBT
      - alpha_v
      - alpha_o
   - Shear_Navier_Stokes
      - DX
      - RHO
      - ETA
      - kBT
      - alpha_v
      - alpha_o
      - External_field
         - type: {DC, AC}
         - DC
             - shear_rate
         - AC
            - shear_rate
   - Electrolyte
      - DX
      - RHO
      - ETA
      - kBT
      - Dielectric_cst
      - INIT_profile
      - Add_salt
         - type: {salt, saltfree}
         - salt
            - Valency_positive_ion
            - Valency_negative_ion
            - Onsager_coeff_positive_ion
            - Onsager_coeff_negative_ion
            - Debye_length
         - saltfree
            - Valency_counterion
            - Onsager_coeff_counterion
      - Electric_field
         - type: {ON, OFF}
         - ON
            - type: {DC, AC}
            - DC
               - Ex
               - Ey
               - Ez
            - AC
               - Ex
               - Ey
               - Ez
               - Frequency
- KAPSEL outputs some important data to stderr. It usually appears in command line, but one can redirect stderr to a file on csh and tcsh
 > ./kapsel  -Iinput2.udf -Ooutput2.udf -Ddefine_2.10.udf -Rrestart2.udf >& out1
or on sh, bash, and Windows command prompt
 # ./kapsel  -Iinput2.udf -Ooutput2.udf -Ddefine_2.10.udf -Rrestart2.udf  2> out1

&br;
 - object_type
   - type: {spherical_particle, chain}
   - spherical_particle
      - Particle_spec[]
         - Particle_spec[0]
            - Particle_number
            - MASS_RATIO
            - Surface_charge
   - chain
      - Chain_spec[]
         - Chain_spec[]
            - Beads_number
            - Chain_number
            - MASS_RATIO
            - Surface_charge

&br;


** Python programing on Gourmet [#hcc313c6]