# Electrostatic Application Global Files

(Difference between revisions)
 Revision as of 11:34, 4 February 2010 (view source)JMora (Talk | contribs) (→Electrostatic Application Kratos Variables)← Older edit Latest revision as of 11:45, 4 February 2010 (view source)JMora (Talk | contribs) (→Electrostatic Application Kratos Variables) (12 intermediate revisions by one user not shown) Line 22: Line 22: The Kratos name for the variables of interest in our Electrostatic application are: The Kratos name for the variables of interest in our Electrostatic application are: − {| + ::{| cellpadding="10" cellspacing="0" border="1" − |- + |-style="height:50px" | ELECTRICAL_PERMITTIVITY | ELECTRICAL_PERMITTIVITY | $\mathbf{\varepsilon} \,$ | $\mathbf{\varepsilon} \,$ − |- + |-style="height:50px" | ELECTROSTATIC_POTENTIAL | ELECTROSTATIC_POTENTIAL | the unknowns, $\mathbf{a} \qquad \left ( \hat V (x,y,z) = \mathbf{N} \mathbf{a}^{(e)} \right )$ | the unknowns, $\mathbf{a} \qquad \left ( \hat V (x,y,z) = \mathbf{N} \mathbf{a}^{(e)} \right )$ − |- + |-style="height:50px" | ELECTROSTATIC_POINT_CHARGE | ELECTROSTATIC_POINT_CHARGE | $Q = \int_{\Omega} \rho_V \partial \Omega$ | $Q = \int_{\Omega} \rho_V \partial \Omega$ − |- + |-style="height:50px" | ELECTROSTATIC_SURFACE_CHARGE | ELECTROSTATIC_SURFACE_CHARGE − | $\rho_S \,$ + | $\rho_S \frac{}{}$ − |- + |-style="height:50px" | ELECTROSTATIC_VOLUME_CHARGE | ELECTROSTATIC_VOLUME_CHARGE − | $\rho_V \,$ + | $\rho_V \frac{}{}$ − |- + |-style="height:50px" | ELECTRIC_FIELD | ELECTRIC_FIELD − | $\mathbf{E}$ + | $\mathbf{E} \frac{}{}$ − |- + |-style="height:50px" | ELECTRIC_DISPLACEMENT_FIELD | ELECTRIC_DISPLACEMENT_FIELD − | $\mathbf{D}=\mathbf{\varepsilon} \mathbf{E}$ + | $\mathbf{D}=\mathbf{\varepsilon} \mathbf{E} \frac{}{}$ − |- + |-style="height:50px" | INFINIT_COEFFICIENT | INFINIT_COEFFICIENT | indicates if the infinit condition is applied | indicates if the infinit condition is applied Line 63: Line 63: KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE) KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE) KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_VOLUME_CHARGE) KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_VOLUME_CHARGE) − KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD) KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD) KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD) KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT) KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT)

## Basic Kratos Directory Tree

After installing successfully Kratos, you should have a directory's tree like this (minor changes are allowed, such as the location of the python files, etc):

/kratos
/.svn
/applications
/benchmarking
/Debug
/external_libraries
/kratos
/libs
/problemtype_generator
/Release


Our main working directory will be our specific application's directory (to be created), in the applications subdirectory. Nevertheless, the rest of the structure is presented to indicate where are located other important files to work with Kratos.

## Electrostatic Application Kratos Variables

The Kratos name for the variables of interest in our Electrostatic application are:

 ELECTRICAL_PERMITTIVITY $\mathbf{\varepsilon} \,$ ELECTROSTATIC_POTENTIAL the unknowns, $\mathbf{a} \qquad \left ( \hat V (x,y,z) = \mathbf{N} \mathbf{a}^{(e)} \right )$ ELECTROSTATIC_POINT_CHARGE $Q = \int_{\Omega} \rho_V \partial \Omega$ ELECTROSTATIC_SURFACE_CHARGE $\rho_S \frac{}{}$ ELECTROSTATIC_VOLUME_CHARGE $\rho_V \frac{}{}$ ELECTRIC_FIELD $\mathbf{E} \frac{}{}$ ELECTRIC_DISPLACEMENT_FIELD $\mathbf{D}=\mathbf{\varepsilon} \mathbf{E} \frac{}{}$ INFINIT_COEFFICIENT indicates if the infinit condition is applied

The variables must be defined, created and registered in the variables.h file in the kratos\kratos\includes directory and in the variables.cpp file in the kratos\kratos\sources directory (see How_to_Add_a_variable).

In variables.h, check if the following lines are included (if not, please include them):

	// for electromagnetic applications
// for kElectrostatic application

KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY)
KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_POTENTIAL)
KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_POINT_CHARGE)
KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE)
KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_VOLUME_CHARGE)
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD)
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD)
KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT)



In variables.cpp, check if the following lines are included (if not, please include them):

	// for electromagnetic applications
// for kElectrostatic application

KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY)
KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_POTENTIAL)
KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_POINT_CHARGE)
KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE)
KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_VOLUME_CHARGE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD)
KRATOS_CREATE_VARIABLE(double, INFINIT_COEFFICIENT)


and:

	// for electromagnetic applications
// for kElectrostatic application

KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY)
KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_POTENTIAL)
KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_POINT_CHARGE)
KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_SURFACE_CHARGE)
KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_VOLUME_CHARGE)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD)
KRATOS_REGISTER_VARIABLE(INFINIT_COEFFICIENT)


## The files' structure for the Electrostatic Kratos application

In the /Kratos/applications directory you have to create a new directory (called "kElectrostatic"). You have to create a set of custom directories for your application (basically /custom_conditions, /custom_elements, /custom_python, /python_scripts and /test_examples):

/Kratos
/applications
/kElectrostatic
/custom_conditions
/custom_elements
/custom_python
/python_scripts
/test_examples


Each of these subdirectories will contain the specific C++ or python code needed for our application. We will focus our attention in using our customised element, therefore, the other needed code will be, simply, copied from other already existing applications.

Note that if you want to use a new strategy or solver, then you have to create other typical customisation directories or files such as /custom_strategies, etc...