Magnetostatic Application Global Files

From KratosWiki
Revision as of 10:42, 3 February 2010 by JMora (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Personal tools
Categories