Skip to content

Simplify ParentLayer.cpp and SnowLayer.cpp #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dogukanteber
Copy link
Contributor

Layer class has the following virtual methods:

virtual double getFrzThermCond()=0; // get frozen layer thermal conductivity
virtual double getUnfThermCond()=0; // get unfrozen layer thermal conductivity
virtual double getFrzVolHeatCapa()=0;// get frozen layer specific heat capcity
virtual double getUnfVolHeatCapa()=0;// get unfrozen layer specific heat capacity
virtual double getMixVolHeatCapa()=0;//Yuan

The implementation of some of these methods are same in ParentLayer.cpp and SnowLayer.cpp. We cannot merge the same methods in a single method. So, this PR attempts to explain why these methods have the same implementation. It also cleans up the method implementation.

double SnowLayer::getFrzVolHeatCapa() {
if (dz != 0) {
// FIX THIS: divide by zero error when there is no thickness!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this line because a check for division by zero is implemented.

@Benjamin-Maglio
Copy link
Collaborator

An example of a commenting structure for this method both in ParentLayer.cpp and SnowLayer.cpp could look something like the following. It may be wise to add the comment above the heat capacity and thermal conductivity functions respectively.

// get layer volumetric heat capacity (vhc)
// Note: though the following functions return the same value
//            they require different names to work inside TempUpdator.cpp
//            where these will be called by name and not by layer type. 
//            Hence they must match with the functions used in Layer.cpp
//            and SoilLayer.cpp.
// get frozen layer volumetric heat capacity
double ParentLayer::getFrzVolHeatCapa() {
  double vhc = vhcsolid ;
  return vhc;
};
// get unfrozen layer volumetric heat capacity
double ParentLayer::getUnfVolHeatCapa() {
  double vhc= vhcsolid ;
  return vhc;
};
// get mixed (partially frozen) layer volumetric heat capacity
double ParentLayer::getMixVolHeatCapa() {
  double vhc= vhcsolid ;
  return vhc;
};

@dogukanteber dogukanteber marked this pull request as ready for review May 21, 2024 14:53
@dogukanteber
Copy link
Contributor Author

dogukanteber commented Jun 5, 2024

Here are the plots after this change:

result.pdf

@Benjamin-Maglio Benjamin-Maglio merged commit 21821ef into uaf-arctic-eco-modeling:master Jun 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants