Skip to content

Commit

Permalink
Input: Add TopoHeight to the interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kulakovri committed Feb 13, 2024
1 parent e18c654 commit 0ed0246
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
22 changes: 13 additions & 9 deletions MDLIB/Main_DOODZ.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
asprintf(&BaseOutputFileName, "Output");
asprintf(&BaseParticleFileName, "Particles");

MdoodzInput input = (MdoodzInput) {
.model = inputFile.model,
.scaling = inputFile.scaling,
.materials = inputFile.materials,
.crazyConductivity = NULL,
MdoodzInput input = (MdoodzInput){
.model = inputFile.model,
.scaling = inputFile.scaling,
.materials = inputFile.materials,
.crazyConductivity = NULL,
.topoHeight = (TopoHeight){
.east = -0.0e3,
.west = -0.0e3,
},
};

if (setup->MutateInput) {
Expand Down Expand Up @@ -128,7 +132,7 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
}

// Initial grid tags
SetBCs(*setup->SetBCs, &input, &mesh);
SetBCs(*setup->SetBCs, &input, &mesh, &topo_chain);
if (input.model.free_surface == 1 ) {

// Define the horizontal position of the surface marker chain
Expand Down Expand Up @@ -190,7 +194,7 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
printf("Running with crazy conductivity for the asthenosphere!!\n");
}
// Initial solution fields
SetBCs(*setup->SetBCs, &input, &mesh);
SetBCs(*setup->SetBCs, &input, &mesh, &topo_chain);

if (input.model.mechanical == 1) {
InitialiseSolutionFields( &mesh, &input.model );
Expand All @@ -216,7 +220,7 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
P2Mastah( &input.model, particles, input.materials.Cv, &mesh, mesh.Cv, mesh.BCp.type, 0, 0, interp, cent, 1);
P2Mastah( &input.model, particles, input.materials.Qr, &mesh, mesh.Qr, mesh.BCp.type, 0, 0, interp, cent, 1);

SetBCs(*setup->SetBCs, &input, &mesh);
SetBCs(*setup->SetBCs, &input, &mesh, &topo_chain);
if (input.model.initial_cooling == 1 ) ThermalSteps( &mesh, input.model, mesh.rhs_t, &particles, input.model.cooling_duration, input.scaling );
if (input.model.therm_perturb == 1 ) SetThermalPert( &mesh, input.model, input.scaling );
Interp_Grid2P_centroids2( particles, particles.T, &mesh, mesh.T, mesh.xvz_coord, mesh.zvx_coord, mesh.Nx-1, mesh.Nz-1, mesh.BCt.type, &input.model );
Expand Down Expand Up @@ -584,7 +588,7 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
printf("Running with normal conductivity for the asthenosphere...\n");
}
// Allocate and initialise solution and RHS vectors
SetBCs(*setup->SetBCs, &input, &mesh);
SetBCs(*setup->SetBCs, &input, &mesh, &topo_chain);

// Reset fields and BC values if needed
// if ( input.model.pure_shear_ALE == 1 ) InitialiseSolutionFields( &mesh, &input.model );
Expand Down
4 changes: 3 additions & 1 deletion MDLIB/Setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void ValidateInternalPoint(POSITION position, char bcType, Coordinates coordinat
/*------------------------------------------------------ M-Doodz -----------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------*/

void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh) {
void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh, markers *topo_chain) {
/* --------------------------------------------------------------------------------------------------------*/
/* Set the BCs for Vx on all grid levels */
/* Type 0: Dirichlet point that matches the physical boundary (Vx:
Expand All @@ -195,6 +195,8 @@ void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh) {
double VxWestSum = 0.0;
double VxEastSum = 0.0;

instance->topoHeight.west = topo_chain->z[0];
instance->topoHeight.east = topo_chain->z[topo_chain->Nb_part-1];

for (int l = 0; l < mesh->Nz + 1; l++) {
for (int k = 0; k < mesh->Nx; k++) {
Expand Down
6 changes: 6 additions & 0 deletions MDLIB/include/mdoodz.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,17 @@ struct MdoodzSetup {
MutateInputParams *mutateInputParams;
};

typedef struct {
double east;
double west;
} TopoHeight;

struct MdoodzInput {
char *inputFileName;
params model;
mat_prop materials;
scale scaling;
TopoHeight topoHeight;
CrazyConductivity *crazyConductivity;
Geometry *geometry;
};
Expand Down
2 changes: 1 addition & 1 deletion MDLIB/mdoodz-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ void MinMaxArray(double *array, double scale, int size, char *text);

void BuildInitialTopography(BuildInitialTopography_ff buildInitialTopography, MdoodzInput *instance, markers *topo_chain);
void SetParticles(SetParticles_ff setParticles, MdoodzInput *instance, markers *particles);
void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh);
void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh, markers *topo_chain);

void ValidateSetup(MdoodzSetup *setup, MdoodzInput *instance);

Expand Down

0 comments on commit 0ed0246

Please sign in to comment.