# Magnetostatic Application Global Files

(Difference between revisions)
 Revision as of 10:34, 2 February 2010 (view source)JMora (Talk | contribs) (New page: == 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, ...) Latest revision as of 10:42, 3 February 2010 (view source)JMora (Talk | contribs) (→Magnetostatic Application Kratos Variables) (One intermediate revision by one user not shown) Line 24: Line 24: {| {| |- |- − | MAGNETIC PERMEABILITY + | MAGNETIC_PERMEABILITY | $\mathbf{D}=\frac{1}{\mathbf{\mu}} \,$ | $\mathbf{D}=\frac{1}{\mathbf{\mu}} \,$ |- |- Line 31: Line 31: |- |- | MAGNETOSTATIC_POINT_CURRENT | MAGNETOSTATIC_POINT_CURRENT − | $J_q = \int_S \J_S \partial S$ + | $J_q = \int_S J_S \partial S$ |- |- | MAGNETOSTATIC_SURFACE_CURRENT    | MAGNETOSTATIC_SURFACE_CURRENT    | $J_s \,$ | $J_s \,$ |- |- − | ELECTRIC_FIELD + | MAGNETIC_FIELD_INTENSITY − | $\mathbf{E}$ + | $\mathbf{H}$ |- |- − | ELECTRIC_DISPLACEMENT_FIELD + | COERCIVITY − | $\mathbf{D}=\mathbf{\varepsilon} \mathbf{E}$ + | $\mathbf{H_c}$ + |- + | MAGNETIC_FLUX_DENSITY + | $\mathbf{B}=\mathbf{\mu} \mathbf{H}$ |- |- | INFINIT_COEFFICIENT | INFINIT_COEFFICIENT Line 46: Line 49: |} |} + The variables can be included either in the Kratos general register '''variables.h''' and '''variables.cpp''' or, much better for clarify and maintenance reasons, in the specific application files (as we will see later). − + For the first option, 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]]'''). − 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): In '''variables.h''', check if the following lines are included (if not, please include them): // for electromagnetic applications // for electromagnetic applications − // for kElectrostatic application + // for kMagnetostatic application − KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY) − KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_POTENTIAL) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY) − KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_POINT_CHARGE) + KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_POTENTIAL) − KRATOS_DEFINE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE) + KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_POINT_CURRENT) − KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD) + KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_SURFACE_CURRENT) − KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY) KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT) KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT) − + + If you have already defined the INFINIT_COEFFICIENT variable for your kElectrostatic application, it is not longer necessary to redefine it and, if you want to use the same name, then it is compulsory not to define it again. + In '''variables.cpp''', check if the following lines are included (if not, please include them): In '''variables.cpp''', check if the following lines are included (if not, please include them): // for electromagnetic applications // for electromagnetic applications − // for kElectrostatic application + // for kMagnetostatic application − KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY) + KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY) − KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_POTENTIAL) + KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY) − KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_POINT_CHARGE) + KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_POTENTIAL) − KRATOS_CREATE_VARIABLE(double, ELECTROSTATIC_SURFACE_CHARGE) + KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_POINT_CURRENT) − KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD) + KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_SURFACE_CURRENT) − KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD) + KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY) + KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY) KRATOS_CREATE_VARIABLE(double, INFINIT_COEFFICIENT) KRATOS_CREATE_VARIABLE(double, INFINIT_COEFFICIENT) Line 79: Line 86: // for electromagnetic applications // for electromagnetic applications − // for kElectrostatic application + // for kMagnetostatic application − KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRICAL_PERMITTIVITY) + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY) − KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_POTENTIAL) + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY) − KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_POINT_CHARGE) + KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_POTENTIAL) − KRATOS_REGISTER_VARIABLE(ELECTROSTATIC_SURFACE_CHARGE) + KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_POINT_CURRENT) − KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_FIELD) + KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_SURFACE_CURRENT) − KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELECTRIC_DISPLACEMENT_FIELD) + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY) + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY) KRATOS_REGISTER_VARIABLE(INFINIT_COEFFICIENT) KRATOS_REGISTER_VARIABLE(INFINIT_COEFFICIENT) − == The files' structure for the Electrostatic Kratos application == + == The files' structure for the Magnetostatic Kratos application == In the '''/Kratos/applications''' directory you have to create a new directory (called  "'''kMagnetostatic'''"). You have to create a set of custom directories for your application (basically '''/custom_conditions''', '''/custom_elements''', '''/custom_python''', '''/python_scripts''' and '''/test_examples'''): In the '''/Kratos/applications''' directory you have to create a new directory (called  "'''kMagnetostatic'''"). You have to create a set of custom directories for your application (basically '''/custom_conditions''', '''/custom_elements''', '''/custom_python''', '''/python_scripts''' and '''/test_examples'''):

## 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.

## Magnetostatic Application Kratos Variables

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

 MAGNETIC_PERMEABILITY $\mathbf{D}=\frac{1}{\mathbf{\mu}} \,$ MAGNETOSTATIC_POTENTIAL the unknowns, $\mathbf{a} \qquad \left ( \hat A_z (x,y,z) = \mathbf{N} \mathbf{a}^{(e)} \right )$ MAGNETOSTATIC_POINT_CURRENT $J_q = \int_S J_S \partial S$ MAGNETOSTATIC_SURFACE_CURRENT $J_s \,$ MAGNETIC_FIELD_INTENSITY $\mathbf{H}$ COERCIVITY $\mathbf{H_c}$ MAGNETIC_FLUX_DENSITY $\mathbf{B}=\mathbf{\mu} \mathbf{H}$ INFINIT_COEFFICIENT indicates if the infinit condition is applied

The variables can be included either in the Kratos general register variables.h and variables.cpp or, much better for clarify and maintenance reasons, in the specific application files (as we will see later).

For the first option, 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 kMagnetostatic application

KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY)
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY)
KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_POTENTIAL)
KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_POINT_CURRENT)
KRATOS_DEFINE_VARIABLE(double, MAGNETOSTATIC_SURFACE_CURRENT)
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY)
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY)
KRATOS_DEFINE_VARIABLE(double, INFINIT_COEFFICIENT)


If you have already defined the INFINIT_COEFFICIENT variable for your kElectrostatic application, it is not longer necessary to redefine it and, if you want to use the same name, then it is compulsory not to define it again.

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

	// for electromagnetic applications
// for kMagnetostatic application

KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY)
KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_POTENTIAL)
KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_POINT_CURRENT)
KRATOS_CREATE_VARIABLE(double, MAGNETOSTATIC_SURFACE_CURRENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY)
KRATOS_CREATE_VARIABLE(double, INFINIT_COEFFICIENT)


and:

	// for electromagnetic applications
// for kMagnetostatic application

KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_PERMEABILITY)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(COERCIVITY)
KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_POTENTIAL)
KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_POINT_CURRENT)
KRATOS_REGISTER_VARIABLE(MAGNETOSTATIC_SURFACE_CURRENT)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FIELD_INTENSITY)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAGNETIC_FLUX_DENSITY)
KRATOS_REGISTER_VARIABLE(INFINIT_COEFFICIENT)


## The files' structure for the Magnetostatic Kratos application

In the /Kratos/applications directory you have to create a new directory (called "kMagnetostatic"). 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
/kMagnetostatic
/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...