tmp
This commit is contained in:
parent
4b369b25ea
commit
d9648a6250
65466
data/stt/mag_obs.csv
65466
data/stt/mag_obs.csv
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -101,14 +101,17 @@ int main(int argc, char const *argv[]) try
|
|||||||
array<point3dc> obsgrad;
|
array<point3dc> obsgrad;
|
||||||
|
|
||||||
// 正演磁分量数据
|
// 正演磁分量数据
|
||||||
|
set_magcone_ren17_tolerance(1e-30);
|
||||||
magobser(obsgrad, top_ele, btm_ele, obsp, sus, ShortMsg);
|
magobser(obsgrad, top_ele, btm_ele, obsp, sus, ShortMsg);
|
||||||
|
|
||||||
geodsv_io fout;
|
geodsv_io fout;
|
||||||
fout.init_table(obsp.size(), 6);
|
fout.init_table(obsp.size(), 6);
|
||||||
fout.set_column_names({"rad", "lon", "lat", "Br", "Bt", "Bp"});
|
fout.set_column_names({"rad", "lon", "lat", "Br", "Bt", "Bp"});
|
||||||
fout.fill_column_point3ds(obsp, "rad", "lon", "lat");
|
fout.fill_column_point3ds(obsp, "rad", "lon", "lat");
|
||||||
fout.fill_column_point3dc(obsgrad, "Br", "Bt", "Bp");
|
fout.fill_column_point3dc(obsgrad, "Br", "Bt", "Bp", 12);
|
||||||
fout.save_csv("data/stt/mag_obs");
|
fout.save_csv("data/stt/mag_obs");
|
||||||
|
|
||||||
|
system("xyz2nc -t data/stt/mag_obs.csv -g data/stt/mag_obs_ren17.nc -r 10/55/20/65 -i 0.25/0.25 -c 1,2,3,4,5 -l x,y,Br,Bt,Bp -d ','");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
|
@ -28,7 +28,14 @@
|
|||||||
#include "mkernel_tricone_Ren2017.h"
|
#include "mkernel_tricone_Ren2017.h"
|
||||||
#include "cmath"
|
#include "cmath"
|
||||||
|
|
||||||
#define GCTL_MAG_TETRA_TOL 1e-16
|
double mag_tolerance = 1e-16;
|
||||||
|
|
||||||
|
void gctl::set_magcone_ren17_tolerance(double tol)
|
||||||
|
{
|
||||||
|
if (tol > 0) mag_tolerance = tol;
|
||||||
|
else throw invalid_argument("Invalid tolerance value. From gctl::set_magcone_ren17_tolerance(...)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void gctl::callink_magnetic_para(array<magcone_ren17> &in_cone, array<magcone_para_ren17> &out_para, const array<point3dc> &mag_B)
|
void gctl::callink_magnetic_para(array<magcone_ren17> &in_cone, array<magcone_para_ren17> &out_para, const array<point3dc> &mag_B)
|
||||||
{
|
{
|
||||||
@ -167,7 +174,7 @@ gctl::point3dc gctl::magkernel_single(const magcone_ren17 &a_ele, const point3ds
|
|||||||
Rij0 = std::sqrt(wi0*wi0 + mij0*mij0);
|
Rij0 = std::sqrt(wi0*wi0 + mij0*mij0);
|
||||||
|
|
||||||
part2.set(0.0, 0.0, 0.0);
|
part2.set(0.0, 0.0, 0.0);
|
||||||
if (absw > GCTL_MAG_TETRA_TOL)
|
if (absw > mag_tolerance)
|
||||||
{
|
{
|
||||||
beta = atan((mij0*Sij_plus)/(Rij0*Rij0 + absw*Rij_plus))
|
beta = atan((mij0*Sij_plus)/(Rij0*Rij0 + absw*Rij_plus))
|
||||||
- atan((mij0*Sij_minus)/(Rij0*Rij0 + absw*Rij_minus));
|
- atan((mij0*Sij_minus)/(Rij0*Rij0 + absw*Rij_minus));
|
||||||
@ -175,7 +182,7 @@ gctl::point3dc gctl::magkernel_single(const magcone_ren17 &a_ele, const point3ds
|
|||||||
part2 = sig*beta*mpara->nf[f];
|
part2 = sig*beta*mpara->nf[f];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::abs(Rij0) > GCTL_MAG_TETRA_TOL)
|
if (std::abs(Rij0) > mag_tolerance)
|
||||||
{
|
{
|
||||||
Aij = std::log((long double)(Rij_plus+Sij_plus)) - std::log((long double)(Rij_minus+Sij_minus));
|
Aij = std::log((long double)(Rij_plus+Sij_plus)) - std::log((long double)(Rij_minus+Sij_minus));
|
||||||
}
|
}
|
||||||
@ -254,7 +261,7 @@ gctl::tensor gctl::magkernel_single_tensor(const magcone_ren17 &a_ele, const poi
|
|||||||
mij0 = gctl::dot(*a_ele.fget(f, j) - oi, mpara->ne[3*f+j]);
|
mij0 = gctl::dot(*a_ele.fget(f, j) - oi, mpara->ne[3*f+j]);
|
||||||
Rij0 = std::sqrt(wi0*wi0 + mij0*mij0);
|
Rij0 = std::sqrt(wi0*wi0 + mij0*mij0);
|
||||||
|
|
||||||
if (std::abs(Rij0) > GCTL_MAG_TETRA_TOL)
|
if (std::abs(Rij0) > mag_tolerance)
|
||||||
{
|
{
|
||||||
factor_n_mij = -1.0*(Sij_plus/(Rij0*Rij0*Rij_plus) - Sij_minus/(Rij0*Rij0*Rij_minus));
|
factor_n_mij = -1.0*(Sij_plus/(Rij0*Rij0*Rij_plus) - Sij_minus/(Rij0*Rij0*Rij_minus));
|
||||||
factor_tij = -1.0/Rij_plus + 1.0/Rij_minus;
|
factor_tij = -1.0/Rij_plus + 1.0/Rij_minus;
|
||||||
@ -271,7 +278,7 @@ gctl::tensor gctl::magkernel_single_tensor(const magcone_ren17 &a_ele, const poi
|
|||||||
tmp_k = gctl::kron(mpara->ne[3*f+j], grad_Aij);
|
tmp_k = gctl::kron(mpara->ne[3*f+j], grad_Aij);
|
||||||
k2 = k2 - tmp_k;
|
k2 = k2 - tmp_k;
|
||||||
|
|
||||||
if (absw > GCTL_MAG_TETRA_TOL)
|
if (absw > mag_tolerance)
|
||||||
{
|
{
|
||||||
grad_Rij_plus = (1.0/Rij_plus)*(site - *a_ele.fget(f, (j+1)%3));
|
grad_Rij_plus = (1.0/Rij_plus)*(site - *a_ele.fget(f, (j+1)%3));
|
||||||
grad_Rij_minus = (1.0/Rij_minus)*(site - *a_ele.fget(f, j));
|
grad_Rij_minus = (1.0/Rij_minus)*(site - *a_ele.fget(f, j));
|
||||||
@ -298,7 +305,7 @@ gctl::tensor gctl::magkernel_single_tensor(const magcone_ren17 &a_ele, const poi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (std::abs(mij0) > GCTL_MAG_TETRA_TOL)
|
if (std::abs(mij0) > mag_tolerance)
|
||||||
{
|
{
|
||||||
k3 += (-1.0/mij0)*(Sij_plus/Rij_plus - Sij_minus/Rij_minus);
|
k3 += (-1.0/mij0)*(Sij_plus/Rij_plus - Sij_minus/Rij_minus);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace gctl
|
namespace gctl
|
||||||
{
|
{
|
||||||
struct magcone_para_ren17
|
struct magcone_para_ren17
|
||||||
{
|
{
|
||||||
double mag_amp[4]; // 四面体四个面的磁化强度
|
double mag_amp[4]; // 四面体四个面的磁化强度
|
||||||
point3dc nf[4]; // 四面体面外法线矢量
|
point3dc nf[4]; // 四面体面外法线矢量
|
||||||
@ -42,14 +42,21 @@ namespace gctl
|
|||||||
|
|
||||||
typedef type_tricone<magcone_para_ren17> magcone_ren17; ///< 带magcone_para_ren17属性的三角锥结构体
|
typedef type_tricone<magcone_para_ren17> magcone_ren17; ///< 带magcone_para_ren17属性的三角锥结构体
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the tolerance for calculating the magnetic parameters of tricone elements.
|
||||||
|
*
|
||||||
|
* @param tol Tolerance
|
||||||
|
*/
|
||||||
|
void set_magcone_ren17_tolerance(double tol);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculate the magnetic parameters of given tricone elements.
|
* @brief Calculate the magnetic parameters of given tricone elements.
|
||||||
*
|
*
|
||||||
* @param in_tet Input and output elements
|
* @param in_tet Input and output elements
|
||||||
* @param out_para Output parameters
|
* @param out_para Output parameters
|
||||||
* @param mag_B magnetization vecrtors
|
* @param mag_B magnetization vecrtors
|
||||||
*/
|
*/
|
||||||
void callink_magnetic_para(array<magcone_ren17> &in_cone, array<magcone_para_ren17> &out_para, const array<point3dc> &mag_B);
|
void callink_magnetic_para(array<magcone_ren17> &in_cone, array<magcone_para_ren17> &out_para, const array<point3dc> &mag_B);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculate the magnetic parameters of given tricone elements wrt. the spherical coordinates.
|
* @brief Calculate the magnetic parameters of given tricone elements wrt. the spherical coordinates.
|
||||||
@ -118,7 +125,7 @@ namespace gctl
|
|||||||
* @return point3dc Magnetic field vector
|
* @return point3dc Magnetic field vector
|
||||||
*/
|
*/
|
||||||
void magobser(array<point3dc> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele,
|
void magobser(array<point3dc> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele,
|
||||||
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
|
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculate the magnetic field vector at a given observation point.
|
* @brief Calculate the magnetic field vector at a given observation point.
|
||||||
@ -129,7 +136,7 @@ namespace gctl
|
|||||||
* @return point3dc Magnetic field vector
|
* @return point3dc Magnetic field vector
|
||||||
*/
|
*/
|
||||||
void magobser(array<tensor> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele,
|
void magobser(array<tensor> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele,
|
||||||
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
|
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _GCTL_MAG_KERNEL_TRICONE_REN2017_H
|
#endif // _GCTL_MAG_KERNEL_TRICONE_REN2017_H
|
Loading…
Reference in New Issue
Block a user